зеркало из https://github.com/microsoft/eEVM.git
Strict RLP decoding (#68)
This commit is contained in:
Родитель
12951f37d3
Коммит
73b090fe6b
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -20,11 +20,15 @@ const auto large_input_decoded = std::make_tuple(
|
|||
66000u),
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
|
||||
"tempor incididunt ut labore et dolore magna aliqua"s);
|
||||
const auto large_input_encoded = rlp::to_byte_string(
|
||||
|
||||
const std::string large_input_encoded_s =
|
||||
"\xf8\xa5\xda\x8bHello world\x8dSaluton "
|
||||
"Mondo\xcd\xc8\xc1\x01\xc2\x02\x03\xc2\xc1\x04\x83\x01\x01\xd0\xb8zLorem "
|
||||
"ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
|
||||
"tempor incididunt ut labore et dolore magna aliqua");
|
||||
"tempor incididunt ut labore et dolore magna aliqua";
|
||||
|
||||
const auto large_input_encoded = std::vector<uint8_t>(
|
||||
large_input_encoded_s.begin(), large_input_encoded_s.end());
|
||||
|
||||
TEST_CASE("encode" * doctest::test_suite("rlp"))
|
||||
{
|
||||
|
@ -83,6 +87,7 @@ TEST_CASE("decode" * doctest::test_suite("rlp"))
|
|||
CHECK(rlp::decode_single<size_t>(rlp::ByteString{0x1}) == 0x1);
|
||||
CHECK(rlp::decode_single<size_t>(rlp::ByteString{0x7f}) == 0x7f);
|
||||
CHECK(rlp::decode_single<size_t>(rlp::ByteString{0x81, 0x80}) == 0x80);
|
||||
CHECK_THROWS(rlp::decode_single<size_t>(rlp::ByteString{0x81, 0x80, 0x00}));
|
||||
|
||||
CHECK(rlp::decode<>(rlp::ByteString{0xc0}) == std::make_tuple());
|
||||
CHECK(rlp::decode<std::string>(rlp::ByteString{0x80}) == std::make_tuple(""));
|
||||
|
@ -123,6 +128,8 @@ TEST_CASE("decode" * doctest::test_suite("rlp"))
|
|||
rlp::decode<std::tuple<std::tuple<size_t>>>(
|
||||
rlp::ByteString{0xc2, 0xc1, 0x80}) ==
|
||||
std::make_tuple(std::make_tuple(std::make_tuple(0x0))));
|
||||
CHECK_THROWS(rlp::decode<std::tuple<std::tuple<size_t>>>(
|
||||
rlp::ByteString{0xc2, 0xc1, 0x80, 0x00}));
|
||||
|
||||
CHECK(
|
||||
rlp::decode_single<
|
||||
|
|
Загрузка…
Ссылка в новой задаче