diff options
author | Jon Skeet <skeet@pobox.com> | 2016-07-31 11:40:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-31 11:40:51 +0100 |
commit | 00d5a7f099065e2c8d119039c2f42c1f88ad8f59 (patch) | |
tree | 68ba73877a93fee77c8834e135754bcaf2ea267d /conformance | |
parent | 6b3d120539abb0bd12833cd95ae4f9c03f3e5350 (diff) | |
download | protobuf-00d5a7f099065e2c8d119039c2f42c1f88ad8f59.tar.gz protobuf-00d5a7f099065e2c8d119039c2f42c1f88ad8f59.tar.bz2 protobuf-00d5a7f099065e2c8d119039c2f42c1f88ad8f59.zip |
Amend the conformance tests to only use Int64/Uint64 non-wrapped values which (#1164)
can reasonably be expected to be interoperable.
(The fact that not all Int64/Uint64 values *can* be exactly represented in
IEEE-754 and thus interoperably amongst JSON implementations is precisely the
reason for wrapping them when we serialize... it shouldn't be a surprise that
we can't round-trip in unwrapped form for all values.)
Diffstat (limited to 'conformance')
-rw-r--r-- | conformance/conformance_test.cc | 16 | ||||
-rw-r--r-- | conformance/failure_list_csharp.txt | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index 59a61e51..598ef732 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -814,18 +814,26 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, "Uint64FieldMaxValue", R"({"optionalUint64": "18446744073709551615"})", "optional_uint64: 18446744073709551615"); + // While not the largest Int64, this is the largest + // Int64 which can be exactly represented within an + // IEEE-754 64-bit float, which is the expected level + // of interoperability guarantee. Larger values may + // work in some implementations, but should not be + // relied upon. RunValidJsonTest( "Int64FieldMaxValueNotQuoted", - R"({"optionalInt64": 9223372036854775807})", - "optional_int64: 9223372036854775807"); + R"({"optionalInt64": 9223372036854774784})", + "optional_int64: 9223372036854774784"); RunValidJsonTest( "Int64FieldMinValueNotQuoted", R"({"optionalInt64": -9223372036854775808})", "optional_int64: -9223372036854775808"); + // Largest interoperable Uint64; see comment above + // for Int64FieldMaxValueNotQuoted. RunValidJsonTest( "Uint64FieldMaxValueNotQuoted", - R"({"optionalUint64": 18446744073709551615})", - "optional_uint64: 18446744073709551615"); + R"({"optionalUint64": 18446744073709549568})", + "optional_uint64: 18446744073709549568"); // Values can be represented as JSON strings. RunValidJsonTest( "Int32FieldStringValue", diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt index e7de4b96..1716bcbd 100644 --- a/conformance/failure_list_csharp.txt +++ b/conformance/failure_list_csharp.txt @@ -4,8 +4,4 @@ JsonInput.FieldNameInSnakeCase.ProtobufOutput JsonInput.FieldNameWithMixedCases.JsonOutput JsonInput.FieldNameWithMixedCases.ProtobufOutput JsonInput.FieldNameWithMixedCases.Validator -JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput -JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput -JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput |