Michelson: test compare on bytes and concat on 2 strings
This commit is contained in:
parent
46f9f65b6a
commit
09592a6eeb
9
src/bin_client/test/contracts/compare_bytes.tz
Normal file
9
src/bin_client/test/contracts/compare_bytes.tz
Normal file
@ -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};
|
@ -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};
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user