Commit 5bd01019 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA] Add a test; small fix in GRAMMAR

parent 54fb8ae2
......@@ -12,6 +12,7 @@ expr = id
| expr "*" expr
| expr "/" expr
| expr "%" expr
| expr "@" expr
| expr "{" UIDENT "/" type_id sigma "}" (* type substitutions *)
| "(" expr ")"
| "[" "]" (* nil *)
......
......@@ -350,6 +350,13 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| (el : 'A{A/Int; A/Bool}) :: (rest : ['A{A/Int; A/Bool}]) -> f.rest + 1)
in
(length.[1; 2; 5; 4; 8; 7], length.[], length.[`true; 2]) : (Int*Int*Int)");
assert_equal ~msg:"Test CDuce.runtime.list.nth failed"
~printer:(fun x -> x) "5"
(run_test_eval "(fun nth l : ['A{A/Int; A/Bool}] n : Int : 'A{A/Int; A/Bool} ->
match l : ['A{A/Int; A/Bool}] with
| (el : 'A{A/Int; A/Bool}) :: [] -> el
| (el : 'A{A/Int; A/Bool}) :: (rest : ['A{A/Int; A/Bool}]) ->
(match n : Int with | 0 -> el | _ : Int -> (nth.rest).(n-1))).[1; 2; 5; `true; 2].2");
);
"union" >:: ( fun test_ctxt ->
......
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