public void TestPofStreamWriteSingle()
        {
            initPOFWriter();
            pofwriter.WriteSingle(0, 0);
            pofwriter.WriteSingle(0, -1.0F);
            pofwriter.WriteSingle(0, Single.MaxValue);
            pofwriter.WriteSingle(0, 100000F);
            pofwriter.WriteSingle(0, Single.MinValue);
            pofwriter.WriteSingle(0, Single.NegativeInfinity);
            pofwriter.WriteSingle(0, Single.PositiveInfinity);
            pofwriter.WriteSingle(0, Single.NaN);

            initPOFReader();
            Assert.AreEqual(0, pofreader.ReadSingle(0));
            Assert.AreEqual(-1.0F, pofreader.ReadSingle(0));
            Assert.AreEqual(Single.MaxValue, pofreader.ReadSingle(0));
            Assert.AreEqual(100000F, pofreader.ReadSingle(0));
            Assert.AreEqual(Single.MinValue, pofreader.ReadSingle(0));
            Assert.AreEqual(Single.NegativeInfinity, pofreader.ReadSingle(0));
            Assert.AreEqual(Single.PositiveInfinity, pofreader.ReadSingle(0));
            Assert.AreEqual(Single.NaN, pofreader.ReadSingle(0));
        }
Example #2
0
        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));
        }