7
7
#include < gtest/gtest.h>
8
8
#include < test/utils/bytecode.hpp>
9
9
#include < test/utils/utils.hpp>
10
- #include < format>
11
10
12
11
using namespace std ;
13
12
using namespace evmone ;
@@ -316,7 +315,7 @@ TEST(eof_validation, EOF1_too_many_code_sections)
316
315
std::string code_sections_1024;
317
316
for (int i = 0 ; i < 1024 ; ++i)
318
317
if (i < 1023 )
319
- code_sections_1024 += " E5" + std::format ( " {:04X} " , i + 1 );
318
+ code_sections_1024 += " E5" + hex ( big_endian ( static_cast < uint16_t >( i + 1 )) );
320
319
else
321
320
code_sections_1024 += " 5B5B00" ;
322
321
@@ -867,7 +866,7 @@ TEST(eof_validation, many_code_sections_1023)
867
866
std::string code_sections_1023;
868
867
for (auto i = 0 ; i < 1023 ; ++i)
869
868
if (i < 1022 )
870
- code_sections_1023 += " E5" + std::format ( " {:04X} " , i + 1 );
869
+ code_sections_1023 += " E5" + hex ( big_endian ( static_cast < uint16_t >( i + 1 )) );
871
870
else
872
871
code_sections_1023 += " 5B5B00" ;
873
872
@@ -882,7 +881,7 @@ TEST(eof_validation, many_code_sections_1024)
882
881
std::string code_sections_1024;
883
882
for (auto i = 0 ; i < 1024 ; ++i)
884
883
if (i < 1023 )
885
- code_sections_1024 += " E5" + std::format ( " {:04X} " , i + 1 );
884
+ code_sections_1024 += " E5" + hex ( big_endian ( static_cast < uint16_t >( i + 1 )) );
886
885
else
887
886
code_sections_1024 += " 5B5B00" ;
888
887
@@ -1251,18 +1250,22 @@ TEST(eof_validation, unreachable_code_sections)
1251
1250
if (i < 255 )
1252
1251
if (i == 1 )
1253
1252
{
1254
- code_sections_256_err_001 += " E5" + std::format (" {:04X}" , i);
1255
- code_sections_256_err_254 += " E5" + std::format (" {:04X}" , i + 1 );
1253
+ code_sections_256_err_001 += " E5" + hex (big_endian (static_cast <uint16_t >(i)));
1254
+ code_sections_256_err_254 +=
1255
+ " E5" + hex (big_endian (static_cast <uint16_t >(i + 1 )));
1256
1256
}
1257
1257
else if (i == 254 )
1258
1258
{
1259
- code_sections_256_err_001 += " E5" + std::format (" {:04X}" , i + 1 );
1260
- code_sections_256_err_254 += " E5" + std::format (" {:04X}" , i);
1259
+ code_sections_256_err_001 +=
1260
+ " E5" + hex (big_endian (static_cast <uint16_t >(i + 1 )));
1261
+ code_sections_256_err_254 += " E5" + hex (big_endian (static_cast <uint16_t >(i)));
1261
1262
}
1262
1263
else
1263
1264
{
1264
- code_sections_256_err_001 += " E5" + std::format (" {:04X}" , i + 1 );
1265
- code_sections_256_err_254 += " E5" + std::format (" {:04X}" , i + 1 );
1265
+ code_sections_256_err_001 +=
1266
+ " E5" + hex (big_endian (static_cast <uint16_t >(i + 1 )));
1267
+ code_sections_256_err_254 +=
1268
+ " E5" + hex (big_endian (static_cast <uint16_t >(i + 1 )));
1266
1269
}
1267
1270
else
1268
1271
{
0 commit comments