26 return fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(std::numeric_limits<int64_t>::min(), std::numeric_limits<int32_t>::max());
32 static const auto testing_setup = MakeNoLogFileContext<>();
48 const bool start_with_corrupted_banlist{fuzzed_data_provider.ConsumeBool()};
49 bool force_read_and_write_to_err{
false};
50 if (start_with_corrupted_banlist) {
52 fuzzed_data_provider.ConsumeRandomLengthString()));
54 force_read_and_write_to_err = fuzzed_data_provider.ConsumeBool();
55 if (force_read_and_write_to_err) {
56 banlist_file =
fs::path{
"path"} /
"to" /
"inaccessible" /
"fuzzed_banlist";
61 BanMan ban_man{banlist_file,
nullptr, ConsumeBanTimeOffset(fuzzed_data_provider)};
71 ConsumeBanTimeOffset(fuzzed_data_provider), fuzzed_data_provider.ConsumeBool());
75 ConsumeBanTimeOffset(fuzzed_data_provider), fuzzed_data_provider.ConsumeBool());
78 ban_man.ClearBanned();
94 ban_man.GetBanned(banmap);
97 ban_man.DumpBanlist();
103 if (!force_read_and_write_to_err) {
104 ban_man.DumpBanlist();
107 ban_man.GetBanned(banmap);
108 BanMan ban_man_read{banlist_file,
nullptr, 0};
110 ban_man_read.GetBanned(banmap_read);
111 assert(banmap == banmap_read);
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
static std::string PathToString(const path &path)
Convert path object to byte string.
std::map< CSubNet, CBanEntry > banmap_t
bool WriteBinaryFile(const fs::path &filename, const std::string &data)
Write contents of std::string to a file.
FUZZ_TARGET_INIT(banman, initialize_banman)
static bool operator==(const CBanEntry &lhs, const CBanEntry &rhs)
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
CNetAddr ConsumeNetAddr(FuzzedDataProvider &fuzzed_data_provider) noexcept
CSubNet ConsumeSubNet(FuzzedDataProvider &fuzzed_data_provider) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.