diff --git a/test/examples/dispatch/concat.json b/test/examples/dispatch/concat.json index 322a6d9e1..54b95dc69 100644 --- a/test/examples/dispatch/concat.json +++ b/test/examples/dispatch/concat.json @@ -248,7 +248,8 @@ "kind": "call", "output": { "returndata": "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000048111111111111111111111111111111111111111111111111111111111111111100000000000000003333333333333333333333333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000", - "status": "success" + "status": "success", + "gasUsed": "24265" } } ] diff --git a/test/examples/dispatch/deposit.json b/test/examples/dispatch/deposit.json index 137c5e2aa..6f6aeda47 100644 --- a/test/examples/dispatch/deposit.json +++ b/test/examples/dispatch/deposit.json @@ -141,7 +141,8 @@ "kind": "call", "output": { "returndata": "", - "status": "success" + "status": "success", + "gasUsed": "80087" } }, diff --git a/test/examples/dispatch/miniERC20.json b/test/examples/dispatch/miniERC20.json index 20c52b2ae..9905807ee 100644 --- a/test/examples/dispatch/miniERC20.json +++ b/test/examples/dispatch/miniERC20.json @@ -20,7 +20,8 @@ "kind": "call", "output": { "returndata": "0000000000000000000000000000000000000000000000000000000000000001", - "status": "success" + "status": "success", + "gasUsed": "53538" } }, { diff --git a/test/examples/dispatch/slices.json b/test/examples/dispatch/slices.json index 7eb707709..71befbdcb 100644 --- a/test/examples/dispatch/slices.json +++ b/test/examples/dispatch/slices.json @@ -416,7 +416,8 @@ "kind": "call", "output": { "returndata": "52775448d69df653edbf6877861761433014544bd8871f69c9aed6eed947b46f", - "status": "success" + "status": "success", + "gasUsed": "24584" } } ] diff --git a/test/testrunner/testrunner.cpp b/test/testrunner/testrunner.cpp index 5c2c8565b..01c0f64e9 100644 --- a/test/testrunner/testrunner.cpp +++ b/test/testrunner/testrunner.cpp @@ -196,6 +196,17 @@ int main(int argc, char** argv) continue; } } + if (test["output"].contains("gasUsed")) + { + auto expectedGasUsed = test["output"]["gasUsed"].get(); + if (u256(expectedGasUsed) != gasUsed) + { + reportFailure("Expected gasUsed " + expectedGasUsed + " but got " + gasUsed.str()); + resultRecorder.record(filename, "Expected different constructor gasUsed.", gasUsed.str(), expectedGasUsed, gasUsed, gasUsedForDeposit); + hasTestFailure = true; + continue; + } + } resultRecorder.record(filename, "Passed.", toHex(output), test["output"].value("returndata", std::string("")), gasUsed, gasUsedForDeposit); } else @@ -248,6 +259,17 @@ int main(int argc, char** argv) hasTestFailure = true; continue; } + if (test["output"].contains("gasUsed")) + { + auto expectedGasUsed = test["output"]["gasUsed"].get(); + if (u256(expectedGasUsed) != gasUsed) + { + reportFailure("Expected gasUsed " + expectedGasUsed + " but got " + gasUsed.str()); + resultRecorder.record(filename, "Expected different gasUsed.", gasUsed.str(), expectedGasUsed, gasUsed, gasUsedForDeposit); + hasTestFailure = true; + continue; + } + } resultRecorder.record(filename, "Passed.", toHex(output), expectedOutput, gasUsed, gasUsedForDeposit); } }