diff options
author | Jon Skeet <jonskeet@google.com> | 2017-10-25 16:03:23 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2017-12-09 09:49:24 +0000 |
commit | f3e9a65d758d47633a161e526b35dea22bac9a5c (patch) | |
tree | a1733195e76c088c2f83093910c92e4d5609d275 /csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs | |
parent | 618f06fc9cd7fd872de8977dfe40294cadb4af21 (diff) | |
download | protobuf-f3e9a65d758d47633a161e526b35dea22bac9a5c.tar.gz protobuf-f3e9a65d758d47633a161e526b35dea22bac9a5c.tar.bz2 protobuf-f3e9a65d758d47633a161e526b35dea22bac9a5c.zip |
Compare floating point values bitwise in C#
This is the manual code part of the Google.Protobuf library, and tests.
Some tests will fail until codegen is changed and rerun.
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs index 6852f75f..129923b6 100644 --- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs +++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs @@ -742,5 +742,18 @@ namespace Google.Protobuf.Collections var text = list.ToString(); Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString()); } + + [Test] + public void NaNValuesComparedBitwise() + { + var list1 = new RepeatedField<double> { SampleNaNs.Regular, SampleNaNs.SignallingFlipped }; + var list2 = new RepeatedField<double> { SampleNaNs.Regular, SampleNaNs.PayloadFlipped }; + var list3 = new RepeatedField<double> { SampleNaNs.Regular, SampleNaNs.SignallingFlipped }; + + EqualityTester.AssertInequality(list1, list2); + EqualityTester.AssertEquality(list1, list3); + Assert.True(list1.Contains(SampleNaNs.SignallingFlipped)); + Assert.False(list2.Contains(SampleNaNs.SignallingFlipped)); + } } } |