public void TestReadAsInt32() { //PASSED initPOFWriter(); writer.WritePackedInt32((Int32)0); writer.WritePackedInt32(Int32.MinValue); writer.WritePackedInt32(PofConstants.V_INT_NEG_1); writer.WritePackedInt32(Int32.MaxValue); initPOFReader(); Assert.AreEqual((Int32)0, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32)); Assert.AreEqual(Int32.MinValue, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32)); Assert.AreEqual(PofConstants.V_INT_NEG_1, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32)); Assert.AreEqual(Int32.MaxValue, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32)); initPOFWriter(); pofwriter.WriteSingle(0, 1000.123f); pofwriter.WriteDouble(0, 3000.123456); initPOFReader(); Assert.AreEqual(1000, pofreader.ReadInt32(0)); Assert.AreEqual(3000, pofreader.ReadInt32(0)); }
public void TestPofStreamWriteDouble() { initPOFWriter(); pofwriter.WriteDouble(0, 0); pofwriter.WriteDouble(0, -1.0); pofwriter.WriteDouble(0, 1.0); pofwriter.WriteDouble(0, Double.MaxValue); pofwriter.WriteDouble(0, 100.0); pofwriter.WriteDouble(0, Double.MinValue); pofwriter.WriteDouble(0, Double.NegativeInfinity); pofwriter.WriteDouble(0, Double.PositiveInfinity); pofwriter.WriteDouble(0, Double.NaN); initPOFReader(); Assert.AreEqual(0, pofreader.ReadDouble(0)); Assert.AreEqual(-1.0, pofreader.ReadDouble(0)); Assert.AreEqual(1.0, pofreader.ReadDouble(0)); Assert.AreEqual(Double.MaxValue, pofreader.ReadDouble(0)); Assert.AreEqual(100.0, pofreader.ReadDouble(0)); Assert.AreEqual(Double.MinValue, pofreader.ReadDouble(0)); Assert.AreEqual(Double.NegativeInfinity, pofreader.ReadDouble(0)); Assert.AreEqual(Double.PositiveInfinity, pofreader.ReadDouble(0)); Assert.AreEqual(Double.NaN, pofreader.ReadDouble(0)); }