[proto]: Remove commas from decimal repr of tezos
This commit is contained in:
parent
e1702e0db2
commit
4d3a01974c
@ -43,18 +43,17 @@ bake_after $client transfer 2,000 from bootstrap1 to $key2
|
|||||||
bake_after $client transfer 3,000 from bootstrap1 to $key3
|
bake_after $client transfer 3,000 from bootstrap1 to $key3
|
||||||
# bake_after $client transfer 4,000 from bootstrap1 to $key6
|
# bake_after $client transfer 4,000 from bootstrap1 to $key6
|
||||||
|
|
||||||
$client get balance for $key1 | assert "1,000 ꜩ"
|
$client get balance for $key1 | assert "1000 ꜩ"
|
||||||
$client get balance for $key2 | assert "2,000 ꜩ"
|
$client get balance for $key2 | assert "2000 ꜩ"
|
||||||
$client get balance for $key3 | assert "3,000 ꜩ"
|
$client get balance for $key3 | assert "3000 ꜩ"
|
||||||
# $client get balance for $key6 | assert "4,000 ꜩ"
|
|
||||||
|
|
||||||
bake_after $client transfer 1,000 from $key2 to $key1 -fee 0
|
bake_after $client transfer 1,000 from $key2 to $key1 -fee 0
|
||||||
$client get balance for $key1 | assert "2,000 ꜩ"
|
$client get balance for $key1 | assert "2000 ꜩ"
|
||||||
$client get balance for $key2 | assert "1,000 ꜩ"
|
$client get balance for $key2 | assert "1000 ꜩ"
|
||||||
|
|
||||||
bake_after $client transfer 1,000 from $key1 to $key2
|
bake_after $client transfer 1,000 from $key1 to $key2
|
||||||
$client get balance for $key1 | assert "999.95 ꜩ"
|
$client get balance for $key1 | assert "999.95 ꜩ"
|
||||||
$client get balance for $key2 | assert "2,000 ꜩ"
|
$client get balance for $key2 | assert "2000 ꜩ"
|
||||||
|
|
||||||
# Should fail
|
# Should fail
|
||||||
# $client transfer 999.95 from $key2 to $key1
|
# $client transfer 999.95 from $key2 to $key1
|
||||||
@ -84,16 +83,16 @@ bake_after $client register key $key2 as delegate
|
|||||||
bake_after $client set delegate for free_account to $key2
|
bake_after $client set delegate for free_account to $key2
|
||||||
$client get delegate for free_account
|
$client get delegate for free_account
|
||||||
|
|
||||||
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
|
$client get balance for bootstrap5 | assert "4000000 ꜩ"
|
||||||
bake_after $client transfer 400,000 from bootstrap5 to bootstrap1 -fee 0
|
bake_after $client transfer 400,000 from bootstrap5 to bootstrap1 -fee 0
|
||||||
bake_after $client transfer 400,000 from bootstrap1 to bootstrap5 -fee 0
|
bake_after $client transfer 400,000 from bootstrap1 to bootstrap5 -fee 0
|
||||||
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
|
$client get balance for bootstrap5 | assert "4000000 ꜩ"
|
||||||
|
|
||||||
bake_after $client activate account $key4 with king_commitment.json
|
bake_after $client activate account $key4 with king_commitment.json
|
||||||
bake_after $client activate account $key5 with queen_commitment.json
|
bake_after $client activate account $key5 with queen_commitment.json
|
||||||
|
|
||||||
$client get balance for $key4 | assert "23,932,454.669,343 ꜩ"
|
$client get balance for $key4 | assert "23932454.669343 ꜩ"
|
||||||
$client get balance for $key5 | assert "72,954,577.464,032 ꜩ"
|
$client get balance for $key5 | assert "72954577.464032 ꜩ"
|
||||||
|
|
||||||
bake_after $client transfer 10 from $key4 to $key5
|
bake_after $client transfer 10 from $key4 to $key5
|
||||||
|
|
||||||
|
@ -332,8 +332,8 @@ assert_storage $contract_dir/hash_key.tz None '"edpkuJqtDcA2m2muMxViSM47MPsGQzmy
|
|||||||
bake_after $client transfer 1,000 from bootstrap1 to $key1
|
bake_after $client transfer 1,000 from bootstrap1 to $key1
|
||||||
bake_after $client transfer 2,000 from bootstrap1 to $key2
|
bake_after $client transfer 2,000 from bootstrap1 to $key2
|
||||||
|
|
||||||
assert_balance $key1 "1,000 ꜩ"
|
assert_balance $key1 "1000 ꜩ"
|
||||||
assert_balance $key2 "2,000 ꜩ"
|
assert_balance $key2 "2000 ꜩ"
|
||||||
|
|
||||||
# Create a contract and transfer 100 ꜩ to it
|
# Create a contract and transfer 100 ꜩ to it
|
||||||
init_with_transfer $contract_dir/store_input.tz $key1 '""' 100 bootstrap1
|
init_with_transfer $contract_dir/store_input.tz $key1 '""' 100 bootstrap1
|
||||||
@ -409,7 +409,7 @@ assert_storage_contains $created_contract '"abcdefg"'
|
|||||||
init_with_transfer $contract_dir/default_account.tz $key1 \
|
init_with_transfer $contract_dir/default_account.tz $key1 \
|
||||||
Unit 1,000 bootstrap1
|
Unit 1,000 bootstrap1
|
||||||
bake_after $client transfer 0 from bootstrap1 to default_account -arg "\"$BOOTSTRAP4_IDENTITY\""
|
bake_after $client transfer 0 from bootstrap1 to default_account -arg "\"$BOOTSTRAP4_IDENTITY\""
|
||||||
assert_balance $BOOTSTRAP4_IDENTITY "4,000,100 ꜩ"
|
assert_balance $BOOTSTRAP4_IDENTITY "4000100 ꜩ"
|
||||||
account=tz1SuakBpFdG9b4twyfrSMqZzruxhpMeSrE5
|
account=tz1SuakBpFdG9b4twyfrSMqZzruxhpMeSrE5
|
||||||
bake_after $client transfer 0 from bootstrap1 to default_account -arg "\"$account\""
|
bake_after $client transfer 0 from bootstrap1 to default_account -arg "\"$account\""
|
||||||
assert_balance $account "100 ꜩ"
|
assert_balance $account "100 ꜩ"
|
||||||
|
@ -13,26 +13,26 @@ module Assert = Helpers.Assert
|
|||||||
|
|
||||||
let known_ok_tez_litterals =
|
let known_ok_tez_litterals =
|
||||||
[ 0L, "0" ;
|
[ 0L, "0" ;
|
||||||
10L, "0.000,01" ;
|
10L, "0.00001" ;
|
||||||
100L, "0.000,1" ;
|
100L, "0.0001" ;
|
||||||
1_000L, "0.001" ;
|
1_000L, "0.001" ;
|
||||||
10_000L, "0.01" ;
|
10_000L, "0.01" ;
|
||||||
100_000L, "0.1" ;
|
100_000L, "0.1" ;
|
||||||
1_000_000L, "1" ;
|
1_000_000L, "1" ;
|
||||||
10_000_000L, "10" ;
|
10_000_000L, "10" ;
|
||||||
100_000_000L, "100" ;
|
100_000_000L, "100" ;
|
||||||
1_000_000_000L, "1,000" ;
|
1_000_000_000L, "1000" ;
|
||||||
10_000_000_000L, "10,000" ;
|
10_000_000_000L, "10000" ;
|
||||||
100_000_000_000L, "100,000" ;
|
100_000_000_000L, "100000" ;
|
||||||
1_000_000_000_000L, "1,000,000" ;
|
1_000_000_000_000L, "1000000" ;
|
||||||
1_000_000_000_001L, "1,000,000.000,001" ;
|
1_000_000_000_001L, "1000000.000001" ;
|
||||||
1_000_000_000_010L, "1,000,000.000,01" ;
|
1_000_000_000_010L, "1000000.00001" ;
|
||||||
1_000_000_000_100L, "1,000,000.000,1" ;
|
1_000_000_000_100L, "1000000.0001" ;
|
||||||
1_000_000_001_000L, "1,000,000.001" ;
|
1_000_000_001_000L, "1000000.001" ;
|
||||||
1_000_000_010_000L, "1,000,000.01" ;
|
1_000_000_010_000L, "1000000.01" ;
|
||||||
1_000_000_100_000L, "1,000,000.1" ;
|
1_000_000_100_000L, "1000000.1" ;
|
||||||
123_123_123_123_123_123L, "123,123,123,123.123,123" ;
|
123_123_123_123_123_123L, "123123123123.123123" ;
|
||||||
999_999_999_999_999_999L, "999,999,999,999.999,999" ]
|
999_999_999_999_999_999L, "999999999999.999999" ]
|
||||||
|
|
||||||
let known_bad_tez_litterals =
|
let known_bad_tez_litterals =
|
||||||
[ "10000." ;
|
[ "10000." ;
|
||||||
|
@ -120,10 +120,9 @@ let delegatable_switch =
|
|||||||
()
|
()
|
||||||
|
|
||||||
let tez_format =
|
let tez_format =
|
||||||
"Text format: `D,DDD,DDD.DDD,DDD`.\n\
|
"Text format: `DDDDDDD.DDDDDD`.\n\
|
||||||
Tez and mutez and separated by a period sign. Trailing and pending \
|
Tez and mutez and separated by a period sign. Trailing and pending \
|
||||||
zeroes are allowed. Commas are optional, but if present they must \
|
zeroes are allowed."
|
||||||
be placed every 3 digits."
|
|
||||||
|
|
||||||
let tez_parameter param =
|
let tez_parameter param =
|
||||||
parameter
|
parameter
|
||||||
|
@ -128,7 +128,7 @@ module Make (T: QTY) : S = struct
|
|||||||
let rec left ppf amount =
|
let rec left ppf amount =
|
||||||
let d, r = Int64.(div amount 1000L), Int64.(rem amount 1000L) in
|
let d, r = Int64.(div amount 1000L), Int64.(rem amount 1000L) in
|
||||||
if d > 0L then
|
if d > 0L then
|
||||||
Format.fprintf ppf "%a,%03Ld" left d r
|
Format.fprintf ppf "%a%03Ld" left d r
|
||||||
else
|
else
|
||||||
Format.fprintf ppf "%Ld" r in
|
Format.fprintf ppf "%Ld" r in
|
||||||
let right ppf amount =
|
let right ppf amount =
|
||||||
@ -143,7 +143,7 @@ module Make (T: QTY) : S = struct
|
|||||||
if Compare.Int.(lo = 0) then
|
if Compare.Int.(lo = 0) then
|
||||||
Format.fprintf ppf "%a" triplet hi
|
Format.fprintf ppf "%a" triplet hi
|
||||||
else
|
else
|
||||||
Format.fprintf ppf "%03d,%a" hi triplet lo in
|
Format.fprintf ppf "%03d%a" hi triplet lo in
|
||||||
let ints, decs =
|
let ints, decs =
|
||||||
Int64.(div amount mult_int),
|
Int64.(div amount mult_int),
|
||||||
Int64.(to_int (rem amount mult_int)) in
|
Int64.(to_int (rem amount mult_int)) in
|
||||||
|
Loading…
Reference in New Issue
Block a user