ligo/test/test_basic.sh
Pietro Abate 174ea10d6d Alpha: Add 4 more decimals to tez representation.
Now a tez cent is 10_000L. All constants are now in the
Constants_repr module and expressed as multiples of one_cent.

Add new function Qty_repr.mul_exn to multiply `tez` by `int`
  eg. `10 tez = Tez_repr.(mul_exn one 10)`
      `10 cents = Tez_repr.(mul_exn one_cents 10)`

Remove `Tez.{to,of}_cents` and replace them with `Tez.{to,of}_mutez`.
2017-12-08 11:08:12 +00:00

71 lines
1.9 KiB
Bash
Executable File

#! /usr/bin/env bash
set -e
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
source $test_dir/lib/test_lib.inc.sh "$@"
start_node 1
activate_alpha
sleep 2
$client bake for bootstrap1 -max-priority 512
key1=foo
key2=bar
$client gen keys $key1
$client gen keys $key2
$client list known identities
$client get balance for bootstrap1
$client transfer 1,000 from bootstrap1 to $key1
$client transfer 2,000 from bootstrap1 to $key2
$client get balance for $key1 | assert "1,000 ꜩ"
$client get balance for $key2 | assert "2,000 ꜩ"
$client transfer 1,000 from $key2 to $key1
$client get balance for $key1 | assert "2,000 ꜩ"
$client get balance for $key2 | assert "999.95 ꜩ"
# Should fail
# $client transfer 999.95 from $key2 to $key1
# wait for the delay between two block
sleep 1
$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 ꜩ"
echo
echo End of test
echo
show_logs="no"