Use kName naming style for enum in binary_json_conformance_suite.cc
This style is officially the correct one according to the style guide, but more importantly this fixes a conflict with TRUE and FALSE macros defined on Mac OS.
This commit is contained in:
parent
877e7b6472
commit
9faf5a79bc
@ -219,21 +219,21 @@ string GetNonDefaultValue(FieldDescriptor::Type type) {
|
||||
#define UNKNOWN_FIELD 666
|
||||
|
||||
enum class Packed {
|
||||
UNSPECIFIED = 0,
|
||||
TRUE = 1,
|
||||
FALSE = 2,
|
||||
kUnspecified = 0,
|
||||
kTrue = 1,
|
||||
kFalse = 2,
|
||||
};
|
||||
|
||||
const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type,
|
||||
bool repeated, bool is_proto3,
|
||||
Packed packed = Packed::UNSPECIFIED) {
|
||||
Packed packed = Packed::kUnspecified) {
|
||||
const Descriptor* d = is_proto3 ?
|
||||
TestAllTypesProto3().GetDescriptor() : TestAllTypesProto2().GetDescriptor();
|
||||
for (int i = 0; i < d->field_count(); i++) {
|
||||
const FieldDescriptor* f = d->field(i);
|
||||
if (f->type() == type && f->is_repeated() == repeated) {
|
||||
if ((packed == Packed::TRUE && !f->is_packed()) ||
|
||||
(packed == Packed::FALSE && f->is_packed())) {
|
||||
if ((packed == Packed::kTrue && !f->is_packed()) ||
|
||||
(packed == Packed::kFalse && f->is_packed())) {
|
||||
continue;
|
||||
}
|
||||
return f;
|
||||
@ -243,10 +243,10 @@ const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type,
|
||||
string packed_string = "";
|
||||
const string repeated_string = repeated ? "Repeated " : "Singular ";
|
||||
const string proto_string = is_proto3 ? "Proto3" : "Proto2";
|
||||
if (packed == Packed::TRUE) {
|
||||
if (packed == Packed::kTrue) {
|
||||
packed_string = "Packed ";
|
||||
}
|
||||
if (packed == Packed::FALSE) {
|
||||
if (packed == Packed::kFalse) {
|
||||
packed_string = "Unpacked ";
|
||||
}
|
||||
GOOGLE_LOG(FATAL) << "Couldn't find field with type: " << repeated_string.c_str()
|
||||
@ -796,9 +796,9 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType(
|
||||
// Test repeated fields.
|
||||
if (FieldDescriptor::IsTypePackable(type)) {
|
||||
const FieldDescriptor* packed_field =
|
||||
GetFieldForType(type, true, is_proto3, Packed::TRUE);
|
||||
GetFieldForType(type, true, is_proto3, Packed::kTrue);
|
||||
const FieldDescriptor* unpacked_field =
|
||||
GetFieldForType(type, true, is_proto3, Packed::FALSE);
|
||||
GetFieldForType(type, true, is_proto3, Packed::kFalse);
|
||||
|
||||
string default_proto_packed;
|
||||
string default_proto_unpacked;
|
||||
|
Loading…
Reference in New Issue
Block a user