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

[TESTS][LAMBDA] Add tests map_is_int (one fail probably because of the

	implementation of sequences)
parent 3a0266a9
......@@ -98,33 +98,32 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
"misc" >:: ( fun test_ctxt ->
assert_equal ~msg:"Test CDuce.runtime.misc.is_int failed"
~printer:(fun x -> x)
"Abstraction((Int, Bool) ,([ Char* ], Bool) ,(Any \\ ([ Char* ] | Int),
Any \\ ([ Char* ] | Int)),{})"
(run_test_eval "fun ((Int -> Bool) & (String -> Bool) & ((!(Int|String)) -> (!(Int|String))))
"Abstraction((Int, Bool) ,(Bool, Bool) ,(Any \\ (Int | Bool), Any \\ (Int | Bool)),{})"
(run_test_eval "fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : String -> `false
| x : (!(Int|String)) -> x");
| x : Bool -> `false
| x : (!(Int|Bool)) -> x");
assert_equal ~msg:"Test CDuce.runtime.misc.is_int_applied1 failed"
~printer:(fun x -> x)
"Atom(true)"
(run_test_eval "(fun ((Int -> Bool) & (String -> Bool) & ((!(Int|String)) -> (!(Int|String))))
(run_test_eval "(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : String -> `false
| x : (!(Int|String)) -> x).2");
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).2");
assert_equal ~msg:"Test CDuce.runtime.misc.is_int_applied2 failed"
~printer:(fun x -> x)
"Atom(false)"
(run_test_eval "(fun ((Int -> Bool) & (String -> Bool) & ((!(Int|String)) -> (!(Int|String))))
(run_test_eval "(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : String -> `false
| x : (!(Int|String)) -> x).\"coucou\"");
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).`true");
assert_equal ~msg:"Test CDuce.runtime.misc.is_int_applied3 failed"
~printer:(fun x -> x)
"(2, 3, {})"
(run_test_eval "(fun ((Int -> Bool) & (String -> Bool) & ((!(Int|String)) -> (!(Int|String))))
(run_test_eval "(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : String -> `false
| x : (!(Int|String)) -> x).[2; 3]");
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).[2; 3]");
assert_equal ~msg:"Test CDuce.runtime.misc.map failed"
~printer:(fun x -> x)
"Abstraction(((`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any | Arrow) ->
......@@ -139,6 +138,26 @@ Any \\ ([ Char* ] | Int)),{})"
match x : ['A{}] with
| (el : 'A{}) :: (rest : ['A{}]) -> [f.el; (map.f).rest]
| el : ['A{}] -> f.el");
assert_equal ~msg:"Test CDuce.runtime.misc.map_is_int_simple failed"
~printer:(fun x -> x)
"(Atom(false), Atom(true), {})"
(run_test_eval "(fun map f : ('A{}->'B{}) x : ['A{}] : ['B{}] ->
match x : ['A{}] with
| (el : 'A{}) :: (rest : ['A{}]) -> [f.el; (map.f).rest]
| el : ['A{}] -> f.el).(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).[`true; 3]");
assert_equal ~msg:"Test CDuce.runtime.misc.map_is_int_medium failed"
~printer:(fun x -> x)
"(Atom(false), Atom(true), Atom(false), {})"
(run_test_eval "(fun map f : ('A{}->'B{}) x : ['A{}] : ['B{}] ->
match x : ['A{}] with
| (el : 'A{}) :: (rest : ['A{}]) -> [f.el; (map.f).rest]
| el : ['A{}] -> f.el).(fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : Bool -> `false
| x : (!(Int|Bool)) -> x).[`true; 3; `true]");
assert_equal ~msg:"Test CDuce.runtime.misc.firsts failed"
~printer:(fun x -> x)
"Abstraction(((Int,Int), X1 -> X1 where X1 = (Int,Int)),{})"
......
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