Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

develroot / fuzzing / Progmasoft / fuzz_ProjectConfig.cpp

889 B · Raw · Log

// Copyright (c) 2026 Progmasoft.
// SPDX-License-Identifier: LGPL-3.0-or-later

// The text of a catch3.json. Reading it must give options or an error, never
// crash, and the worker arguments derived from the options must parse again.

#include <Progmasoft/Runner/Options.hpp>
#include <Progmasoft/Runner/ProjectConfig.hpp>

#include <cstdint>
#include <cstdlib>
#include <string_view>

extern "C" int
LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size)
{
    namespace Runner = Progmasoft::Catch3::Runner;
    const std::string_view text{reinterpret_cast<const char *>(data), size};
    auto options = Runner::ApplyProjectConfig(text, "project", "catch3.json");
    if (options)
    {
        const auto worker =
            Runner::ParseOptions(Runner::WorkerArguments(*options));
        if (!worker)
        {
            std::abort();
        }
    }
    return 0;
}