Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
5bd01019
Commit
5bd01019
authored
May 02, 2014
by
Julien Lopez
Browse files
[TESTS][LAMBDA] Add a test; small fix in GRAMMAR
parent
54fb8ae2
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/lambda/GRAMMAR
View file @
5bd01019
...
...
@@ -12,6 +12,7 @@ expr = id
| expr "*" expr
| expr "/" expr
| expr "%" expr
| expr "@" expr
| expr "{" UIDENT "/" type_id sigma "}" (* type substitutions *)
| "(" expr ")"
| "[" "]" (* nil *)
...
...
tests/lambda/src/main.ml
View file @
5bd01019
...
...
@@ -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
->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment