Ejemplo n.º 1
0
        private void writeChar()
        {
            DataWriter        dw  = initPofWriter("Char");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteChar(0, 'f');
            psw.WriteChar(0, '0');

            dw.Flush();
            dw.Close();
        }
Ejemplo n.º 2
0
        public void TestSkipUniformValue()
        {   //PASSED
            // PLEASE DO NOTE, the method SkipUniformValue should be used only for Uniform_Arrays/Collections
            initPOFWriter();

            pofwriter.WriteInt32(0, 100);
            pofwriter.WriteInt32(0, 200);
            pofwriter.WriteInt32(0, 300);

            initPOFReader();
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            Assert.AreEqual(PofConstants.T_INT32, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32));
            Assert.AreEqual(300, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32));

            initPOFWriter();
            RawYearMonthInterval ymi = new RawYearMonthInterval(2, 10);

            pofwriter.WriteRawYearMonthInterval(0, ymi);
            pofwriter.WriteString(0, "skipping to string1");
            pofwriter.WriteTimeInterval(0, new TimeSpan(4, 52, 10));
            pofwriter.WriteString(0, "skipping to string2");
            pofwriter.WriteDayTimeInterval(0, new TimeSpan(11, 12, 13, 14, 50));
            pofwriter.WriteString(0, "skipping to string3");
            pofwriter.WriteSingle(0, 120.34f);
            pofwriter.WriteString(0, "skipping to string4");
            pofwriter.WriteDouble(0, 1222.22);
            pofwriter.WriteString(0, "skipping to string5");
            pofwriter.WriteChar(0, 'A');
            pofwriter.WriteString(0, "skipping to string6");

            initPOFReader();
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_YEAR_MONTH_INTERVAL);
            Assert.AreEqual("skipping to string1", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_TIME_INTERVAL);
            Assert.AreEqual("skipping to string2", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_DAY_TIME_INTERVAL);
            Assert.AreEqual("skipping to string3", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_FLOAT32);
            Assert.AreEqual("skipping to string4", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_FLOAT64);
            Assert.AreEqual("skipping to string5", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_CHAR);
            Assert.AreEqual("skipping to string6", pofreader.ReadString(0));
        }
        public void TestPofStreamWriteChar()
        {
            initPOFWriter();
            pofwriter.WriteChar(0, 'g');
            pofwriter.WriteChar(0, Char.MaxValue);
            pofwriter.WriteChar(0, 'A');
            pofwriter.WriteChar(0, Char.MinValue);
            pofwriter.WriteChar(0, '%');

            initPOFReader();
            Assert.AreEqual('g', pofreader.ReadChar(0));
            Assert.AreEqual(Char.MaxValue, pofreader.ReadChar(0));
            Assert.AreEqual('A', pofreader.ReadChar(0));
            Assert.AreEqual(Char.MinValue, pofreader.ReadChar(0));
            Assert.AreEqual('%', pofreader.ReadChar(0));
        }