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
b21b40a7
Commit
b21b40a7
authored
May 02, 2014
by
Julien Lopez
Browse files
[TESTS][LAMBDA] Fix sigma identity
parent
6b25df64
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/lambda/src/compute.ml
View file @
b21b40a7
...
...
@@ -123,7 +123,7 @@ and type_of_ptype =
let
open
Types
in
function
|
Type
(
t
)
->
type_of_string
t
|
PType
(
t
,
s
)
->
if
s
=
[]
then
var
(
`Var
(
Var
.
make_id
t
))
else
type_of_sigma
t
s
if
s
=
[
[]
]
then
var
(
`Var
(
Var
.
make_id
t
))
else
type_of_sigma
t
s
|
TPair
(
t1
,
t2
)
->
times
(
cons
(
type_of_ptype
t1
))
(
cons
(
type_of_ptype
t2
))
|
TUnion
(
t1
,
t2
)
->
cup
(
type_of_ptype
t1
)
(
type_of_ptype
t2
)
|
TInter
(
t1
,
t2
)
->
cap
(
type_of_ptype
t1
)
(
type_of_ptype
t2
)
...
...
tests/lambda/src/main.ml
View file @
b21b40a7
...
...
@@ -39,16 +39,16 @@ Int) } ,{ (`$A/[ Char* ]) } })))",
(Any,Any) |
<(Any) (Any)>Any |
Arrow)* ]),{}))"
,
"fun tail x : ['A[]] : ['A[]] -> match x : ['A[]] with | (el : 'A[]) :: (rest : ['A[]]) -> rest"
;
"fun tail x : ['A[
{}
]] : ['A[
{}
]] -> match x : ['A[
{}
]] with | (el : 'A[
{}
]) :: (rest : ['A[
{}
]]) -> rest"
;
"Test CDuce.runtime.poly.pair failed"
,
"Abstraction(Dummy,,,,Sel(,((`$A & Int | Char | Atom | (Any,Any) |
<(Any) (Any)>Any | Arrow,`$B & Int | Char |
Atom | (Any,Any) | <(Any) (Any)>Any | Arrow) ->
`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any | Arrow),{}))"
,
"fun pair x : ('A[] * 'B[]) : 'A[] -> match x : ('A[] * 'B[]) with | (z : 'A[], y : 'B[]) -> z"
;
"fun pair x : ('A[
{}
] * 'B[
{}
]) : 'A[
{}
] -> match x : ('A[
{}
] * 'B[
{}
]) with | (z : 'A[
{}
], y : 'B[
{}
]) -> z"
;
"Test CDuce.runtime.poly.match_abstr failed"
,
"Apply(,)"
,
"(match (fun f x : 'A[] : 'A[] -> x) : ('A[] -> 'A[]) with | y : ('A[] -> 'A[]) -> y[{A/Int}]).3"
;
"(match (fun f x : 'A[
{}
] : 'A[
{}
] -> x) : ('A[
{}
] -> 'A[
{}
]) with | y : ('A[
{}
] -> 'A[
{}
]) -> y[{A/Int}]).3"
;
...
...
@@ -186,10 +186,10 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
(Any,Any) |
<(Any) (Any)>Any |
Arrow)* ]),{})"
(
run_test_eval
"fun map f : ('A[]->'B[]) x : ['A[]] : ['B[]] ->
match x : ['A[]] with
| (el : 'A[]) :: [] -> f.el
| (el : 'A[]) :: (rest : ['A[]]) -> ((f.el), ((map.f).rest))"
);
(
run_test_eval
"fun map f : ('A[
{}
]->'B[
{}
]) x : ['A[
{}
]] : ['B[
{}
]] ->
match x : ['A[
{}
]] with
| (el : 'A[
{}
]) :: [] -> f.el
| (el : 'A[
{}
]) :: (rest : ['A[
{}
]]) -> ((f.el), ((map.f).rest))"
);
assert_equal
~
msg
:
"Test CDuce.runtime.misc.map_even_simple failed"
~
printer
:
(
fun
x
->
x
)
"(
\"
hey
\"
, (Atom(false), Atom(nil), {}), {})"
...
...
@@ -228,7 +228,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : Int -> (match (x % 2) : Int with
| 0 -> `true
| 1 -> `false)
| x : (!Int) -> x).[4;
\"
hey
\"
; [3; 5]; 2; (fun ('C[] -> 'C[]) | x : 'C[] -> x); 3+4]"
);
| x : (!Int) -> x).[4;
\"
hey
\"
; [3; 5]; 2; (fun ('C[
{}
] -> 'C[
{}
]) | x : 'C[
{}
] -> x); 3+4]"
);
assert_equal
~
msg
:
"Test CDuce.runtime.misc.map_is_int_simple failed"
~
printer
:
(
fun
x
->
x
)
"(Atom(false), (Atom(true), Atom(nil), {}), {})"
...
...
@@ -414,7 +414,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
~
printer
:
(
fun
x
->
x
)
"Abstraction((`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any | Arrow,
`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any | Arrow),{})"
(
run_test_eval
"fun f x : 'A[] : 'A[] -> x"
);
(
run_test_eval
"fun f x : 'A[
{}
] : 'A[
{}
] -> x"
);
assert_equal
~
msg
:
"Test CDuce.runtime.poly.identity failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction(([ Char* ] | Int, [ Char* ] | Int),{})"
...
...
@@ -432,12 +432,12 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
"Abstraction(([ (`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any |
Arrow)* ], [ (`$A & Int | Char | Atom | (Any,Any) |
<(Any) (Any)>Any | Arrow)* ]),{})"
(
run_test_eval
"fun tail x : ['A[]] : ['A[]] -> match x : ['A[]] with
| (_ : 'A[]) :: (rest : ['A[]]) -> rest"
);
(
run_test_eval
"fun tail x : ['A[
{}
]] : ['A[
{}
]] -> match x : ['A[
{}
]] with
| (_ : 'A[
{}
]) :: (rest : ['A[
{}
]]) -> rest"
);
assert_equal
~
msg
:
"Test CDuce.runtime.poly.tail_applied failed"
~
printer
:
(
fun
x
->
x
)
"(7, (8, (5, Atom(nil), {}), {}), {})"
(
run_test_eval
"(fun tail x : ['A[]] : ['A[]] -> match x : ['A[]] with
| (_ : 'A[]) :: (rest : ['A[]]) -> rest).[3; 7; 8; 5]"
);
(
run_test_eval
"(fun tail x : ['A[
{}
]] : ['A[
{}
]] -> match x : ['A[
{}
]] with
| (_ : 'A[
{}
]) :: (rest : ['A[
{}
]]) -> rest).[3; 7; 8; 5]"
);
);
...
...
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