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
54fb8ae2
Commit
54fb8ae2
authored
May 02, 2014
by
Julien Lopez
Browse files
[TESTS][LAMBDA] apply has now a highest priority than pair; add two tests
parent
835a6a6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/lambda/src/main.ml
View file @
54fb8ae2
...
...
@@ -337,6 +337,19 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
(
run_test_eval
"(fun concat x : [[Int]] : [Int] -> match x : [[Int]] with
| (el : [Int]) :: [] -> el
| (el : [Int]) :: (rest : [[Int]]) -> (el@(concat.rest))).[[1; 2; 5; 4; 8; 7]; [2; 3; 4]]"
);
assert_equal
~
msg
:
"Test CDuce.runtime.list.length_easy failed"
~
printer
:
(
fun
x
->
x
)
"6"
(
run_test_eval
"(fun length x : [Int] : Int -> match x : [Int] with
| [] -> 0
| (el : Int) :: (rest : [Int]) -> length.rest + 1).[1; 2; 5; 4; 8; 7]"
);
assert_equal
~
msg
:
"Test CDuce.runtime.list.length_hard failed"
~
printer
:
(
fun
x
->
x
)
"((6, 0, {}), 2, {})"
(
run_test_eval
"let length : (['A{A/Int; A/Bool}] -> Int) =
(fun f l : ['A{A/Int; A/Bool}] : Int -> match l : ['A{A/Int; A/Bool}] with
| [] -> 0
| (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)"
);
);
"union"
>::
(
fun
test_ctxt
->
...
...
tests/lambda/src/parse.ml
View file @
54fb8ae2
...
...
@@ -71,9 +71,8 @@ module ExprParser = struct
|
e1
=
SELF
;
"/"
;
e2
=
SELF
->
Op
(
_loc
,
"/"
,
e1
,
e2
)
|
e1
=
SELF
;
"%"
;
e2
=
SELF
->
Op
(
_loc
,
"%"
,
e1
,
e2
)
]
|
"concat"
LEFTA
[
e1
=
SELF
;
"@"
;
e2
=
SELF
->
Op
(
_loc
,
"@"
,
e1
,
e2
)
]
|
"pair"
LEFTA
[
e1
=
SELF
;
","
;
e2
=
SELF
->
Pair
(
_loc
,
e1
,
e2
)
|
e1
=
SELF
;
"."
;
e2
=
SELF
->
Apply
(
_loc
,
e1
,
e2
)
]
|
"pair"
LEFTA
[
e1
=
SELF
;
","
;
e2
=
SELF
->
Pair
(
_loc
,
e1
,
e2
)
]
|
"apply"
[
e1
=
SELF
;
"."
;
e2
=
SELF
->
Apply
(
_loc
,
e1
,
e2
)
]
|
"list"
LEFTA
[
"["
;
le
=
LIST0
SELF
SEP
";"
;
"]"
->
let
rec
make_seq
res
=
function
...
...
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