Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
yarkinwho committed Aug 22, 2024
1 parent 442f059 commit 8f6c7f5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/stack_limit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,22 @@ BOOST_FIXTURE_TEST_CASE(max_limit, stack_limit_tester) try {

int64_t level = 0;

// At least 1024
// At least 1024. It would cost too much time to test all values up to 1024. So we directly test 1024
call_test(1024, evm1, true);

// At least 11
call_test(11, evm1, false);
// At least 11. We will try every value until it fails just in case.
try {
for (level = 0; level < 256; ++level) {
call_test(level, evm1, false);
}
}
catch (...) {

}

// We check it will fail at exactly 12 so that the test can fail if we optimize the code to support more levels.
// In this way, the test can keep itself updated to guard against latest limits.
BOOST_REQUIRE_EQUAL(level, 12);

} FC_LOG_AND_RETHROW()

Expand Down

0 comments on commit 8f6c7f5

Please sign in to comment.