Michelson: updates test suite to use int
and nat
This commit is contained in:
parent
98c96be749
commit
69736ec55b
@ -1,7 +1,7 @@
|
|||||||
parameter uint64;
|
parameter nat;
|
||||||
return (list uint64);
|
return (list nat);
|
||||||
storage unit;
|
storage unit;
|
||||||
code {CAR; NIL uint64; SWAP; DUP; PUSH uint64 0; CMPNEQ;
|
code {CAR; NIL nat; SWAP; DUP; PUSH nat 0; CMPNEQ;
|
||||||
LOOP {DUP; DIP {SWAP}; CONS; SWAP; PUSH uint64 1; SWAP; SUB;
|
LOOP {DUP; DIP {SWAP}; CONS; SWAP; PUSH nat 1; SWAP; SUB;
|
||||||
DUP; PUSH uint64 0; CMPNEQ};
|
DUP; DIP{ABS} ; PUSH int 0; CMPNEQ};
|
||||||
CONS; UNIT; SWAP; PAIR};
|
CONS; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
parameter unit
|
parameter unit
|
||||||
code
|
code
|
||||||
{ # This contract stop to accept transactions after N incoming transactions
|
{ # This contract stops accepting transactions after N incoming transactions
|
||||||
CDR ; PUSH uint32 1 ; SWAP ; SUB ;
|
CDR ; DUP ; PUSH int 0 ; CMPLT; IF {PUSH int -1 ; ADD} {FAIL};
|
||||||
DUP ; PUSH uint32 0 ; COMPARE ; EQ ; IF { FAIL } {} ;
|
UNIT; PAIR}
|
||||||
UNIT ; PAIR }
|
|
||||||
return unit
|
return unit
|
||||||
storage uint32
|
storage int
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
parameter (list int32);
|
parameter (list int);
|
||||||
storage unit;
|
storage unit;
|
||||||
return (option int32);
|
return (option int);
|
||||||
code {CAR; DIP{NONE int32};
|
code {CAR; DIP{NONE int};
|
||||||
LAMBDA
|
LAMBDA
|
||||||
(pair int32 (option int32))
|
(pair int (option int))
|
||||||
(option int32)
|
(option int)
|
||||||
{DUP; DUP; CAR; SWAP; CDR;
|
{DUP; DUP; CAR; SWAP; CDR;
|
||||||
IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}};
|
IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}};
|
||||||
REDUCE; UNIT; SWAP; PAIR};
|
REDUCE; UNIT; SWAP; PAIR};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
storage unit ;
|
storage unit ;
|
||||||
parameter uint16 ;
|
parameter nat ;
|
||||||
return (list (contract unit unit)) ;
|
return (list (contract unit unit)) ;
|
||||||
code
|
code
|
||||||
{ CAR ; DUP ; PUSH uint16 0 ; CMPNEQ ;
|
{ CAR ; DUP ; PUSH nat 0 ; CMPNEQ ;
|
||||||
DIIP { NIL (contract unit unit) } ;
|
DIIP { NIL (contract unit unit) } ;
|
||||||
LOOP
|
LOOP
|
||||||
{ PUSH tez "5.00" ;
|
{ PUSH tez "5.00" ;
|
||||||
@ -11,7 +11,7 @@ code
|
|||||||
PUSH key "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager
|
PUSH key "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager
|
||||||
CREATE_ACCOUNT ;
|
CREATE_ACCOUNT ;
|
||||||
SWAP ; DIP { CONS } ;
|
SWAP ; DIP { CONS } ;
|
||||||
PUSH uint16 1 ; SWAP ; SUB ;
|
PUSH nat 1 ; SWAP ; SUB ;
|
||||||
DUP ; PUSH uint16 0 ; CMPNEQ } ;
|
DUP ; PUSH nat 0 ; CMPNEQ } ;
|
||||||
DROP ;
|
DROP ;
|
||||||
UNIT ; SWAP ; PAIR }
|
UNIT ; SWAP ; PAIR }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter unit;
|
parameter unit;
|
||||||
code {CAR; PUSH uint32 300; PAIR};
|
code {CAR; PUSH nat 300; PAIR};
|
||||||
return uint32;
|
return nat;
|
||||||
storage unit;
|
storage unit;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
parameter unit;
|
parameter unit;
|
||||||
return uint32;
|
return nat;
|
||||||
storage unit;
|
storage unit;
|
||||||
code {DROP; UNIT; STEPS_TO_QUOTA; PAIR};
|
code {DROP; UNIT; STEPS_TO_QUOTA; PAIR};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# (pair signed_weather_data actual_level)
|
# (pair signed_weather_data actual_level)
|
||||||
parameter (pair signature uint16);
|
parameter (pair signature nat);
|
||||||
# (pair (under_key over_key) (pair weather_service_key (pair rain_level days_in_future)))
|
# (pair (under_key over_key) (pair weather_service_key (pair rain_level days_in_future)))
|
||||||
storage (pair (pair (contract unit unit) (contract unit unit)) (pair uint16 key));
|
storage (pair (pair (contract unit unit) (contract unit unit)) (pair nat key));
|
||||||
return unit;
|
return unit;
|
||||||
code {DUP; DUP;
|
code {DUP; DUP;
|
||||||
CAR; DUP; DIP{CDR; H}; CAR; PAIR;
|
CAR; DUP; DIP{CDR; H}; CAR; PAIR;
|
||||||
|
@ -43,6 +43,7 @@ assert_output () {
|
|||||||
local input=$2;
|
local input=$2;
|
||||||
local storage=$3;
|
local storage=$3;
|
||||||
local expected=$4;
|
local expected=$4;
|
||||||
|
echo "Testing [$contract]"
|
||||||
local output=$(run_contract_file "$contract" "$input" "$storage" | sed '1,/output/d' |
|
local output=$(run_contract_file "$contract" "$input" "$storage" | sed '1,/output/d' |
|
||||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' ||
|
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' ||
|
||||||
{ printf '\nTest failed with error at line %s\n' "$(caller)" > /dev/stderr;
|
{ printf '\nTest failed with error at line %s\n' "$(caller)" > /dev/stderr;
|
||||||
@ -82,6 +83,7 @@ init_with_transfer () {
|
|||||||
local INITIAL_STORAGE="$3"
|
local INITIAL_STORAGE="$3"
|
||||||
local TRANSFER_AMT="$4"
|
local TRANSFER_AMT="$4"
|
||||||
local TRANSFER_SRC=${5-bootstrap1}
|
local TRANSFER_SRC=${5-bootstrap1}
|
||||||
|
echo "Originating [$NAME]"
|
||||||
${TZCLIENT} originate contract ${NAME} \
|
${TZCLIENT} originate contract ${NAME} \
|
||||||
for ${KEY} transferring "${TRANSFER_AMT}" \
|
for ${KEY} transferring "${TRANSFER_AMT}" \
|
||||||
from ${TRANSFER_SRC} running "${FILE}" -init "${INITIAL_STORAGE}"
|
from ${TRANSFER_SRC} running "${FILE}" -init "${INITIAL_STORAGE}"
|
||||||
|
Loading…
Reference in New Issue
Block a user