ligo/test/test_basic.sh

71 lines
1.9 KiB
Bash
Raw Normal View History

#! /usr/bin/env bash
2016-09-08 21:13:10 +04:00
set -e
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
source $test_dir/lib/test_lib.inc.sh "$@"
2016-09-08 21:13:10 +04:00
start_node 1
2017-08-09 18:09:41 +04:00
activate_alpha
sleep 2
$client bake for bootstrap1 -max-priority 512
key1=foo
key2=bar
2017-08-09 18:09:41 +04:00
$client gen keys $key1
$client gen keys $key2
2016-09-08 21:13:10 +04:00
$client list known identities
$client get balance for bootstrap1
2016-09-08 21:13:10 +04:00
$client transfer 1,000 from bootstrap1 to $key1
$client transfer 2,000 from bootstrap1 to $key2
2016-09-08 21:13:10 +04:00
$client get balance for $key1 | assert "1,000 ꜩ"
$client get balance for $key2 | assert "2,000 ꜩ"
2016-09-08 21:13:10 +04:00
$client transfer 1,000 from $key2 to $key1
$client get balance for $key1 | assert "2,000 ꜩ"
$client get balance for $key2 | assert "999.95 ꜩ"
2016-09-08 21:13:10 +04:00
# Should fail
# $client transfer 999.95 from $key2 to $key1
# wait for the delay between two block
sleep 1
2017-11-20 06:37:06 +04:00
$client bake for bootstrap1 -max-priority 512
$client remember program noop file:contracts/noop.tz
$client typecheck program noop
$client originate contract noop \
for $key1 transferring 1,000 from bootstrap1 \
running noop
$client transfer 10 from bootstrap1 to noop -arg "Unit"
$client originate contract hardlimit \
for $key1 transferring 1,000 from bootstrap1 \
running file:contracts/hardlimit.tz -init "3"
$client transfer 10 from bootstrap1 to hardlimit -arg "Unit"
$client transfer 10 from bootstrap1 to hardlimit -arg "Unit"
# $client transfer 10 from bootstrap1 to hardlimit -arg "unit" # should fail
$client originate free account free_account for $key1
$client get delegate for free_account
$client set delegate for free_account to $key2
$client get delegate for free_account
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
$client transfer 400,000 from bootstrap5 to bootstrap1 -fee 0
$client transfer 400,000 from bootstrap1 to bootstrap5 -fee 0
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
2016-09-08 21:13:10 +04:00
echo
echo End of test
echo
show_logs="no"