diff --git a/src/bin_client/test/contracts/compare_bytes.tz b/src/bin_client/test/contracts/compare_bytes.tz new file mode 100644 index 000000000..3b5e5a9c4 --- /dev/null +++ b/src/bin_client/test/contracts/compare_bytes.tz @@ -0,0 +1,9 @@ +parameter (pair bytes bytes); +storage (list bool); +code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool}; + DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS}; + DIIIP {DUP; CAR; DIP {CDR}; COMPARE; GE; CONS}; + DIIP{DUP; CAR; DIP {CDR}; COMPARE; LT; CONS}; + DIP {DUP; CAR; DIP {CDR}; COMPARE; GT; CONS}; + DUP; CAR; DIP {CDR}; COMPARE; EQ; CONS; + NIL operation; PAIR}; diff --git a/src/bin_client/test/contracts/concat_hello.tz b/src/bin_client/test/contracts/concat_hello.tz index 338c856c5..e290b90fb 100644 --- a/src/bin_client/test/contracts/concat_hello.tz +++ b/src/bin_client/test/contracts/concat_hello.tz @@ -1,7 +1,4 @@ parameter (list string); storage (list string); code{ CAR; - MAP { NIL string ; SWAP ; CONS ; - PUSH @hello string "Hello "; CONS ; - CONCAT }; - NIL operation; PAIR}; + MAP { PUSH @hello string "Hello "; CONCAT }; NIL operation; PAIR}; diff --git a/src/bin_client/test/test_contracts.sh b/src/bin_client/test/test_contracts.sh index e95719f05..696f834f1 100755 --- a/src/bin_client/test/test_contracts.sh +++ b/src/bin_client/test/test_contracts.sh @@ -465,6 +465,12 @@ assert_success $client transfer 0 from bootstrap1 to reveal_signed_preimage -arg '(Pair 0x050100000027566f756c657a2d766f757320636f75636865722061766563206d6f692c20636520736f6972203f "p2sigsceCzcDw2AeYDzUonj4JT341WC9Px4wdhHBxbZcG1FhfqFVuG7f2fGCzrEHSAZgrsrQWpxduDPk9qZRgrpzwJnSHC3gZJ")' bake +# Test comparisons on bytes { EQ ; GT ; LT ; GE ; LE } +assert_storage $contract_dir/compare_bytes.tz '{}' '(Pair 0x33 0x34)' '{ False ; False ; True ; False ; True }' +assert_storage $contract_dir/compare_bytes.tz '{}' '(Pair 0x33 0x33aa)' '{ False ; False ; True ; False ; True }' +assert_storage $contract_dir/compare_bytes.tz '{}' '(Pair 0x33 0x33)' '{ True ; False ; False ; True ; True }' +assert_storage $contract_dir/compare_bytes.tz '{}' '(Pair 0x34 0x33)' '{ False ; True ; False ; True ; False }' + # Test SLICE and SIZE on bytes init_with_transfer $contract_dir/slices.tz bootstrap1 \ '"sppk7dBPqMPjDjXgKbb5f7V3PuKUrA4Zuwc3c3H7XqQerqPUWbK7Hna"' 1,000 bootstrap1