Commit 92cc25ff authored by Julien Lopez's avatar Julien Lopez

Use merge instead of union_disj to update gamma in compile

Fix tests of ocaml interface
parent b9abeaea
......@@ -259,7 +259,7 @@ and compile_branch env br =
let m = Patterns.filter (Types.descr (Patterns.accept br.Typed.br_pat)) br.Typed.br_pat in
let env =
{ env with
gamma = IdMap.union_disj m env.gamma;
gamma = IdMap.merge (fun _ v2 -> v2) m env.gamma;
xi = IdMap.merge (fun _ v2 -> v2) env.xi br.Typed.br_vars_poly
}
in
......
......@@ -52,11 +52,11 @@ let tests = "Misc" >:::
);
"pp" >:: ( fun test_ctxt ->
assert_equal ~printer:(fun x -> x) ~msg:"Test Misc.pp.1 failed" "(C,3,Mono)" (Misc.pp (Misc.C(3)));
assert_equal ~printer:(fun x -> x) ~msg:"Test Misc.pp.1 failed" "(C,3)" (Misc.pp (Misc.C(3)));
assert_equal ~msg:"Test Misc.pp.2 failed"
"(A,(C,3,Mono),Mono)" (Misc.pp (Misc.A(Misc.C(3))));
"(A,(C,3))" (Misc.pp (Misc.A(Misc.C(3))));
assert_equal ~msg:"Test Misc.pp.3 failed"
"(B,((C,3,Mono),(A,(C,2,Mono),Mono),Mono),Mono)" (Misc.pp (Misc.B(Misc.C(3),Misc.A(Misc.C(2)))));
"(B,((C,3),(A,(C,2))))" (Misc.pp (Misc.B(Misc.C(3),Misc.A(Misc.C(2)))));
);
"find" >:: ( fun test_ctxt ->
......@@ -120,14 +120,14 @@ let tests = "Misc" >:::
let stack = Misc.Novalue() in
let stack = Misc.push stack p1 in
assert_equal ~msg:"Test Misc.stack.push1 failed"
"{ a=1.200000 b=0.300000 c=0.500000 },Mono" (Misc.print_stack stack);
"{ a=1.200000 b=0.300000 c=0.500000 }" (Misc.print_stack stack);
let stack = Misc.push stack p2 in
assert_equal ~msg:"Test Misc.stack.push2 failed"
"{ a=-0.200000 b=0.400000 c=0.700000 },Mono{ a=1.200000 b=0.300000 c=0.500000 },Mono"
"{ a=-0.200000 b=0.400000 c=0.700000 }{ a=1.200000 b=0.300000 c=0.500000 }"
(Misc.print_stack stack);
let stack = Misc.pop stack in
assert_equal ~msg:"Test Misc.stack.pop1 failed"
"{ a=1.200000 b=0.300000 c=0.500000 },Mono" (Misc.print_stack stack);
"{ a=1.200000 b=0.300000 c=0.500000 }" (Misc.print_stack stack);
let stack = Misc.pop stack in
assert_equal ~msg:"Test Misc.stack.pop2 failed" ""
(Misc.print_stack stack);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment