Add failing negative operator

This commit is contained in:
John David Pressman 2019-10-25 17:24:12 -07:00
parent 5a5c3a8dd4
commit b3993d0db9
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// Test CameLIGO arithmetic operators
let neg_op (n : int) : int =
-n

View File

@ -178,6 +178,15 @@ let arithmetic () : unit result =
let%bind () = expect_eq_n_pos program "div_op" e_int (fun n -> e_int (n / 2)) in let%bind () = expect_eq_n_pos program "div_op" e_int (fun n -> e_int (n / 2)) in
ok () ok ()
let arithmetic_mligo () : unit result =
let%bind program = mtype_file "./contracts/arithmetic.mligo" in
let%bind _ =
let aux (name , f) = expect_eq_n_int program name f in
bind_map_list aux [
("neg_op", fun n -> (-n)) ;
] in
ok ()
let bitwise_arithmetic () : unit result = let bitwise_arithmetic () : unit result =
let%bind program = type_file "./contracts/bitwise_arithmetic.ligo" in let%bind program = type_file "./contracts/bitwise_arithmetic.ligo" in
let%bind () = expect_eq program "or_op" (e_nat 7) (e_nat 7) in let%bind () = expect_eq program "or_op" (e_nat 7) (e_nat 7) in
@ -960,6 +969,7 @@ let main = test_suite "Integration (End to End)" [
test "multiple parameters" multiple_parameters ; test "multiple parameters" multiple_parameters ;
test "bool" bool_expression ; test "bool" bool_expression ;
test "arithmetic" arithmetic ; test "arithmetic" arithmetic ;
test "arithmetic (mligo)" arithmetic_mligo ;
test "bitiwse_arithmetic" bitwise_arithmetic ; test "bitiwse_arithmetic" bitwise_arithmetic ;
test "string_arithmetic" string_arithmetic ; test "string_arithmetic" string_arithmetic ;
test "string_arithmetic (mligo)" string_arithmetic_mligo ; test "string_arithmetic (mligo)" string_arithmetic_mligo ;