Skip to content

Commit

Permalink
Rename tests using TestProtobuf to reflect that the underlying proto …
Browse files Browse the repository at this point in the history
…is overloaded.

This is in preparation for adding similar tests with a proto with fewer fields.

PiperOrigin-RevId: 606660333
  • Loading branch information
Markus Kusano authored and copybara-github committed Feb 13, 2024
1 parent 682406e commit 8c636aa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions e2e_tests/testdata/fuzz_tests_with_proto_inputs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using fuzztest::internal::FoodMachineProcedure;
using fuzztest::internal::RoboCourier560Plan;
using fuzztest::internal::TestProtobuf;

void BytesSummingToMagicValue(const TestProtobuf& input) {
void BytesSummingToMagicValueWithOverloadedProto(const TestProtobuf& input) {
char sum = 0;
for (const char c : input.str()) {
sum += c;
Expand All @@ -35,29 +35,31 @@ void BytesSummingToMagicValue(const TestProtobuf& input) {
std::abort();
}
}
FUZZ_TEST(ProtoPuzzles, BytesSummingToMagicValue);
FUZZ_TEST(ProtoPuzzles, BytesSummingToMagicValueWithOverloadedProto);

void PrefixBytesSummingToMagicValue(const TestProtobuf& input) {
void PrefixBytesSummingToMagicValueWithOverloadedProto(
const TestProtobuf& input) {
if (input.str().size() < 2) {
return;
}
if (input.str()[0] + input.str()[1] == 0x72) {
std::abort();
}
}
FUZZ_TEST(ProtoPuzzles, PrefixBytesSummingToMagicValue);
FUZZ_TEST(ProtoPuzzles, PrefixBytesSummingToMagicValueWithOverloadedProto);

void PrefixIsMagicValue(const TestProtobuf& input) {
void PrefixIsMagicValueWithOverloadedProto(const TestProtobuf& input) {
if (input.str().size() < 2) {
return;
}
if (input.str()[0] + input.str()[1] == 0x72) {
std::abort();
}
}
FUZZ_TEST(ProtoPuzzles, PrefixIsMagicValue);
FUZZ_TEST(ProtoPuzzles, PrefixIsMagicValueWithOverloadedProto);

void ContainsCharactersSpecifiedAtStartOfString(const TestProtobuf& input) {
void ContainsCharactersSpecifiedAtStartOfStringWithOverloadedProto(
const TestProtobuf& input) {
if (input.str().size() < 2) {
return;
}
Expand All @@ -80,7 +82,8 @@ void ContainsCharactersSpecifiedAtStartOfString(const TestProtobuf& input) {
std::abort();
}
}
FUZZ_TEST(ProtoPuzzles, ContainsCharactersSpecifiedAtStartOfString);
FUZZ_TEST(ProtoPuzzles,
ContainsCharactersSpecifiedAtStartOfStringWithOverloadedProto);

enum class FoodMachineState {
kOff,
Expand Down

0 comments on commit 8c636aa

Please sign in to comment.