From 402349760f699fe512e9ba97328a5f8827f0c003 Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Sat, 29 Sep 2018 22:10:48 +0200 Subject: Merge pull request #4407 43a06350 ringdb: use cursors to be a bit faster (moneromooo-monero) --- tests/unit_tests/ringdb.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/unit_tests/ringdb.cpp') diff --git a/tests/unit_tests/ringdb.cpp b/tests/unit_tests/ringdb.cpp index 416ae0890..0d92049ac 100644 --- a/tests/unit_tests/ringdb.cpp +++ b/tests/unit_tests/ringdb.cpp @@ -150,6 +150,30 @@ TEST(blackball, found) ASSERT_TRUE(ringdb.blackballed(OUTPUT_1)); } +TEST(blackball, vector) +{ + RingDB ringdb; + std::vector> outputs; + outputs.push_back(std::make_pair(0, 1)); + outputs.push_back(std::make_pair(10, 3)); + outputs.push_back(std::make_pair(10, 4)); + outputs.push_back(std::make_pair(10, 8)); + outputs.push_back(std::make_pair(20, 0)); + outputs.push_back(std::make_pair(20, 1)); + outputs.push_back(std::make_pair(30, 5)); + ASSERT_TRUE(ringdb.blackball(outputs)); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(0, 1))); + ASSERT_FALSE(ringdb.blackballed(std::make_pair(10, 2))); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(10, 3))); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(10, 4))); + ASSERT_FALSE(ringdb.blackballed(std::make_pair(10, 5))); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(10, 8))); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(20, 0))); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(20, 1))); + ASSERT_FALSE(ringdb.blackballed(std::make_pair(20, 2))); + ASSERT_TRUE(ringdb.blackballed(std::make_pair(30, 5))); +} + TEST(blackball, unblackball) { RingDB ringdb; -- cgit v1.2.3