Commit 0e06d80e authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA][MINOR] Add a map even test

parent d5d6ca9b
......@@ -212,6 +212,23 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| 0 -> `true
| 1 -> `false)
| x : (!Int) -> x).[4; \"hey\"; 3; 2]");
assert_equal ~msg:"Test CDuce.runtime.misc.map_even_hard failed"
~printer:(fun x -> x)
"(Atom(true), (\"hey\", ((3, (5, Atom(nil), {}), {}), (Atom(true), (Abstraction((
`$C & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any | Arrow, `$C & Int |
Char |
Atom |
(Any,Any) |
<(Any) (Any)>Any |
Arrow),{}), (Atom(false), Atom(nil), {}), {}), {}), {}), {}), {})"
(run_test_eval "(fun map f : ('A{A/Int;A/Bool}->'B{A/Int;A/Bool}) x : ['A{A/Int;A/Bool}] : ['B{A/Int;A/Bool}] ->
match x : ['A{A/Int;A/Bool}] with
| (el : 'A{A/Int;A/Bool}) :: (rest : ['A{A/Int;A/Bool}]) -> ((f.el), ((map.f).rest))
| [] -> []).(fun ((Int -> Bool) & ((!Int) -> (!Int)))
| x : Int -> (match (x % 2) : Int with
| 0 -> `true
| 1 -> `false)
| x : (!Int) -> x).[4; \"hey\"; [3; 5]; 2; (fun ('C{} -> 'C{}) | x : 'C{} -> x); 3+4]");
assert_equal ~msg:"Test CDuce.runtime.misc.map_is_int_simple failed"
~printer:(fun x -> x)
"(Atom(false), (Atom(true), Atom(nil), {}), {})"
......
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