Add failing boolean operator test

This commit is contained in:
John David Pressman 2019-10-23 18:29:49 -07:00
parent 2566ebc7d0
commit ddc5b8e36d
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// Test CameLIGO boolean operators
let or_true (b : bool) : bool =
b or True
let or_false (b : bool) : bool =
b or False
let and_true (b : bool) : bool =
b and True
let and_false (b : bool) : bool =
b and False
let not_bool (b: bool) : bool =
not b

View File

@ -163,6 +163,19 @@ let bool_expression () : unit result =
] in ] in
ok () ok ()
let bool_expression_mligo () : unit result =
let%bind program = mtype_file "./contracts/boolean_operators.mligo" in
let%bind _ =
let aux (name, f) = expect_eq_b_bool program name f in
bind_map_list aux [
("or_true", fun b -> b || true) ;
("or_false", fun b -> b || false) ;
("and_true", fun b -> b && true) ;
("and_false", fun b -> b && false) ;
("not_bool", fun b -> not b) ;
] in
ok ()
let arithmetic () : unit result = let arithmetic () : unit result =
let%bind program = type_file "./contracts/arithmetic.ligo" in let%bind program = type_file "./contracts/arithmetic.ligo" in
let%bind _ = let%bind _ =
@ -941,6 +954,7 @@ let main = test_suite "Integration (End to End)" [
test "annotation" annotation ; test "annotation" annotation ;
test "multiple parameters" multiple_parameters ; test "multiple parameters" multiple_parameters ;
test "bool" bool_expression ; test "bool" bool_expression ;
test "bool (mligo)" bool_expression_mligo ;
test "arithmetic" arithmetic ; test "arithmetic" arithmetic ;
test "arithmetic (mligo)" arithmetic_mligo ; test "arithmetic (mligo)" arithmetic_mligo ;
test "bitiwse_arithmetic" bitwise_arithmetic ; test "bitiwse_arithmetic" bitwise_arithmetic ;