Branch data Line data Source code
1 : : // Copyright (c) 2020-present The Bitcoin Core developers
2 : : // Distributed under the MIT software license, see the accompanying
3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 : :
5 : : #include <flatfile.h>
6 : :
7 : : #include <test/fuzz/FuzzedDataProvider.h>
8 : : #include <test/fuzz/fuzz.h>
9 : : #include <test/fuzz/util.h>
10 : : #include <util/check.h>
11 : :
12 : : #include <cstdint>
13 : : #include <optional>
14 : : #include <string>
15 : : #include <vector>
16 : :
17 [ + - ]: 516 : FUZZ_TARGET(flatfile)
18 : : {
19 : 40 : FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
20 : 40 : std::optional<FlatFilePos> flat_file_pos = ConsumeDeserializable<FlatFilePos>(fuzzed_data_provider);
21 [ + + ]: 40 : if (!flat_file_pos) {
22 : : return;
23 : : }
24 : 28 : std::optional<FlatFilePos> another_flat_file_pos = ConsumeDeserializable<FlatFilePos>(fuzzed_data_provider);
25 [ + + ]: 28 : if (another_flat_file_pos) {
26 [ + + + + : 21 : assert((*flat_file_pos == *another_flat_file_pos) != (*flat_file_pos != *another_flat_file_pos));
- + ]
27 : : }
28 : 28 : (void)flat_file_pos->ToString();
29 : : }
|