aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/integer.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-03-15 00:28:08 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2020-03-15 15:19:50 +0000
commitcb4eec13c03089617a94169b4e30381d87788b56 (patch)
treedec16dec75a7099b4a315e628f0ea7739cc97932 /src/test/fuzz/integer.cpp
parent67dfd18f4401986063e22c79d4d7da61f15b5cd4 (diff)
downloadbitcoin-cb4eec13c03089617a94169b4e30381d87788b56.tar.xz
tests: Add fuzzing harness for count_seconds(...)
Diffstat (limited to 'src/test/fuzz/integer.cpp')
-rw-r--r--src/test/fuzz/integer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp
index 980042e811..24459c21be 100644
--- a/src/test/fuzz/integer.cpp
+++ b/src/test/fuzz/integer.cpp
@@ -23,6 +23,7 @@
#include <streams.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
+#include <time.h>
#include <uint256.h>
#include <util/moneystr.h>
#include <util/strencodings.h>
@@ -31,6 +32,7 @@
#include <version.h>
#include <cassert>
+#include <chrono>
#include <limits>
#include <vector>
@@ -124,6 +126,8 @@ void test_one_input(const std::vector<uint8_t>& buffer)
assert(parsed_money == i64);
}
}
+ const std::chrono::seconds seconds{i64};
+ assert(count_seconds(seconds) == i64);
const arith_uint256 au256 = UintToArith256(u256);
assert(ArithToUint256(au256) == u256);