Commit b8d5d4a9 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA] Add some tests on union typed abstractions

parent a0aab89f
......@@ -187,9 +187,6 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
);
"union" >:: ( fun test_ctxt ->
assert_equal ~msg:"Test CDuce.runtime.union.identity_precise failed"
~printer:(fun x -> x) "Abstraction((Int, Int) ,([ Char* ], [ Char* ]),{})"
(run_test_eval "fun ((Int -> Int) & (String -> String)) | x : (Int | String) -> x");
assert_equal ~msg:"Test CDuce.runtime.union.identity failed"
~printer:(fun x -> x) "Abstraction(([ Char* ] | Int, [ Char* ] | Int),{})"
(run_test_eval "fun f x : (Int | String) : (Int | String) -> x");
......@@ -213,6 +210,28 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : String -> \"Piece of cake\").\"test\"");
);
"union_precise" >:: ( fun test_ctxt ->
assert_equal ~msg:"Test CDuce.runtime.union_precise.identity failed"
~printer:(fun x -> x) "Abstraction((Int, Int) ,([ Char* ], [ Char* ]),{})"
(run_test_eval "fun ((Int -> Int) & (String -> String))
| x : (Int | String) -> x");
assert_equal ~msg:"Test CDuce.runtime.union_precise.match failed"
~printer:(fun x -> x) "Abstraction((Int, Int) ,([ Char* ], [ Char* ]),{})"
(run_test_eval "fun ((Int -> Int) & (String -> String))
| x : Int -> 2
| x : String -> \"Piece of cake\"");
assert_equal ~msg:"Test CDuce.runtime.union_precise.match_applied failed"
~printer:(fun x -> x) "2"
(run_test_eval "(fun ((Int -> Int) & (String -> String))
| x : Int -> 2
| x : String -> \"Piece of cake\").5");
assert_equal ~msg:"Test CDuce.runtime.union_precise.match_applied2 failed"
~printer:(fun x -> x) "\"Piece of cake\""
(run_test_eval "(fun ((Int -> Int) & (String -> String))
| x : Int -> 2
| x : String -> \"Piece of cake\").\"test\"");
);
"poly" >:: ( fun test_ctxt ->
assert_equal ~msg:"Test CDuce.runtime.poly.identity_pure failed"
~printer:(fun x -> x)
......
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