LCOV - code coverage report
Current view: top level - src/test/fuzz - difference_formatter.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 13 13
Test Date: 2025-12-28 04:16:35 Functions: 100.0 % 2 2
Branches: 61.1 % 18 11

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2025-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 <blockencodings.h>
       6                 :             : #include <streams.h>
       7                 :             : #include <random.h>
       8                 :             : #include <test/fuzz/fuzz.h>
       9                 :             : 
      10                 :             : #include <vector>
      11                 :             : 
      12         [ +  - ]:         556 : FUZZ_TARGET(difference_formatter)
      13                 :             : {
      14                 :         104 :     const auto block_hash = InsecureRandomContext{{}}.rand256();
      15                 :         104 :     DataStream ss{};
      16   [ +  -  +  - ]:         104 :     ss << block_hash << std::span{buffer};
      17                 :             : 
      18                 :             :     // Test deserialization
      19                 :         104 :     try {
      20                 :         104 :         BlockTransactionsRequest test_container;
      21         [ +  + ]:         104 :         ss >> test_container;
      22         [ -  + ]:          17 :         assert(test_container.blockhash == block_hash);
      23                 :             : 
      24                 :             :         // Invariant: strictly monotonic increasing (no duplicates allowed)
      25   [ -  +  +  + ]:         807 :         for (size_t i = 1; i < test_container.indexes.size(); ++i) {
      26         [ -  + ]:         790 :             assert(test_container.indexes[i] > test_container.indexes[i-1]);
      27                 :             :         }
      28                 :             : 
      29         [ -  + ]:         104 :     } catch (const std::ios_base::failure&) {
      30                 :             :         // Expected for malformed input
      31                 :          87 :     }
      32                 :         104 : }
        

Generated by: LCOV version 2.0-1