diff --git a/txscript/data/script_tests.json b/txscript/data/script_tests.json index 0134e8b490..2073055133 100644 --- a/txscript/data/script_tests.json +++ b/txscript/data/script_tests.json @@ -846,7 +846,7 @@ ["'ab'", "CAT TRUE", "NONE", "ERR_INVALID_STACK_OPERATION", "CAT requires a second input arg"], ["'a' 'abcdefghijklmnop' DUP CAT DUP CAT DUP CAT DUP CAT DUP CAT DUP CAT DUP CAT", "CAT", "NONE", "ERR_PUSH_SIZE", "CAT must fail if the result would exceed max allowed stack item size"], -["Substring related test coverage"], +["SUBSTR test coverage"], ["'abcd' 1 0", "SUBSTR 'a' EQUAL", "NONE", "OK", "SUBSTR uses 0-based indices"], ["'abcd' 3 1", "SUBSTR 'bc' EQUAL", "NONE", "OK", "SUBSTR end index is exclusive"], ["'abcd' 1 1", "SUBSTR NOT", "NONE", "OK", "SUBSTR same index must produce empty byte push which is equivalent to FALSE"], @@ -873,7 +873,7 @@ ["'' 4 2147483648", "SUBSTR NOT", "NONE", "ERR_OUT_OF_RANGE", "SUBSTR with empty string must fail with start index >4 bytes"], ["'' 2147483648 4", "SUBSTR NOT", "NONE", "ERR_OUT_OF_RANGE", "SUBSTR with empty string must fail with end index >4 bytes"], -["Left substring related test coverage"], +["LEFT test coverage"], ["'abcd' 0", "LEFT NOT", "NONE", "OK", "LEFT index of zero must produce empty byte push which is equivalent to FALSE"], ["'abcd' 1", "LEFT 'a' EQUAL", "NONE", "OK", "LEFT uses 0-based end index"], ["'abcd' 4", "LEFT 'abcd' EQUAL", "NONE", "OK", "LEFT produces entire string when end index equals string length"], @@ -889,7 +889,7 @@ ["'abc' 4", "LEFT NOT", "NONE", "ERR_OVERFLOW_SUBSTR_INDEX", "LEFT must fail with index too large"], ["'' 2147483648", "LEFT NOT", "NONE", "ERR_OUT_OF_RANGE", "LEFT with empty string must fail with index >4 bytes"], -["Right substring related test coverage"], +["RIGHT test coverage"], ["'abcd' 4", "RIGHT NOT", "NONE", "OK", "RIGHT index equal to length must produce empty byte push which is equivalent to FALSE"], ["'abcd' 3", "RIGHT 'd' EQUAL", "NONE", "OK", "RIGHT uses 0-based start index"], ["'abcd' 0", "RIGHT 'abcd' EQUAL", "NONE", "OK", "RIGHT produces entire string when start index is zero"], @@ -905,6 +905,36 @@ ["'abc' 4", "RIGHT NOT", "NONE", "ERR_OVERFLOW_SUBSTR_INDEX", "RIGHT must fail with index too large"], ["'' 2147483648", "RIGHT NOT", "NONE", "ERR_OUT_OF_RANGE", "RIGHT with empty string must fail with index >4 bytes"], +["SIZE test coverage"], +["0", "SIZE 0 EQUAL", "NONE", "OK"], +["1", "SIZE 1 EQUAL", "NONE", "OK"], +["127", "SIZE 1 EQUAL", "NONE", "OK"], +["128", "SIZE 2 EQUAL", "NONE", "OK"], +["32767", "SIZE 2 EQUAL", "NONE", "OK"], +["32768", "SIZE 3 EQUAL", "NONE", "OK"], +["8388607", "SIZE 3 EQUAL", "NONE", "OK"], +["8388608", "SIZE 4 EQUAL", "NONE", "OK"], +["2147483647", "SIZE 4 EQUAL", "NONE", "OK"], +["2147483648", "SIZE 5 EQUAL", "NONE", "OK"], +["549755813887", "SIZE 5 EQUAL", "NONE", "OK"], +["549755813888", "SIZE 6 EQUAL", "NONE", "OK"], +["9223372036854775807", "SIZE 8 EQUAL", "NONE", "OK"], +["-1", "SIZE 1 EQUAL", "NONE", "OK"], +["-127", "SIZE 1 EQUAL", "NONE", "OK"], +["-128", "SIZE 2 EQUAL", "NONE", "OK"], +["-32767", "SIZE 2 EQUAL", "NONE", "OK"], +["-32768", "SIZE 3 EQUAL", "NONE", "OK"], +["-8388607", "SIZE 3 EQUAL", "NONE", "OK"], +["-8388608", "SIZE 4 EQUAL", "NONE", "OK"], +["-2147483647", "SIZE 4 EQUAL", "NONE", "OK"], +["-2147483648", "SIZE 5 EQUAL", "NONE", "OK"], +["-549755813887", "SIZE 5 EQUAL", "NONE", "OK"], +["-549755813888", "SIZE 6 EQUAL", "NONE", "OK"], +["-9223372036854775807", "SIZE 8 EQUAL", "NONE", "OK"], +["'abcdefghijklmnopqrstuvwxyz'", "SIZE 26 EQUAL", "NONE", "OK"], +["42", "SIZE 1 EQUALVERIFY 42 EQUAL", "NONE", "OK", "SIZE does not consume argument"], +["NOP", "SIZE 1", "NONE", "ERR_INVALID_STACK_OPERATION"], + ["Right bit rotation related test coverage"], ["-2147483647 1", "ROTR -1073741824 EQUAL", "NONE", "OK", "ROTR 0x80000001 >>> 1"], ["-2147483647 2", "ROTR 1610612736 EQUAL", "NONE", "OK", "ROTR 0x80000001 >>> 2"], @@ -1127,34 +1157,7 @@ ["0", "IF VER ELSE 1 ENDIF", "NONE", "OK", "VER non-functional (ok if not executed)"], ["0", "IF RESERVED ELSE 1 ENDIF", "NONE", "OK", "RESERVED ok in un-executed IF"], -["0", "SIZE 0 EQUAL", "NONE", "OK"], -["1", "SIZE 1 EQUAL", "NONE", "OK"], -["127", "SIZE 1 EQUAL", "NONE", "OK"], -["128", "SIZE 2 EQUAL", "NONE", "OK"], -["32767", "SIZE 2 EQUAL", "NONE", "OK"], -["32768", "SIZE 3 EQUAL", "NONE", "OK"], -["8388607", "SIZE 3 EQUAL", "NONE", "OK"], -["8388608", "SIZE 4 EQUAL", "NONE", "OK"], -["2147483647", "SIZE 4 EQUAL", "NONE", "OK"], -["2147483648", "SIZE 5 EQUAL", "NONE", "OK"], -["549755813887", "SIZE 5 EQUAL", "NONE", "OK"], -["549755813888", "SIZE 6 EQUAL", "NONE", "OK"], -["9223372036854775807", "SIZE 8 EQUAL", "NONE", "OK"], -["-1", "SIZE 1 EQUAL", "NONE", "OK"], -["-127", "SIZE 1 EQUAL", "NONE", "OK"], -["-128", "SIZE 2 EQUAL", "NONE", "OK"], -["-32767", "SIZE 2 EQUAL", "NONE", "OK"], -["-32768", "SIZE 3 EQUAL", "NONE", "OK"], -["-8388607", "SIZE 3 EQUAL", "NONE", "OK"], -["-8388608", "SIZE 4 EQUAL", "NONE", "OK"], -["-2147483647", "SIZE 4 EQUAL", "NONE", "OK"], -["-2147483648", "SIZE 5 EQUAL", "NONE", "OK"], -["-549755813887", "SIZE 5 EQUAL", "NONE", "OK"], -["-549755813888", "SIZE 6 EQUAL", "NONE", "OK"], -["-9223372036854775807", "SIZE 8 EQUAL", "NONE", "OK"], -["'abcdefghijklmnopqrstuvwxyz'", "SIZE 26 EQUAL", "NONE", "OK"], -["42", "SIZE 1 EQUALVERIFY 42 EQUAL", "NONE", "OK", "SIZE does not consume argument"], -["NOP", "SIZE 1", "NONE", "ERR_INVALID_STACK_OPERATION"], + ["2 -2 ADD", "0 EQUAL", "NONE", "OK"], ["2147483647 -2147483647 ADD", "0 EQUAL", "NONE", "OK"],