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
31208ef3
Commit
31208ef3
authored
Jun 25, 2014
by
Julien Lopez
Browse files
[TESTS] Minor fix on lambda tests; work on stdlib/list
parent
50d49e79
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/lambda/src/lambdaTests.ml
View file @
31208ef3
...
...
@@ -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"
);
...
...
tests/stdlib/list/list.cd
View file @
31208ef3
...
...
@@ -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 *)
tests/stdlib/list/listtest.cd
View file @
31208ef3
...
...
@@ -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;
...
...
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