#ifndef FUZZTEST_FUZZTEST_INTERNAL_DOMAINS_CONTAINER_MUTATION_HELPERS_H_
#define FUZZTEST_FUZZTEST_INTERNAL_DOMAINS_CONTAINER_MUTATION_HELPERS_H_
#include <algorithm>
#include <cstddef>
#include <iterator>
#include <optional>
#include "absl/random/bit_gen_ref.h"
#include "absl/random/distributions.h"
#include "./fuzztest/internal/coverage.h"
#include "./fuzztest/internal/table_of_recent_compares.h"
namespace fuzztest::internal {
template <bool is_self, typename ContainerT>
bool CopyPart(const ContainerT& from, ContainerT& to,
size_t from_segment_start_offset, size_t from_segment_size,
size_t to_segment_start_offset, size_t max_size) { … }
template <bool is_self, typename ContainerT>
bool InsertPart(const ContainerT& from, ContainerT& to,
size_t from_segment_start_offset, size_t from_segment_size,
size_t to_segment_start_offset, size_t max_size) { … }
inline size_t GetOrGuessPositionHint(std::optional<size_t> position_hint,
size_t max, absl::BitGenRef prng) { … }
template <bool is_self, typename ContainerT>
bool CopyFromDictionaryEntry(const DictionaryEntry<ContainerT>& dict_entry,
absl::BitGenRef prng, ContainerT& val,
size_t max_size) { … }
template <bool is_self, typename ContainerT>
bool CopyFromDictionaryEntry(
const DictionaryEntry<ContainerT>& dict_entry, absl::BitGenRef prng,
ContainerT& val, size_t max_size,
std::optional<DictionaryEntry<ContainerT>>& permanent_dict_candidate) { … }
template <bool is_self, typename ContainerT>
bool InsertFromDictionaryEntry(const DictionaryEntry<ContainerT>& dict_entry,
absl::BitGenRef prng, ContainerT& val,
size_t max_size) { … }
template <bool is_self, typename ContainerT>
bool InsertFromDictionaryEntry(
const DictionaryEntry<ContainerT>& dict_entry, absl::BitGenRef prng,
ContainerT& val, size_t max_size,
std::optional<DictionaryEntry<ContainerT>>& permanent_dict_candidate) { … }
template <typename ContainerT>
bool ApplyDictionaryMutationAndSavePermanentCandidate(
ContainerT& val, const DictionaryEntry<ContainerT>& entry,
absl::BitGenRef prng,
std::optional<DictionaryEntry<ContainerT>>& permanent_dict_candidate,
size_t max_size) { … }
template <typename ContainerT>
bool MemoryDictionaryMutation(
ContainerT& val, absl::BitGenRef prng,
ContainerDictionary<ContainerT>& temporary_dict,
ContainerDictionary<ContainerT>& manual_dict,
ContainerDictionary<ContainerT>& permanent_dict,
std::optional<DictionaryEntry<ContainerT>>& permanent_dict_candidate,
size_t max_size) { … }
template <typename ContainerT>
void EraseRandomChunk(ContainerT& val, absl::BitGenRef prng, size_t min_size) { … }
template <typename ContainerT, typename T>
void InsertRandomChunk(ContainerT& val, absl::BitGenRef prng, size_t max_size,
T new_element_val) { … }
}
#endif