aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-04-08 14:28:47 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2020-04-08 14:45:27 +0000
commit283bd72156959f420f13acc7a34e513ca3446025 (patch)
treef249296daf08fe7e2cbae4f24538be433195cad9 /src/test
parentbf76000493082da05bf7258a5038e16fa76cd143 (diff)
tests: Add coverage of {,Incremental}DynamicUsage(const std::set<X, Y>& s) to existing fuzzer
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/integer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp
index f3259f6598..7c2537aaf5 100644
--- a/src/test/fuzz/integer.cpp
+++ b/src/test/fuzz/integer.cpp
@@ -36,6 +36,7 @@
#include <cassert>
#include <chrono>
#include <limits>
+#include <set>
#include <vector>
void initialize()
@@ -114,6 +115,12 @@ void test_one_input(const std::vector<uint8_t>& buffer)
(void)memusage::DynamicUsage(u8);
const unsigned char uch = static_cast<unsigned char>(u8);
(void)memusage::DynamicUsage(uch);
+ {
+ const std::set<int64_t> i64s{i64, static_cast<int64_t>(u64)};
+ const size_t dynamic_usage = memusage::DynamicUsage(i64s);
+ const size_t incremental_dynamic_usage = memusage::IncrementalDynamicUsage(i64s);
+ assert(dynamic_usage == incremental_dynamic_usage * i64s.size());
+ }
(void)MillisToTimeval(i64);
const double d = ser_uint64_to_double(u64);
assert(ser_double_to_uint64(d) == u64);