Skip to content

Commit

Permalink
Merge pull request #1449 from evoskuil/master
Browse files Browse the repository at this point in the history
Add checkpoint sort tests.
  • Loading branch information
evoskuil authored May 16, 2024
2 parents 2280aa3 + 3294abb commit 241a7ed
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/chain/checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{};
Expand Down

0 comments on commit 241a7ed

Please sign in to comment.