Skip to content

Commit 68b0744

Browse files
committed
Update partial utreexo implementation in test build.
1 parent 4f88259 commit 68b0744

2 files changed

Lines changed: 187 additions & 196 deletions

File tree

test/utreexo/utreexo.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,30 @@ BOOST_AUTO_TEST_CASE(utreexo__detwin__various__expected)
309309
// 0 1 2 3 4 5 6 7
310310

311311
const positions expected1{ 7, 8, 10 };
312-
positions targets1{ 0, 1, 4, 5, 7 };
313-
detwin(targets1, 3);
314-
BOOST_REQUIRE_EQUAL(targets1, expected1);
312+
const positions targets1{ 0, 1, 4, 5, 7 };
313+
BOOST_REQUIRE_EQUAL(detwin(targets1, 3), expected1);
315314

316315
const positions expected2{ 4, 6, 12 };
317-
positions targets2{ 4, 6, 8, 9 };
318-
detwin(targets2, 3);
319-
BOOST_REQUIRE_EQUAL(targets2, expected2);
316+
const positions targets2{ 4, 6, 8, 9 };
317+
BOOST_REQUIRE_EQUAL(detwin(targets2, 3), expected2);
318+
}
319+
320+
BOOST_AUTO_TEST_CASE(utreexo__get_proof_positions__sorted__expected)
321+
{
322+
const positions expected{ 6, 9 };
323+
constexpr uint64_t leaves = 8;
324+
constexpr auto rows = tree_rows(leaves);
325+
const auto targets = get_proof_positions({ 4, 5, 7, 8 }, leaves, rows);
326+
BOOST_REQUIRE_EQUAL(targets, expected);
327+
}
328+
329+
BOOST_AUTO_TEST_CASE(utreexo__get_proof_positions__unsorted__expected)
330+
{
331+
const positions expected{ 6, 9 };
332+
constexpr uint64_t leaves = 8;
333+
constexpr auto rows = tree_rows(leaves);
334+
const auto targets = get_proof_positions({ 4, 8, 7, 5 }, leaves, rows);
335+
BOOST_REQUIRE_EQUAL(targets, expected);
320336
}
321337

322338
// rustreexo examples

0 commit comments

Comments
 (0)