aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-07-29 12:00:18 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2022-04-10 18:13:31 +0000
commit9f786f0550b6d267aabf79364b802f0fadc9629d (patch)
treeee5de1aa54fbee40cb47b375400e34e789e9b982 /tests
parentMerge pull request #8242 (diff)
downloadmonero-9f786f0550b6d267aabf79364b802f0fadc9629d.tar.xz
epee: allow copying a rolling_median_t object
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/rolling_median.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit_tests/rolling_median.cpp b/tests/unit_tests/rolling_median.cpp
index 4d99bbb0d..07da0f0ef 100644
--- a/tests/unit_tests/rolling_median.cpp
+++ b/tests/unit_tests/rolling_median.cpp
@@ -211,3 +211,21 @@ TEST(rolling_median, size)
ASSERT_EQ(m.size(), std::min<int>(10, i + 2));
}
}
+
+TEST(rolling_median, copy)
+{
+ epee::misc_utils::rolling_median_t<uint64_t> m(100);
+
+ for (int i = 0; i < 100; ++i)
+ m.insert(rand());
+
+ epee::misc_utils::rolling_median_t<uint64_t> copy(m);
+
+ for (int i = 0; i < 5000; ++i)
+ {
+ uint64_t v = rand();
+ m.insert(v);
+ copy.insert(v);
+ ASSERT_EQ(m.median(), copy.median());
+ }
+}