From 3294abba11093e29bba17a657bcbb95637266e3b Mon Sep 17 00:00:00 2001 From: evoskuil Date: Thu, 16 May 2024 08:59:49 -0400 Subject: [PATCH] Add checkpoint sort tests. --- test/chain/checkpoint.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/chain/checkpoint.cpp b/test/chain/checkpoint.cpp index 7260ffd80f..1a8a31a69e 100644 --- a/test/chain/checkpoint.cpp +++ b/test/chain/checkpoint.cpp @@ -170,6 +170,28 @@ BOOST_AUTO_TEST_CASE(checkpoint__equality__different__expected) BOOST_REQUIRE(!(instance1 == instance2)); } +BOOST_AUTO_TEST_CASE(checkpoint__sort__non_empty__expected) +{ + checkpoints points + { + { "1111111111111111111111111111111111111111111111111111111111111111", 1000 }, + { "0000000000000000000000000000000000000000000000000000000000000000", 17 }, + { "0102030405060708090a0102030405060708090a0102030405060708090a0b0c", 42 } + }; + + const checkpoints expected + { + { "0000000000000000000000000000000000000000000000000000000000000000", 17 }, + { "0102030405060708090a0102030405060708090a0102030405060708090a0b0c", 42 }, + { "1111111111111111111111111111111111111111111111111111111111111111", 1000 } + }; + + BOOST_REQUIRE_EQUAL(system::sort_copy(points), expected); + + system::sort(points); + BOOST_REQUIRE_EQUAL(points, expected); +} + BOOST_AUTO_TEST_CASE(checkpoint__is_at__empty__false) { const checkpoints points{};