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

[MINOR] Fix tests

parent 25b12781
...@@ -48,11 +48,7 @@ let consId s = ...@@ -48,11 +48,7 @@ let consId s =
aux 0 aux 0
let ident_to_string list = let ident_to_string list =
let rec _ident_to_string list res = match list with List.map (fun (id, x) -> id.Caml_cduce.Ident.name, x) list
| (id, x) :: rest -> _ident_to_string rest (res @ [id.Caml_cduce.Ident.name, x])
| [] -> res
in
_ident_to_string list [];;
let rec typ t = let rec typ t =
try IntHash.find memo_typ t.uid try IntHash.find memo_typ t.uid
......
...@@ -153,7 +153,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >::: ...@@ -153,7 +153,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
"misc" >:: ( fun test_ctxt -> "misc" >:: ( fun test_ctxt ->
assert_equal ~msg:"Test CDuce.runtime.misc.even failed" assert_equal ~msg:"Test CDuce.runtime.misc.even failed"
~printer:(fun x -> x) ~printer:(fun x -> x)
"Abstraction([(Int,Bool),(Any \\ (Int),Any \\ (Int))],Mono)" "Abstraction([(Int,Bool),(Any \\ Int,Any \\ Int)],Mono)"
(run_test_eval "fun ((Int -> Bool) & ((!Int) -> (!Int))) (run_test_eval "fun ((Int -> Bool) & ((!Int) -> (!Int)))
| x : Int -> (match (x % 2) : Int with | x : Int -> (match (x % 2) : Int with
| 0 -> `true | 0 -> `true
...@@ -185,7 +185,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >::: ...@@ -185,7 +185,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : (!Int) -> x).[2; 3]"); | x : (!Int) -> x).[2; 3]");
assert_equal ~msg:"Test CDuce.runtime.misc.is_int failed" assert_equal ~msg:"Test CDuce.runtime.misc.is_int failed"
~printer:(fun x -> x) ~printer:(fun x -> x)
"Abstraction([(Int,Bool),(Bool,Bool),(Any \\ ((Bool | Int)),Any \\ ((Bool | Int)))],Mono)" "Abstraction([(Int,Bool),(Bool,Bool),(Any \\ (Int | Bool),Any \\ (Int | Bool))],Mono)"
(run_test_eval "fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool)))) (run_test_eval "fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true | x : Int -> `true
| x : Bool -> `false | x : Bool -> `false
...@@ -285,7 +285,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >::: ...@@ -285,7 +285,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : (!(Int|Bool)) -> x).[`true; 3; `true]"); | x : (!(Int|Bool)) -> x).[`true; 3; `true]");
assert_equal ~msg:"Test CDuce.runtime.misc.firsts failed" assert_equal ~msg:"Test CDuce.runtime.misc.firsts failed"
~printer:(fun x -> x) ~printer:(fun x -> x)
"Abstraction([((Int,Int),X1 -> X1 where X1 = (Int,Int))],Mono)" "Abstraction([((Int,Int),(Int,Int) -> (Int,Int))],Mono)"
(run_test_eval "fun firsts x : (Int*Int) y : (Int*Int) : (Int*Int) -> (run_test_eval "fun firsts x : (Int*Int) y : (Int*Int) : (Int*Int) ->
match x,y : ((Int*Int)*(Int*Int)) with match x,y : ((Int*Int)*(Int*Int)) with
| (a : Int,_ : Int),(b : Int,_ : Int) -> a,b"); | (a : Int,_ : Int),(b : Int,_ : Int) -> a,b");
...@@ -409,10 +409,10 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >::: ...@@ -409,10 +409,10 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
"union" >:: ( fun test_ctxt -> "union" >:: ( fun test_ctxt ->
assert_equal ~msg:"Test CDuce.runtime.union.identity failed" assert_equal ~msg:"Test CDuce.runtime.union.identity failed"
~printer:(fun x -> x) "Abstraction([((Int | [ Char* ]),(Int | [ Char* ]))],Mono)" ~printer:(fun x -> x) "Abstraction([([ Char* ] | Int,[ Char* ] | Int)],Mono)"
(run_test_eval "fun f x : (Int | String) : (Int | String) -> x"); (run_test_eval "fun f x : (Int | String) : (Int | String) -> x");
assert_equal ~msg:"Test CDuce.runtime.union.match failed" assert_equal ~msg:"Test CDuce.runtime.union.match failed"
~printer:(fun x -> x) "Abstraction([((Int | [ Char* ]),(Int | [ Char* ]))],Mono)" ~printer:(fun x -> x) "Abstraction([([ Char* ] | Int,[ Char* ] | Int)],Mono)"
(run_test_eval "fun f x : (Int | String) : (Int | String) -> (run_test_eval "fun f x : (Int | String) : (Int | String) ->
match x : (Int | String) with match x : (Int | String) with
| _ : Int -> 2 | _ : Int -> 2
......
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