Commit f7bae457 authored by Daniel Connolly's avatar Daniel Connolly

imported new version of script_tests.json from ABC, contains improved NUM2BIN tests

parent f52e94d6
[
["this file copied from the bitcoin-abc repository on 2018-05-16 - no copyright notice present"],
["Format is: [[wit..., amount]?, scriptSig, scriptPubKey, flags, expected_scripterror, ... comments]"],
["It is evaluated as if there was a crediting coinbase transaction with two 0"],
["pushes as scriptSig, and one output of 0 satoshi and given scriptPubKey,"],
......@@ -898,8 +897,18 @@
["-42 521", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "PUSH_SIZE", "Pushing 521 bytes is not"],
["-42 -3", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "PUSH_SIZE", "Negative size"],
["0x05 0xabcdef4280 4", "NUM2BIN 0x04 0xabcdefc2 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Item size reduction"],
["0x03 0xabcdef 2", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "IMPOSSIBLE_ENCODING", "output too small"],
["0x03 0xabcdef 3", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["0x01 0x80 0", "NUM2BIN 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Negative zero"],
["0x01 0x80 3", "NUM2BIN 0x03 0x000000 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Negative zero, larger output"],
["0x05 0xabcdef4243 5", "NUM2BIN 0x05 0xabcdef4243 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "NUM2BIN where len(a) > 4"],
["0x05 0xabcdef4243 6", "NUM2BIN 0x06 0xabcdef424300 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "pads output properly"],
["0x05 0xabcdef4243 4", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "IMPOSSIBLE_ENCODING", "output too small"],
["0x10 0x0102030405060708090A0B0C0D0E0F10 DUP CAT DUP CAT DUP CAT DUP CAT DUP CAT 0x08 0x0102030405060708 CAT 520", "NUM2BIN 0x10 0x0102030405060708090A0B0C0D0E0F10 DUP CAT DUP CAT DUP CAT DUP CAT DUP CAT 0x08 0x0102030405060708 CAT EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "520 byte 1st operand"],
["0x05 0x0000000000 5", "NUM2BIN 0x05 0x0000000000 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "1st operand not minimally encoded"],
["0x05 0x0001000000 3", "NUM2BIN 0x03 0x000100 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "1st operand can shrink"],
["1 0x05 0x0500000000", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "2nd operand not minimally encoded"],
["0x04 0xabcdef42 0x05 0xabcdef4243", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "2nd operand > 4 bytes"],
["BIN2NUM"],
["", "BIN2NUM 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "BIN2NUM, empty stack"],
......@@ -989,33 +998,62 @@
["1 -1", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-1 1", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-1 -1", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["2 2", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["2 -2", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-2 2", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-2 -2", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["0 1", "DIV 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["1 0", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "DIV_BY_ZERO", "DIV, divide by zero"],
["3 2", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Round towards zero"],
["3 -2", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Round towards zero"],
["28 21", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Round towards zero"],
["12 -7", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Round towards zero"],
["-32 29", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Round towards zero"],
["-42 -27", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Round towards zero"],
["0 123", "DIV 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["511 0", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "DIV_BY_ZERO", "DIV, divide by zero"],
["1 1", "DIV DEPTH 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Stack depth correct"],
["1", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"],
["0", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"],
["1 1", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["2147483647 1", "DIV 2147483647 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["1 2147483647", "DIV 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483647 2147483647", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 1", "DIV -2147483647 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-1 2147483647", "DIV 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 2147483647", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483647 -1", "DIV -2147483647 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["1 -2147483647", "DIV 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483647 -2147483647", "DIV -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 -1", "DIV 2147483647 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-1 -2147483647", "DIV 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 -2147483647", "DIV 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483648 1", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["1 2147483648", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["-2147483648 1", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["1 -2147483648", "DIV", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["MOD"],
["1 1", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["7 -3", "MOD 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-7 3", "MOD -1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["10 3", "MOD 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-1 1", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["1 -1", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-1 -1", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["82 23", "MOD 13 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["8 -3", "MOD 2 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-71 13", "MOD -6 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["-110 -31", "MOD -17 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["0 1", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"],
["1 0", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "MOD_BY_ZERO", "MOD, modulo by zero"],
["1 1", "MOD DEPTH 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Stack depth correct"],
["1", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"],
["0", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"],
["2147483647 123", "MOD 79 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["123 2147483647", "MOD 123 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483647 2147483647", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 123", "MOD -79 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-123 2147483647", "MOD -123 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 2147483647", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483647 -123", "MOD 79 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["123 -2147483647", "MOD 123 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483647 -2147483647", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 -123", "MOD -79 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-123 -2147483647", "MOD -123 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["-2147483647 -2147483647", "MOD 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Check boundary condition"],
["2147483648 1", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["1 2147483648", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["-2147483648 1", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["1 -2147483648", "MOD", "P2SH,STRICTENC,MONOLITH_OPCODES", "UNKNOWN_ERROR", "We cannot do math on 5-byte integers"],
["EQUAL"],
["", "EQUAL NOT", "P2SH,STRICTENC", "INVALID_STACK_OPERATION", "EQUAL must error when there are no stack items"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment