Commit 9d95ac98 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA] Add tests for let expressions

parent 7784d17f
...@@ -25,7 +25,7 @@ RM ?= rm -f ...@@ -25,7 +25,7 @@ RM ?= rm -f
OUT ?= main.native OUT ?= main.native
OUTDEBUG ?= main.byte OUTDEBUG ?= main.byte
.PHONY: clean check test _import .PHONY: clean _import
all: _import all: _import
$(COMPILER) -use-ocamlfind $(OUT) $(COMPILER) -use-ocamlfind $(OUT)
......
...@@ -77,6 +77,20 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >::: ...@@ -77,6 +77,20 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
assert_equal ~msg:"Test CDuce.runtime.abstr.let_simple failed" assert_equal ~msg:"Test CDuce.runtime.abstr.let_simple failed"
~printer:(fun x -> x) "3" ~printer:(fun x -> x) "3"
(run_test_eval "let x : Int = 3 in x : Int"); (run_test_eval "let x : Int = 3 in x : Int");
assert_equal ~msg:"Test CDuce.runtime.abstr.let_medium failed"
~printer:(fun x -> x) "2"
(run_test_eval "let f : (Int -> Int) = (fun (Int -> Int) | x : Int -> x)
in (f.f.2) : Int");
assert_equal ~msg:"Test CDuce.runtime.abstr.let_nested_simple failed"
~printer:(fun x -> x) "3"
(run_test_eval "let f : (Int -> Int) = (fun (Int -> Int) | x : Int -> x + 1)
in (let x : Int = f.2
in x : Int) : Int");
assert_equal ~msg:"Test CDuce.runtime.abstr.let_nested_medium failed"
~printer:(fun x -> x) "4"
(run_test_eval "let f : (Int -> Int) = (fun (Int -> Int) | x : Int -> x + 1)
in (let x : Int = f.2
in f.x : Int) : Int");
assert_equal ~msg:"Test CDuce.runtime.abstr.simple failed" assert_equal ~msg:"Test CDuce.runtime.abstr.simple failed"
~printer:(fun x -> x) "Abstraction((Int, Int),{})" ~printer:(fun x -> x) "Abstraction((Int, Int),{})"
(run_test_eval "fun f x : Int : Int -> 2"); (run_test_eval "fun f x : Int : 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