Commit 8581264d authored by Pierre Chambart's avatar Pierre Chambart Committed by Benjamin Canou

Tests: add a Michelson guestbook test contract

parent c3c4e3d5
Pipeline #25042634 passed with stages
in 21 minutes and 41 seconds
parameter string;
storage (map address (option string));
code { UNPAIR @message @guestbook; SWAP;
DUP; SENDER; GET @previous_message;
ASSERT_SOME;
ASSERT_NONE;
SWAP; SOME; SOME; SENDER; UPDATE;
NIL operation;
PAIR }
......@@ -488,6 +488,17 @@ assert_storage $contract_dir/hash_consistency_checker.tz '0x00' \
assert_storage $contract_dir/hash_consistency_checker.tz '0x00' \
'(Pair 22220000000 (Pair "2017-12-13T04:49:00+00:00" 34))' "$hash_result"
# Test goldenbook
init_with_transfer $contract_dir/guestbook.tz $key1\
'{ Elt "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" None }' \
100 bootstrap1
assert_fails $client transfer 0 from bootstrap2 to guestbook -arg '"Pas moi"'
bake_after $client transfer 0 from bootstrap1 to guestbook -arg '"Coucou"'
assert_storage_contains guestbook '{ Elt "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" (Some "Coucou") }'
assert_fails $client transfer 0 from bootstrap3 to guestbook -arg '"Pas moi non plus"'
assert_fails $client transfer 0 from bootstrap1 to guestbook -arg '"Recoucou ?"'
# Test for big maps
init_with_transfer $contract_dir/big_map_mem.tz $key1\
'(Pair { Elt 1 Unit ; Elt 2 Unit ; Elt 3 Unit } Unit)' \
......
......@@ -177,7 +177,7 @@ contract_storage () {
assert_storage_contains () {
local CONTRACT_NAME="$1"
local EXPECTED_STORAGE="$2"
contract_storage ${CONTRACT_NAME} | assert_in_output ${EXPECTED_STORAGE}
contract_storage ${CONTRACT_NAME} | assert_in_output "${EXPECTED_STORAGE}"
}
assert() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment