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_RunnerJson.cpp
// Copyright (c) 2026 Progmasoft.
// SPDX-License-Identifier: LGPL-3.0-or-later
// The runner reads JSON from its workers, from history files and from
// reports; none of them may crash it. A document that parses must also
// print and parse back to the same text.
#include <Progmasoft/Runner/Json.hpp>
#include <cstdint>
#include <cstdlib>
#include <string_view>
extern "C" int
LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size)
{
const std::string_view text{reinterpret_cast<const char *>(data), size};
auto parsed = Progmasoft::Catch3::Runner::ParseJson(text);
if (parsed)
{
const auto printed = parsed->ToString();
auto again = Progmasoft::Catch3::Runner::ParseJson(printed);
if (!again || again->ToString() != printed)
{
std::abort();
}
}
return 0;
}