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

[TESTS][LAMBDA] Add test List.rev; minor fix on GRAMMAR

parent b21b40a7
...@@ -26,6 +26,7 @@ expr = id ...@@ -26,6 +26,7 @@ expr = id
sigmalist = (* empty *) sigmalist = (* empty *)
| "{" "}" "," sigmalist | "{" "}" "," sigmalist
| "{" UIDENT "/" type_id sigma "}" "," sigmalist | "{" UIDENT "/" type_id sigma "}" "," sigmalist
;;
sigma = (* empty *) sigma = (* empty *)
| ";" UIDENT "/" type_id | ";" UIDENT "/" type_id
......
...@@ -361,6 +361,13 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >::: ...@@ -361,6 +361,13 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| (el : 'A[{A/(Int|Bool)}]) :: [] -> el | (el : 'A[{A/(Int|Bool)}]) :: [] -> el
| (el : 'A[{A/(Int|Bool)}]) :: (rest : ['A[{A/(Int|Bool)}]]) -> | (el : 'A[{A/(Int|Bool)}]) :: (rest : ['A[{A/(Int|Bool)}]]) ->
(if n = 0 then el else nth.rest.(n-1))).[1; 2; 5; `true; 2].2"); (if n = 0 then el else nth.rest.(n-1))).[1; 2; 5; `true; 2].2");
assert_equal ~msg:"Test CDuce.runtime.list.rev failed"
~printer:(fun x -> x) "(2, (Atom(true), (5, (2, (1, Atom(nil), {}), {}), {}), {}), {})"
(run_test_eval "(fun rev l : ['A[{A/(Int|Bool)}]] : ['A[{A/(Int|Bool)}]] ->
match l : ['A[{A/(Int|Bool)}]] with
| (el : 'A[{A/(Int|Bool)}]) :: [] -> [el]
| (el : 'A[{A/(Int|Bool)}]) :: (rest : ['A[{A/(Int|Bool)}]]) ->
(rev.rest) @ [el]).[1; 2; 5; `true; 2]");
); );
"union" >:: ( fun test_ctxt -> "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