aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2016-08-11 11:24:31 -0400
committerThomas Van Lenten <thomasvl@google.com>2016-08-11 13:15:01 -0400
commit27c89625057a56d4559f94d0adac4776600cfe03 (patch)
tree543d48739186efc06f26102e9c04a58cf799b8c7
parentca5b7751e5bb5a8dc5694844925f371bf3b34426 (diff)
downloadprotobuf-27c89625057a56d4559f94d0adac4776600cfe03.tar.gz
protobuf-27c89625057a56d4559f94d0adac4776600cfe03.tar.bz2
protobuf-27c89625057a56d4559f94d0adac4776600cfe03.zip
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.
-rw-r--r--conformance/conformance.proto5
-rw-r--r--conformance/conformance_test.cc30
-rw-r--r--conformance/failure_list_csharp.txt20
-rw-r--r--conformance/failure_list_ruby.txt6
4 files changed, 61 insertions, 0 deletions
diff --git a/conformance/conformance.proto b/conformance/conformance.proto
index fc96074a..e1b797ca 100644
--- a/conformance/conformance.proto
+++ b/conformance/conformance.proto
@@ -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
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index d46fa877..88b05a56 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -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(
diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt
index 1716bcbd..6f8a5b7c 100644
--- a/conformance/failure_list_csharp.txt
+++ b/conformance/failure_list_csharp.txt
@@ -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
diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt
index 526c2e75..47d0c737 100644
--- a/conformance/failure_list_ruby.txt
+++ b/conformance/failure_list_ruby.txt
@@ -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