Add more types to the zero oneof cases.

Incase the different runtimes have different generation/implementations for
for the different primitive field types, cover a larger range of the proto
types in the oneof zero tests.
This commit is contained in:
Thomas Van Lenten 2016-08-11 11:24:31 -04:00
parent ca5b7751e5
commit 27c8962505
4 changed files with 61 additions and 0 deletions

View File

@ -210,6 +210,11 @@ message TestAllTypes {
NestedMessage oneof_nested_message = 112;
string oneof_string = 113;
bytes oneof_bytes = 114;
bool oneof_bool = 115;
uint64 oneof_uint64 = 116;
float oneof_float = 117;
double oneof_double = 118;
NestedEnum oneof_enum = 119;
}
// Well-known types

View File

@ -1256,6 +1256,21 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
message.set_oneof_bytes("");
RunValidProtobufTest(
"OneofZeroBytes", message, "oneof_bytes: \"\"");
message.set_oneof_bool(false);
RunValidProtobufTest(
"OneofZeroBool", message, "oneof_bool: false");
message.set_oneof_uint64(0);
RunValidProtobufTest(
"OneofZeroUint64", message, "oneof_uint64: 0");
message.set_oneof_float(0.0f);
RunValidProtobufTest(
"OneofZeroFloat", message, "oneof_float: 0");
message.set_oneof_double(0.0);
RunValidProtobufTest(
"OneofZeroDouble", message, "oneof_double: 0");
message.set_oneof_enum(TestAllTypes::FOO);
RunValidProtobufTest(
"OneofZeroEnum", message, "oneof_enum: FOO");
}
RunValidJsonTest(
"OneofZeroUint32",
@ -1269,6 +1284,21 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
RunValidJsonTest(
"OneofZeroBytes",
R"({"oneofBytes": ""})", "oneof_bytes: \"\"");
RunValidJsonTest(
"OneofZeroBool",
R"({"oneofBool": false})", "oneof_bool: false");
RunValidJsonTest(
"OneofZeroUint64",
R"({"oneofUint64": 0})", "oneof_uint64: 0");
RunValidJsonTest(
"OneofZeroFloat",
R"({"oneofFloat": 0.0})", "oneof_float: 0");
RunValidJsonTest(
"OneofZeroDouble",
R"({"oneofDouble": 0.0})", "oneof_double: 0");
RunValidJsonTest(
"OneofZeroEnum",
R"({"oneofEnum":"FOO"})", "oneof_enum: FOO");
// Repeated fields.
RunValidJsonTest(

View File

@ -5,3 +5,23 @@ JsonInput.FieldNameWithMixedCases.JsonOutput
JsonInput.FieldNameWithMixedCases.ProtobufOutput
JsonInput.FieldNameWithMixedCases.Validator
JsonInput.OriginalProtoFieldName.JsonOutput
JsonInput.OneofZeroBool.JsonOutput
JsonInput.OneofZeroBool.ProtobufOutput
JsonInput.OneofZeroDouble.JsonOutput
JsonInput.OneofZeroDouble.ProtobufOutput
JsonInput.OneofZeroEnum.JsonOutput
JsonInput.OneofZeroEnum.ProtobufOutput
JsonInput.OneofZeroFloat.JsonOutput
JsonInput.OneofZeroFloat.ProtobufOutput
JsonInput.OneofZeroUint64.JsonOutput
JsonInput.OneofZeroUint64.ProtobufOutput
ProtobufInput.OneofZeroBool.JsonOutput
ProtobufInput.OneofZeroBool.ProtobufOutput
ProtobufInput.OneofZeroDouble.JsonOutput
ProtobufInput.OneofZeroDouble.ProtobufOutput
ProtobufInput.OneofZeroEnum.JsonOutput
ProtobufInput.OneofZeroEnum.ProtobufOutput
ProtobufInput.OneofZeroFloat.JsonOutput
ProtobufInput.OneofZeroFloat.ProtobufOutput
ProtobufInput.OneofZeroUint64.JsonOutput
ProtobufInput.OneofZeroUint64.ProtobufOutput

View File

@ -103,8 +103,14 @@ JsonInput.MessageMapField.JsonOutput
JsonInput.MessageMapField.ProtobufOutput
JsonInput.MessageRepeatedField.JsonOutput
JsonInput.MessageRepeatedField.ProtobufOutput
JsonInput.OneofZeroDouble.JsonOutput
JsonInput.OneofZeroDouble.ProtobufOutput
JsonInput.OneofZeroFloat.JsonOutput
JsonInput.OneofZeroFloat.ProtobufOutput
JsonInput.OneofZeroUint32.JsonOutput
JsonInput.OneofZeroUint32.ProtobufOutput
JsonInput.OneofZeroUint64.JsonOutput
JsonInput.OneofZeroUint64.ProtobufOutput
JsonInput.OptionalBoolWrapper.JsonOutput
JsonInput.OptionalBoolWrapper.ProtobufOutput
JsonInput.OptionalBytesWrapper.JsonOutput