Changeset View
Changeset View
Standalone View
Standalone View
src/test/monolith_opcodes_tests.cpp
| Show First 20 Lines • Show All 707 Lines • ▼ Show 20 Lines | static void CheckDivMod(const valtype &a, const valtype &b, | ||||
| CheckBinaryOp(b, b, OP_DIV, {0x01}); | CheckBinaryOp(b, b, OP_DIV, {0x01}); | ||||
| CheckBinaryOp(b, NegativeValtype(b), OP_DIV, {0x81}); | CheckBinaryOp(b, NegativeValtype(b), OP_DIV, {0x81}); | ||||
| CheckBinaryOp(NegativeValtype(b), b, OP_DIV, {0x81}); | CheckBinaryOp(NegativeValtype(b), b, OP_DIV, {0x81}); | ||||
| // Modulo identities | // Modulo identities | ||||
| // a % b % b = a % b | // a % b % b = a % b | ||||
| CheckTestResultForAllFlags( | CheckTestResultForAllFlags( | ||||
| {a, b}, | {a, b}, | ||||
| CScript() << OP_MOD | CScript() | ||||
| << CScriptNum(b, true, MAX_SCRIPTNUM_BYTE_SIZE).getint() | << OP_MOD | ||||
| << CScriptNum(b, true, MAX_SCRIPTNUM_BYTE_SIZE_31_BIT).getint() | |||||
| << OP_MOD, | << OP_MOD, | ||||
| {modExpected}); | {modExpected}); | ||||
| } | } | ||||
| static void CheckDivModError(const stacktype &original_stack, | static void CheckDivModError(const stacktype &original_stack, | ||||
| ScriptError expected_error) { | ScriptError expected_error) { | ||||
| CheckOpError(original_stack, OP_DIV, expected_error); | CheckOpError(original_stack, OP_DIV, expected_error); | ||||
| CheckOpError(original_stack, OP_MOD, expected_error); | CheckOpError(original_stack, OP_MOD, expected_error); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||