Skip to content

Commit cb4eec1

Browse files
tests: Add fuzzing harness for count_seconds(...)
1 parent 67dfd18 commit cb4eec1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/test/fuzz/integer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <streams.h>
2424
#include <test/fuzz/FuzzedDataProvider.h>
2525
#include <test/fuzz/fuzz.h>
26+
#include <time.h>
2627
#include <uint256.h>
2728
#include <util/moneystr.h>
2829
#include <util/strencodings.h>
@@ -31,6 +32,7 @@
3132
#include <version.h>
3233

3334
#include <cassert>
35+
#include <chrono>
3436
#include <limits>
3537
#include <vector>
3638

@@ -124,6 +126,8 @@ void test_one_input(const std::vector<uint8_t>& buffer)
124126
assert(parsed_money == i64);
125127
}
126128
}
129+
const std::chrono::seconds seconds{i64};
130+
assert(count_seconds(seconds) == i64);
127131

128132
const arith_uint256 au256 = UintToArith256(u256);
129133
assert(ArithToUint256(au256) == u256);

0 commit comments

Comments
 (0)