LCOV - code coverage report
Current view: top level - src/test/fuzz - parse_iso8601.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 10 10
Test Date: 2025-01-22 04:09:46 Functions: 100.0 % 2 2
Branches: 50.0 % 12 6

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2019-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 <test/fuzz/FuzzedDataProvider.h>
       6                 :             : #include <test/fuzz/fuzz.h>
       7                 :             : #include <util/time.h>
       8                 :             : 
       9                 :             : #include <cassert>
      10                 :             : #include <cstdint>
      11                 :             : #include <string>
      12                 :             : #include <vector>
      13                 :             : 
      14         [ +  - ]:         529 : FUZZ_TARGET(parse_iso8601)
      15                 :             : {
      16                 :         115 :     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      17                 :             : 
      18                 :         115 :     const int64_t random_time = fuzzed_data_provider.ConsumeIntegral<int32_t>();
      19                 :         115 :     const std::string random_string = fuzzed_data_provider.ConsumeRemainingBytesAsString();
      20                 :             : 
      21         [ +  - ]:         115 :     const std::string iso8601_datetime = FormatISO8601DateTime(random_time);
      22         [ +  - ]:         115 :     (void)FormatISO8601Date(random_time);
      23         [ +  - ]:         115 :     const int64_t parsed_time_1{ParseISO8601DateTime(iso8601_datetime).value()};
      24         [ -  + ]:         115 :     assert(parsed_time_1 == random_time);
      25                 :             : 
      26         [ +  - ]:         115 :     (void)ParseISO8601DateTime(random_string);
      27                 :         115 : }
        

Generated by: LCOV version 2.0-1