LCOV - code coverage report
Current view: top level - src/test/fuzz - rolling_bloom_filter.cpp (source / functions) Coverage Total Hit
Test: total_coverage.info Lines: 0.0 % 24 0
Test Date: 2024-08-28 05:13:07 Functions: 0.0 % 4 0
Branches: 0.0 % 18 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2020-2021 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 <common/bloom.h>
       6                 :             : #include <test/fuzz/FuzzedDataProvider.h>
       7                 :             : #include <test/fuzz/fuzz.h>
       8                 :             : #include <test/fuzz/util.h>
       9                 :             : #include <uint256.h>
      10                 :             : 
      11                 :             : #include <cassert>
      12                 :             : #include <cstdint>
      13                 :             : #include <optional>
      14                 :             : #include <string>
      15                 :             : #include <vector>
      16                 :             : 
      17         [ #  # ]:           0 : FUZZ_TARGET(rolling_bloom_filter)
      18                 :             : {
      19                 :           0 :     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      20                 :             : 
      21                 :           0 :     CRollingBloomFilter rolling_bloom_filter{
      22                 :             :         fuzzed_data_provider.ConsumeIntegralInRange<unsigned int>(1, 1000),
      23                 :           0 :         0.999 / fuzzed_data_provider.ConsumeIntegralInRange<unsigned int>(1, std::numeric_limits<unsigned int>::max())};
      24   [ #  #  #  # ]:           0 :     LIMITED_WHILE(fuzzed_data_provider.remaining_bytes() > 0, 3000)
      25                 :             :     {
      26         [ #  # ]:           0 :         CallOneOf(
      27                 :             :             fuzzed_data_provider,
      28                 :           0 :             [&] {
      29                 :           0 :                 const std::vector<unsigned char> b = ConsumeRandomLengthByteVector(fuzzed_data_provider);
      30         [ #  # ]:           0 :                 (void)rolling_bloom_filter.contains(b);
      31         [ #  # ]:           0 :                 rolling_bloom_filter.insert(b);
      32         [ #  # ]:           0 :                 const bool present = rolling_bloom_filter.contains(b);
      33         [ #  # ]:           0 :                 assert(present);
      34                 :           0 :             },
      35                 :           0 :             [&] {
      36                 :           0 :                 const uint256 u256{ConsumeUInt256(fuzzed_data_provider)};
      37                 :           0 :                 (void)rolling_bloom_filter.contains(u256);
      38                 :           0 :                 rolling_bloom_filter.insert(u256);
      39                 :           0 :                 const bool present = rolling_bloom_filter.contains(u256);
      40         [ #  # ]:           0 :                 assert(present);
      41                 :           0 :             },
      42                 :           0 :             [&] {
      43                 :           0 :                 rolling_bloom_filter.reset();
      44                 :           0 :             });
      45                 :             :     }
      46                 :           0 : }
        

Generated by: LCOV version 2.0-1