aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/json_serialization.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2024-08-13 12:15:57 -0400
committerluigi1111 <luigi1111w@gmail.com>2024-08-13 12:15:57 -0400
commitbedfa83ea02718b65b236cbb222496903a148b92 (patch)
tree6d8dd3fd7fa0f6695d897f29347e6c15d88eae60 /tests/unit_tests/json_serialization.cpp
parent76feeb64b7060f588739d1a267bcf8000be6f817 (diff)
parentc5ad937cc11d3181b7549db573ac37ec635be96e (diff)
downloadmonzero-core-bedfa83ea02718b65b236cbb222496903a148b92.tar.gz
monzero-core-bedfa83ea02718b65b236cbb222496903a148b92.tar.xz
monzero-core-bedfa83ea02718b65b236cbb222496903a148b92.zip
Merge pull request #9385
c5ad937 Fix ZMQ DaemonInfo: (Lee *!* Clagett)
Diffstat (limited to 'tests/unit_tests/json_serialization.cpp')
-rw-r--r--tests/unit_tests/json_serialization.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/unit_tests/json_serialization.cpp b/tests/unit_tests/json_serialization.cpp
index 9525d23ea..9ac019aec 100644
--- a/tests/unit_tests/json_serialization.cpp
+++ b/tests/unit_tests/json_serialization.cpp
@@ -124,6 +124,68 @@ TEST(JsonSerialization, InvalidVectorBytes)
EXPECT_THROW(cryptonote::json::fromJsonValue(doc, out), cryptonote::json::BAD_INPUT);
}
+TEST(JsonSerialization, DaemonInfo)
+{
+ cryptonote::rpc::DaemonInfo info{};
+ info.height = 154544;
+ info.target_height = 15345435;
+ info.top_block_height = 2344;
+ info.wide_difficulty = cryptonote::difficulty_type{"100000000000000000005443"};
+ info.difficulty = 200376420520695107;
+ info.target = 7657567;
+ info.tx_count = 355;
+ info.tx_pool_size = 45435;
+ info.alt_blocks_count = 43535;
+ info.outgoing_connections_count = 1444;
+ info.incoming_connections_count = 1444;
+ info.white_peerlist_size = 14550;
+ info.grey_peerlist_size = 34324;
+ info.mainnet = true;
+ info.testnet = true;
+ info.stagenet = true;
+ info.nettype = "main";
+ info.top_block_hash = crypto::hash{1};
+ info.wide_cumulative_difficulty = cryptonote::difficulty_type{"200000000000000000005543"};
+ info.cumulative_difficulty = 400752841041384871;
+ info.block_size_limit = 4324234;
+ info.block_weight_limit = 3434;
+ info.block_size_median = 3434;
+ info.adjusted_time = 4535;
+ info.block_weight_median = 43535;
+ info.start_time = 34535;
+ info.version = "1.0";
+
+ const auto info_copy = test_json(info);
+
+ EXPECT_EQ(info.height, info_copy.height);
+ EXPECT_EQ(info.target_height, info_copy.target_height);
+ EXPECT_EQ(info.top_block_height, info_copy.top_block_height);
+ EXPECT_EQ(info.wide_difficulty, info_copy.wide_difficulty);
+ EXPECT_EQ(info.difficulty, info_copy.difficulty);
+ EXPECT_EQ(info.target, info_copy.target);
+ EXPECT_EQ(info.tx_count, info_copy.tx_count);
+ EXPECT_EQ(info.tx_pool_size, info_copy.tx_pool_size);
+ EXPECT_EQ(info.alt_blocks_count, info_copy.alt_blocks_count);
+ EXPECT_EQ(info.outgoing_connections_count, info_copy.outgoing_connections_count);
+ EXPECT_EQ(info.incoming_connections_count, info_copy.incoming_connections_count);
+ EXPECT_EQ(info.white_peerlist_size, info_copy.white_peerlist_size);
+ EXPECT_EQ(info.grey_peerlist_size, info_copy.grey_peerlist_size);
+ EXPECT_EQ(info.mainnet, info_copy.mainnet);
+ EXPECT_EQ(info.testnet, info_copy.testnet);
+ EXPECT_EQ(info.stagenet, info_copy.stagenet);
+ EXPECT_EQ(info.nettype, info_copy.nettype);
+ EXPECT_EQ(info.top_block_hash, info_copy.top_block_hash);
+ EXPECT_EQ(info.wide_cumulative_difficulty, info_copy.wide_cumulative_difficulty);
+ EXPECT_EQ(info.cumulative_difficulty, info_copy.cumulative_difficulty);
+ EXPECT_EQ(info.block_size_limit, info_copy.block_size_limit);
+ EXPECT_EQ(info.block_weight_limit, info_copy.block_weight_limit);
+ EXPECT_EQ(info.block_size_median, info_copy.block_size_median);
+ EXPECT_EQ(info.adjusted_time, info_copy.adjusted_time);
+ EXPECT_EQ(info.block_weight_median, info_copy.block_weight_median);
+ EXPECT_EQ(info.start_time, info_copy.start_time);
+ EXPECT_EQ(info.version, info_copy.version);
+}
+
TEST(JsonSerialization, MinerTransaction)
{
cryptonote::account_base acct;