MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ConsumeRandomLengthStringVector

Function ConsumeRandomLengthStringVector

src/test/fuzz/util.h:79–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79[[nodiscard]] inline std::vector<std::string> ConsumeRandomLengthStringVector(FuzzedDataProvider& fuzzed_data_provider, const size_t max_vector_size = 16, const size_t max_string_length = 16) noexcept
80{
81 const size_t n_elements = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, max_vector_size);
82 std::vector<std::string> r;
83 r.reserve(n_elements);
84 for (size_t i = 0; i < n_elements; ++i) {
85 r.push_back(fuzzed_data_provider.ConsumeRandomLengthString(max_string_length));
86 }
87 return r;
88}
89
90template <typename T>
91[[nodiscard]] inline std::vector<T> ConsumeRandomLengthIntegralVector(FuzzedDataProvider& fuzzed_data_provider, const size_t max_vector_size = 16) noexcept

Callers 4

torcontrol.cppFile · 0.85
script.cppFile · 0.85
FUZZ_TARGETFunction · 0.85
system.cppFile · 0.85

Calls 3

reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected