LCOV - code coverage report
Current view: top level - src/test/fuzz - script_format.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 76.9 % 13 10
Test Date: 2024-09-01 05:20:30 Functions: 66.7 % 3 2
Branches: 54.5 % 22 12

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2019-2022 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 <chainparams.h>
       6                 :             : #include <consensus/consensus.h>
       7                 :             : #include <core_io.h>
       8                 :             : #include <policy/policy.h>
       9                 :             : #include <script/script.h>
      10                 :             : #include <test/fuzz/FuzzedDataProvider.h>
      11                 :             : #include <test/fuzz/fuzz.h>
      12                 :             : #include <test/fuzz/util.h>
      13                 :             : #include <univalue.h>
      14                 :             : #include <util/chaintype.h>
      15                 :             : 
      16                 :           0 : void initialize_script_format()
      17                 :             : {
      18                 :           0 :     SelectParams(ChainType::REGTEST);
      19                 :           0 : }
      20                 :             : 
      21         [ +  - ]:        1534 : FUZZ_TARGET(script_format, .init = initialize_script_format)
      22                 :             : {
      23                 :        1532 :     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      24                 :        1532 :     const CScript script{ConsumeScript(fuzzed_data_provider)};
      25   [ +  -  +  + ]:        1532 :     if (script.size() > MAX_STANDARD_TX_WEIGHT / WITNESS_SCALE_FACTOR) {
      26                 :          27 :         return;
      27                 :             :     }
      28                 :             : 
      29         [ +  - ]:        1505 :     (void)FormatScript(script);
      30   [ +  -  +  - ]:        1505 :     (void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());
      31                 :             : 
      32         [ +  - ]:        1505 :     UniValue o1(UniValue::VOBJ);
      33   [ +  -  +  -  :        1505 :     ScriptToUniv(script, /*out=*/o1, /*include_hex=*/fuzzed_data_provider.ConsumeBool(), /*include_address=*/fuzzed_data_provider.ConsumeBool());
                   +  - ]
      34         [ -  + ]:        1532 : }
        

Generated by: LCOV version 2.0-1