19 #include "src/libfuzzer/libfuzzer_macro.h"
20 #include "test/core/gprpp/chunked_vector_fuzzer.pb.h"
37 std::vector<IntHdl>
std;
43 auto it_std =
std.cbegin();
44 while (it_std !=
std.cend()) {
58 void Act(
const chunked_vector_fuzzer::Action&
action) {
59 switch (
action.action_type_case()) {
60 case chunked_vector_fuzzer::Action::kEmplaceBack: {
64 c->chunked.EmplaceBack(
65 std::make_shared<int>(
action.emplace_back().value()));
67 std::make_shared<int>(
action.emplace_back().value()));
70 case chunked_vector_fuzzer::Action::kPopBack: {
74 if (!c->chunked.empty()) {
80 case chunked_vector_fuzzer::Action::kCopy: {
91 it_to =
vectors_.emplace(
action.copy().to(), it_from->second).first;
93 it_to->second = it_from->second;
95 it_from->second.AssertOk();
96 it_to->second.AssertOk();
98 case chunked_vector_fuzzer::Action::kMove: {
113 it_to->second = it_from->second;
115 it_from->second.AssertOk();
116 it_to->second.AssertOk();
118 case chunked_vector_fuzzer::Action::kClear: {
125 case chunked_vector_fuzzer::Action::kSwap: {
129 from->chunked.Swap(&
to->chunked);
133 case chunked_vector_fuzzer::Action::kRemoveIf: {
137 return *hdl ==
action.remove_if().value();
141 std::remove_if(c->chunked.begin(), c->chunked.end(),
cond));
142 c->std.erase(std::remove_if(c->std.begin(), c->std.end(),
cond),
146 case chunked_vector_fuzzer::Action::ACTION_TYPE_NOT_SET:
167 for (
int i = 0;
i <
msg.actions_size();
i++) {