aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-20 12:21:25 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-20 12:21:57 +0000
commit43a06350cf9a14d6a86bd08898bad15c19a0272d (patch)
treeffb696d5fecdfb9d62eefa9baeddfb0cf9b168ef /tests/unit_tests
parentMerge pull request #4391 (diff)
downloadmonero-43a06350cf9a14d6a86bd08898bad15c19a0272d.tar.xz
ringdb: use cursors to be a bit faster
Diffstat (limited to '')
-rw-r--r--tests/unit_tests/ringdb.cpp24
1 files changed, 24 insertions, 0 deletions
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<std::pair<uint64_t, uint64_t>> 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;