epee: allow copying a rolling_median_t object

This commit is contained in:
moneromooo-monero 2021-07-29 12:00:18 +00:00
parent f49fc9b487
commit 9f786f0550
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 32 additions and 1 deletions

View file

@ -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());
}
}