Client: reorg Michelson test contracts and bash scripts (attic, pt2)

This commit is contained in:
b 2018-10-29 14:48:25 +01:00 committed by Benjamin Canou
parent 291e3f06a3
commit 015c5ed694
No known key found for this signature in database
GPG Key ID: 73607948459DC5F8
13 changed files with 86 additions and 10 deletions

View File

@ -76,6 +76,21 @@
%{bin:tezos-client}
%{bin:tezos-admin-client})))
(alias
(name runtest_contracts_attic.sh)
(deps sandbox.json
test_lib.inc.sh
(glob_files contracts_attic/*))
(locks /tcp-port/18731
/tcp-port/19731)
(action
(run bash %{dep:test_contracts_attic.sh}
%{bin:tezos-sandboxed-node.sh}
%{bin:tezos-node}
%{bin:tezos-init-sandboxed-client.sh}
%{bin:tezos-client}
%{bin:tezos-admin-client})))
(alias
(name runtest_multinode.sh)
(deps sandbox.json

View File

@ -105,10 +105,6 @@ assert_storage $contract_dir/map_id.tz '{}' '{ Elt 0 1 }' '{ Elt 0 1 }'
assert_storage $contract_dir/map_id.tz '{}' '{ Elt 0 0 }' '{ Elt 0 0 }'
assert_storage $contract_dir/map_id.tz '{}' '{ Elt 0 0 ; Elt 3 4 }' '{ Elt 0 0 ; Elt 3 4 }'
# Map block on lists
assert_storage $contract_dir/list_map_block.tz '{0}' '{}' '{}'
assert_storage $contract_dir/list_map_block.tz '{0}' '{ 1 ; 1 ; 1 ; 1 }' '{ 1 ; 2 ; 3 ; 4 }'
assert_storage $contract_dir/list_map_block.tz '{0}' '{ 1 ; 2 ; 3 ; 0 }' '{ 1 ; 3 ; 5 ; 3 }'
# List iter
assert_storage $contract_dir/list_iter.tz 0 '{ 10 ; 2 ; 1 }' 20
@ -200,15 +196,9 @@ assert_storage $contract_dir/swap_left_right.tz '(Left "X")' '(Left True)' '(Rig
assert_storage $contract_dir/swap_left_right.tz '(Left "X")' '(Right "a")' '(Left "a")'
# Reverse a list
assert_storage $contract_dir/reverse.tz '{""}' '{}' '{}'
assert_storage $contract_dir/reverse.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
assert_storage $contract_dir/reverse_loop.tz '{""}' '{}' '{}'
assert_storage $contract_dir/reverse_loop.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# Reverse using LOOP_LEFT
assert_storage $contract_dir/loop_left.tz '{""}' '{}' '{}'
assert_storage $contract_dir/loop_left.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# Exec concat contract
#assert_storage $contract_dir/exec_concat.tz '"?"' '""' '"_abc"'
#assert_storage $contract_dir/exec_concat.tz '"?"' '"test"' '"test_abc"'

View File

@ -0,0 +1,68 @@
#!/bin/bash
set -e
set -o pipefail
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
source $test_dir/test_lib.inc.sh "$@"
start_node 1
activate_alpha
$client -w none config update
bake
key1=foo
key2=bar
$client gen keys $key1
$client gen keys $key2
printf "\n\n"
# Assert all contracts typecheck
if [ ! $NO_TYPECHECK ] ; then
for contract in `ls $contract_attic_dir/*.tz`; do
printf "[Typechecking %s]\n" "$contract";
${client} typecheck script "$contract";
done
printf "All contracts are well typed\n\n"
fi
# Map block on lists
assert_storage $contract_attic_dir/list_map_block.tz '{0}' '{}' '{}'
assert_storage $contract_attic_dir/list_map_block.tz '{0}' '{ 1 ; 1 ; 1 ; 1 }' '{ 1 ; 2 ; 3 ; 4 }'
assert_storage $contract_attic_dir/list_map_block.tz '{0}' '{ 1 ; 2 ; 3 ; 0 }' '{ 1 ; 3 ; 5 ; 3 }'
# Reverse a list
assert_storage $contract_attic_dir/reverse.tz '{""}' '{}' '{}'
assert_storage $contract_attic_dir/reverse.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# Reverse using LOOP_LEFT
assert_storage $contract_attic_dir/loop_left.tz '{""}' '{}' '{}'
assert_storage $contract_attic_dir/loop_left.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# TODO [a-k] contracts in attic
# List of transactions
# TODO
# Queue
# TODO
# Reduce map
# TODO
# Reentrancy
# TODO
# Spawn identities
# TODO
printf "\nEnd of test\n"
show_logs="no"

View File

@ -1,3 +1,5 @@
#!/bin/bash
set -e
set -o pipefail

View File

@ -20,6 +20,7 @@ contract_dir="contracts"
contract_op_dir="contracts_opcode"
contract_macros_dir="contracts_macros"
contract_scenarios_dir="contracts_mini_scenarios"
contract_attic_dir="contracts_attic"
source $tezos_sandboxed_node
source $tezos_init_sandboxed_client