chromium/base/test/fuzztest_support.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_TEST_FUZZTEST_SUPPORT_H_
#define BASE_TEST_FUZZTEST_SUPPORT_H_

#include <optional>
#include <string>
#include <tuple>
#include <vector>

#include "base/containers/to_vector.h"
#include "base/types/optional_ref.h"
#include "base/values.h"
#include "third_party/fuzztest/src/fuzztest/fuzztest.h"

namespace {

template <typename T>
  requires std::copy_constructible<T>
std::optional<std::tuple<T>> Wrap(base::optional_ref<const T> maybe_value) {}

auto ArbitraryValueNull() {}

auto ArbitraryValueBool() {}

auto ArbitraryValueInt() {}

auto ArbitraryValueDouble() {}

auto ArbitraryValueString() {}

auto ArbitraryValueBlob() {}

auto ArbitraryValueList(fuzztest::Domain<base::Value> entry_domain) {}

auto ArbitraryValueDict(fuzztest::Domain<base::Value> value_domain) {}

fuzztest::Domain<base::Value> ArbitraryValue() {}

}  // namespace

template <>
class fuzztest::internal::ArbitraryImpl<base::Value>
    : public fuzztest::Domain<base::Value> {};

template <>
class fuzztest::internal::ArbitraryImpl<base::Value::Dict>
    : public fuzztest::internal::ReversibleMapImpl<
          base::Value::Dict (*)(
              std::vector<std::pair<std::string, base::Value>>),
          std::optional<
              std::tuple<std::vector<std::pair<std::string, base::Value>>>> (*)(
              const base::Value::Dict&),
          fuzztest::internal::ArbitraryImpl<
              std::vector<std::pair<std::string, base::Value>>>> {};

#endif  // BASE_TEST_FUZZTEST_SUPPORT_H_