diff --git a/test/unittests/eof_test.cpp b/test/unittests/eof_test.cpp index 673364318e..4451ce68b0 100644 --- a/test/unittests/eof_test.cpp +++ b/test/unittests/eof_test.cpp @@ -30,24 +30,27 @@ TEST(eof, read_valid_eof1_header) { std::string code; uint16_t types_size; - uint16_t code_size; + std::vector code_sizes; uint16_t data_size; }; - const TestCase test_cases[] = { - {"EF00 01 010004 0200010001 030000 00 00000000 00", 4, 1, 0}, - {"EF00 01 010004 0200010006 030000 00 00000400 600160005500", 4, 6, 0}, - {"EF00 01 010004 0200010001 030001 00 00000000 00 00 AA", 4, 1, 1}, - {"EF00 01 010004 0200010006 030004 00 00000000 600160005500 AABBCCDD", 4, 6, 4}, - {"EF00 01 010004 0200010100 031000 00 00000000" + std::string(256, '0') + - std::string(4096, 'F'), - 4, 256, 4096}, - }; + std::string nops_255; + for (int i = 0; i < 255; ++i) + nops_255 += "5B"; + + const TestCase test_cases[] = {{"EF00 01 010004 0200010001 030000 00 00000000 00", 4, {1}, 0}, + {"EF00 01 010004 0200010006 030000 00 00000002 600160005500", 4, {6}, 0}, + {"EF00 01 010004 0200010001 030001 00 00000000 00 AA", 4, {1}, 1}, + {"EF00 01 010004 0200010006 030004 00 00000002 600160005500 AABBCCDD", 4, {6}, 4}, + {"EF00 01 010004 0200010100 031000 00 00000000" + nops_255 + "00" + std::string(8192, 'F'), + 4, {256}, 4096}}; for (const auto& test_case : test_cases) { const auto code = from_spaced_hex(test_case.code).value(); + EXPECT_EQ(validate_eof(EVMC_CANCUN, code), EOFValidationError::success) << test_case.code; + const auto header = read_valid_eof1_header(code); - EXPECT_EQ(header.code_sizes[0], test_case.code_size) << test_case.code; + EXPECT_EQ(header.code_sizes, test_case.code_sizes) << test_case.code; EXPECT_EQ(header.data_size, test_case.data_size) << test_case.code; EXPECT_EQ(header.types.size() * 4, test_case.types_size) << test_case.code; }