Commit 31208ef3 authored by Julien Lopez's avatar Julien Lopez

[TESTS] Minor fix on lambda tests; work on stdlib/list

parent 50d49e79
......@@ -285,7 +285,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : (!(Int|Bool)) -> x).[`true; 3; `true]");
assert_equal ~msg:"Test CDuce.runtime.misc.firsts failed"
~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) ->
match x,y : ((Int*Int)*(Int*Int)) with
| (a : Int,_ : Int),(b : Int,_ : Int) -> a,b");
......
......@@ -30,3 +30,19 @@ let iter (f : ('a -> []))(l : [('a)*]) : [] = match l with
| [] -> []
| [el; rest] -> f el; iter f rest
let iteri (f : (Int -> 'a -> []))(l : [('a)*]) : [] =
let aux (f : (Int -> 'a -> []))(l : [('a)*])(pos : Int) : [] = match l with
| [] -> []
| [el; rest] -> f pos el; aux f rest (pos + 1)
in
aux f l 0
(* Same typing error as rev
let mapf (f : 'a -> 'b)(l : [('a)*]) : [('b)*] =
let aux (f : 'a -> 'b)(l : [('a)*])(acc : [('b)*]) : [('b)*] = match l with
| [] -> acc
| [el; rest] -> aux f rest (acc @ [el]) in
aux f l []
*)
(* List scanning *)
......@@ -4,6 +4,10 @@ let nb_success = ref Int (0)
let nb_tests = ref Int (0)
(* Note: We are using List.iter here *)
(* let run_test_suite (l : [(Latin1, ('a), ('a)) *]) : [] =
iter (fun ((Latin1, 'a, 'a) -> []) (_, x, y) -> nb_tests := !nb_tests + 1;
if x = y then nb_success := !nb_success + 1 else []) l *)
let run_test_suite (l : [(Latin1, ('a), ('a)) *]) : [] = match l with
| [] -> []
| [(_, x, y) rest::(Latin1, ('a), ('a))*] -> nb_tests := !nb_tests + 1;
......
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