diff options
author | Lee Clagett <code@leeclagett.com> | 2020-05-31 01:22:33 -0400 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2020-08-14 23:01:00 +0000 |
commit | 4e2377995d286eb01456ed1dfd29cd278282ec19 (patch) | |
tree | c722a778b7c07d71008d35ce6d5907f92a7de25e /tests/unit_tests/json_serialization.cpp | |
parent | Merge pull request #6582 (diff) | |
download | monero-4e2377995d286eb01456ed1dfd29cd278282ec19.tar.xz |
Change ZMQ-JSON txextra to hex and remove unnecessary base fields
Diffstat (limited to '')
-rw-r--r-- | tests/unit_tests/json_serialization.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/unit_tests/json_serialization.cpp b/tests/unit_tests/json_serialization.cpp index 5873d0ab6..c899f9be6 100644 --- a/tests/unit_tests/json_serialization.cpp +++ b/tests/unit_tests/json_serialization.cpp @@ -94,7 +94,7 @@ namespace rapidjson::Document doc; doc.Parse(reinterpret_cast<const char*>(buffer.data()), buffer.size()); - if (doc.HasParseError() || !doc.IsObject()) + if (doc.HasParseError()) { throw cryptonote::json::PARSE_FAIL(); } @@ -105,6 +105,21 @@ namespace } } // anonymous +TEST(JsonSerialization, VectorBytes) +{ + EXPECT_EQ(std::vector<std::uint8_t>{}, test_json(std::vector<std::uint8_t>{})); + EXPECT_EQ(std::vector<std::uint8_t>{0x00}, test_json(std::vector<std::uint8_t>{0x00})); +} + +TEST(JsonSerialization, InvalidVectorBytes) +{ + rapidjson::Document doc; + doc.SetString("1"); + + std::vector<std::uint8_t> out; + EXPECT_THROW(cryptonote::json::fromJsonValue(doc, out), cryptonote::json::BAD_INPUT); +} + TEST(JsonSerialization, MinerTransaction) { cryptonote::account_base acct; |