LCOV - code coverage report
Current view: top level - src/test/fuzz - spanparsing.cpp (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 2 19 10.5 %
Date: 2023-11-10 23:46:46 Functions: 1 3 33.3 %
Branches: 2 18 11.1 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2019-2020 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 <test/fuzz/FuzzedDataProvider.h>
       6                 :            : #include <test/fuzz/fuzz.h>
       7                 :            : #include <util/spanparsing.h>
       8                 :            : 
       9 [ +  - ][ +  - ]:          6 : FUZZ_TARGET(spanparsing)
      10                 :            : {
      11                 :          0 :     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      12                 :          0 :     const size_t query_size = fuzzed_data_provider.ConsumeIntegral<size_t>();
      13                 :          0 :     const std::string query = fuzzed_data_provider.ConsumeBytesAsString(std::min<size_t>(query_size, 1024 * 1024));
      14         [ #  # ]:          0 :     const std::string span_str = fuzzed_data_provider.ConsumeRemainingBytesAsString();
      15         [ #  # ]:          0 :     const Span<const char> const_span{span_str};
      16                 :            : 
      17                 :          0 :     Span<const char> mut_span = const_span;
      18         [ #  # ]:          0 :     (void)spanparsing::Const(query, mut_span);
      19                 :            : 
      20                 :          0 :     mut_span = const_span;
      21         [ #  # ]:          0 :     (void)spanparsing::Func(query, mut_span);
      22                 :            : 
      23                 :          0 :     mut_span = const_span;
      24         [ #  # ]:          0 :     (void)spanparsing::Expr(mut_span);
      25                 :          2 : 
      26         [ #  # ]:          0 :     if (!query.empty()) {
      27                 :          0 :         mut_span = const_span;
      28         [ #  # ]:          0 :         (void)spanparsing::Split(mut_span, query.front());
      29                 :          0 :     }
      30                 :          0 : }

Generated by: LCOV version 1.14