public void TestReadAsDouble() { //PASSED initPOFWriter(); writer.Write((double)0.0); writer.Write((double)Double.MinValue); writer.Write((double)PofConstants.V_INT_NEG_1); writer.Write((double)Double.MaxValue); pofwriter.WriteSingle(0, 11.234f); initPOFReader(); Assert.AreEqual((double)0.0, PofHelper.ReadAsDouble(reader, PofConstants.T_FLOAT64)); Assert.AreEqual((double)Double.MinValue, PofHelper.ReadAsDouble(reader, PofConstants.T_FLOAT64)); Assert.AreEqual((double)PofConstants.V_INT_NEG_1, PofHelper.ReadAsDouble(reader, PofConstants.T_FLOAT64)); Assert.AreEqual((double)Double.MaxValue, PofHelper.ReadAsDouble(reader, PofConstants.T_FLOAT64)); Assert.AreEqual((Single)11.234, (Single)pofreader.ReadDouble(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)); }