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
b8d5d4a9
Commit
b8d5d4a9
authored
Apr 24, 2014
by
Julien Lopez
Browse files
[TESTS][LAMBDA] Add some tests on union typed abstractions
parent
a0aab89f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/lambda/src/main.ml
View file @
b8d5d4a9
...
...
@@ -187,9 +187,6 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
);
"union"
>::
(
fun
test_ctxt
->
assert_equal
~
msg
:
"Test CDuce.runtime.union.identity_precise failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction((Int, Int) ,([ Char* ], [ Char* ]),{})"
(
run_test_eval
"fun ((Int -> Int) & (String -> String)) | x : (Int | String) -> x"
);
assert_equal
~
msg
:
"Test CDuce.runtime.union.identity failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction(([ Char* ] | Int, [ Char* ] | Int),{})"
(
run_test_eval
"fun f x : (Int | String) : (Int | String) -> x"
);
...
...
@@ -213,6 +210,28 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : String ->
\"
Piece of cake
\"
).
\"
test
\"
"
);
);
"union_precise"
>::
(
fun
test_ctxt
->
assert_equal
~
msg
:
"Test CDuce.runtime.union_precise.identity failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction((Int, Int) ,([ Char* ], [ Char* ]),{})"
(
run_test_eval
"fun ((Int -> Int) & (String -> String))
| x : (Int | String) -> x"
);
assert_equal
~
msg
:
"Test CDuce.runtime.union_precise.match failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction((Int, Int) ,([ Char* ], [ Char* ]),{})"
(
run_test_eval
"fun ((Int -> Int) & (String -> String))
| x : Int -> 2
| x : String ->
\"
Piece of cake
\"
"
);
assert_equal
~
msg
:
"Test CDuce.runtime.union_precise.match_applied failed"
~
printer
:
(
fun
x
->
x
)
"2"
(
run_test_eval
"(fun ((Int -> Int) & (String -> String))
| x : Int -> 2
| x : String ->
\"
Piece of cake
\"
).5"
);
assert_equal
~
msg
:
"Test CDuce.runtime.union_precise.match_applied2 failed"
~
printer
:
(
fun
x
->
x
)
"
\"
Piece of cake
\"
"
(
run_test_eval
"(fun ((Int -> Int) & (String -> String))
| x : Int -> 2
| x : String ->
\"
Piece of cake
\"
).
\"
test
\"
"
);
);
"poly"
>::
(
fun
test_ctxt
->
assert_equal
~
msg
:
"Test CDuce.runtime.poly.identity_pure failed"
~
printer
:
(
fun
x
->
x
)
...
...
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