Commit 810556ae authored by Taddeus Kroes's avatar Taddeus Kroes

funclang series5: Added some comments.

parent 73502961
......@@ -20,6 +20,7 @@ let test_freevars expect e =
test "freevars" e expect yield
let test_eval expect e = test "eval" e expect (expr2string (eval e));;
(* Test the 'expr2string' function *)
test_expr2string "let a = 1 in b" (Let ("a", (Num 1), (Var "b")));;
test_expr2string "a + 3" (BinopAp (Add, Var "a", Num 3));;
test_expr2string "-a" (MonopAp (Neg, Var "a"));;
......@@ -64,11 +65,13 @@ let ass1b =
let c = Var "c" in
(app (app (app (app uvw xyz) a) b) c);;
(* Test the 'freevars' function *)
test_freevars "a" (Fun ("b", (BinopAp (Add, Var "a", Num 3))));;
test_freevars "" (Fun ("a", (BinopAp (Add, Var "a", Num 3))));;
test_freevars "" ass1a;;
test_freevars "a, b, c" ass1b;;
(* Test the 'eval' function *)
test_eval "-5" (BinopAp (Sub, Num 4, Num 9));;
test_eval "false" (BinopAp (Lt, Num 6, Num 5));;
test_eval "true" (BinopAp (Or, Bool true, Bool false));;
......
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