aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2017-10-25 16:03:23 +0100
committerJon Skeet <skeet@pobox.com>2017-12-09 09:49:24 +0000
commitf3e9a65d758d47633a161e526b35dea22bac9a5c (patch)
treea1733195e76c088c2f83093910c92e4d5609d275 /csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
parent618f06fc9cd7fd872de8977dfe40294cadb4af21 (diff)
downloadprotobuf-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/GeneratedMessageTest.cs')
-rw-r--r--csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
index 8b153d69..8292d3e7 100644
--- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
+++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
@@ -719,5 +719,16 @@ namespace Google.Protobuf
JsonFormatter.Default.Format(message, writer);
Assert.AreEqual("{ \"c\": 31 }", writer.ToString());
}
+
+ [Test]
+ public void NaNComparisons()
+ {
+ var message1 = new TestAllTypes { SingleDouble = SampleNaNs.Regular };
+ var message2 = new TestAllTypes { SingleDouble = SampleNaNs.PayloadFlipped };
+ var message3 = new TestAllTypes { SingleDouble = SampleNaNs.Regular };
+
+ EqualityTester.AssertInequality(message1, message2);
+ EqualityTester.AssertEquality(message1, message3);
+ }
}
} \ No newline at end of file