diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bdda42d..8eb44f7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -148,3 +148,4 @@ target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${U add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/crypto_tests.txt" $) add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/mainnet_test2_block.dat" $) add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/sidechain_dump.dat" $) +add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/sidechain_dump_mini.dat" $) diff --git a/tests/src/pool_block_tests.cpp b/tests/src/pool_block_tests.cpp index 39a4f4d..78b9d8e 100644 --- a/tests/src/pool_block_tests.cpp +++ b/tests/src/pool_block_tests.cpp @@ -103,11 +103,24 @@ TEST(pool_block, deserialize) TEST(pool_block, verify) { init_crypto_cache(); + + struct STest + { + const char* m_poolName; + const char* m_fileName; + uint64_t m_txinGenHeight; + uint64_t m_sidechainHeight; + } tests[2] = { + { "default", "sidechain_dump.dat", 2483901, 522805 }, + { "mini", "sidechain_dump_mini.dat", 2696040, 2424349 }, + }; + + for (const STest& t : tests) { PoolBlock b; - SideChain sidechain(nullptr, NetworkType::Mainnet); + SideChain sidechain(nullptr, NetworkType::Mainnet, t.m_poolName); - std::ifstream f("sidechain_dump.dat", std::ios::binary | std::ios::ate); + std::ifstream f(t.m_fileName, std::ios::binary | std::ios::ate); ASSERT_EQ(f.good() && f.is_open(), true); std::vector buf(f.tellg()); @@ -133,9 +146,10 @@ TEST(pool_block, verify) ASSERT_TRUE(tip->m_verified); ASSERT_FALSE(tip->m_invalid); - ASSERT_EQ(tip->m_txinGenHeight, 2483901); - ASSERT_EQ(tip->m_sidechainHeight, 522805); + ASSERT_EQ(tip->m_txinGenHeight, t.m_txinGenHeight); + ASSERT_EQ(tip->m_sidechainHeight, t.m_sidechainHeight); } + destroy_crypto_cache(); } diff --git a/tests/src/sidechain_dump_mini.dat b/tests/src/sidechain_dump_mini.dat new file mode 100644 index 0000000..1df5adf Binary files /dev/null and b/tests/src/sidechain_dump_mini.dat differ