diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-08-11 11:24:31 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-08-11 13:15:01 -0400 |
commit | 27c89625057a56d4559f94d0adac4776600cfe03 (patch) | |
tree | 543d48739186efc06f26102e9c04a58cf799b8c7 /conformance/conformance_test.cc | |
parent | ca5b7751e5bb5a8dc5694844925f371bf3b34426 (diff) |
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.
Diffstat (limited to 'conformance/conformance_test.cc')
-rw-r--r-- | conformance/conformance_test.cc | 30 |
1 files changed, 30 insertions, 0 deletions
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( |