LCOV - code coverage report
Current view: top level - src/test/fuzz - timeoffsets.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 12 12
Test Date: 2024-12-04 04:00:22 Functions: 100.0 % 3 3
Branches: 60.0 % 20 12

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2024-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 <node/timeoffsets.h>
       6                 :             : #include <node/warnings.h>
       7                 :             : #include <test/fuzz/FuzzedDataProvider.h>
       8                 :             : #include <test/fuzz/fuzz.h>
       9                 :             : #include <test/util/setup_common.h>
      10                 :             : 
      11                 :             : #include <chrono>
      12                 :             : #include <cstdint>
      13                 :             : #include <functional>
      14                 :             : 
      15                 :           1 : void initialize_timeoffsets()
      16                 :             : {
      17   [ +  -  +  - ]:           2 :     static const auto testing_setup = MakeNoLogFileContext<>(ChainType::MAIN);
      18         [ +  - ]:           2 : }
      19                 :             : 
      20         [ +  - ]:         613 : FUZZ_TARGET(timeoffsets, .init = initialize_timeoffsets)
      21                 :             : {
      22                 :         201 :     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      23                 :         201 :     node::Warnings warnings{};
      24         [ +  - ]:         201 :     TimeOffsets offsets{warnings};
      25   [ +  +  +  + ]:       69423 :     LIMITED_WHILE(fuzzed_data_provider.remaining_bytes() > 0, 4'000) {
      26         [ +  - ]:       69222 :         (void)offsets.Median();
      27         [ +  - ]:       69222 :         offsets.Add(std::chrono::seconds{fuzzed_data_provider.ConsumeIntegral<std::chrono::seconds::rep>()});
      28         [ +  - ]:       69222 :         offsets.WarnIfOutOfSync();
      29                 :             :     }
      30                 :         201 : }
        

Generated by: LCOV version 2.0-1