Additional test

This commit is contained in:
James Newton-King 2020-11-13 12:17:24 +13:00 committed by Adam Cozzette
parent e57f761e7b
commit e91922a4e7

View File

@ -87,6 +87,28 @@ namespace Google.Protobuf.WellKnownTypes
});
}
[Test]
public void NegativeSingleValues()
{
var message = new TestWellKnownTypes
{
FloatField = -12.5f,
DoubleField = -12.25d,
Int32Field = -1,
Int64Field = -2
};
MessageParsingHelpers.AssertWritingMessage(message);
MessageParsingHelpers.AssertRoundtrip(TestWellKnownTypes.Parser, message, parsed =>
{
Assert.AreEqual(-12.5f, parsed.FloatField);
Assert.AreEqual(-12.25d, parsed.DoubleField);
Assert.AreEqual(-1, parsed.Int32Field);
Assert.AreEqual(-2L, parsed.Int64Field);
});
}
[Test]
public void NonNullDefaultIsPreservedThroughSerialization()
{