Add more string tests to CameLIGO

This commit is contained in:
John David Pressman 2019-10-25 16:33:31 -07:00
parent 0eb2b73afa
commit 8cfa583d55
2 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,10 @@
(* Test that the string concatenation syntax in CameLIGO works *)
let size_op (s : string) : nat =
String.size s
let slice_op (s : string) : string =
String.slice 1p 2p s
let concat_syntax (s: string) =
s ^ "test_literal"

View File

@ -239,6 +239,9 @@ let string_arithmetic () : unit result =
let string_arithmetic_mligo () : unit result =
let%bind program = mtype_file "./contracts/string_arithmetic.mligo" in
let%bind () = expect_eq program "size_op" (e_string "tata") (e_nat 4) in
let%bind () = expect_eq program "slice_op" (e_string "tata") (e_string "at") in
let%bind () = expect_eq program "slice_op" (e_string "foo") (e_string "oo") in
let%bind () = expect_eq program "concat_syntax" (e_string "string_") (e_string "string_test_literal")
in ok ()