Пример #1
0
        public virtual void  testDecodeInteger()
        {
            IDecoder decoder = newDecoder();

            System.IO.MemoryStream stream = new System.IO.MemoryStream((coderTestUtils.createTestInteger4Bytes()));

            TestI32 val = decoder.decode <TestI32>(stream);

            Assert.NotNull(val);
            Assert.Equals(val.Value, coderTestUtils.createTestInteger4().Value);

            stream = new System.IO.MemoryStream((coderTestUtils.createTestInteger3Bytes()));
            TestI16 val16 = decoder.decode <TestI16>(stream);

            Assert.NotNull(val16);
            Assert.Equals(val16.Value, coderTestUtils.createTestInteger3().Value);

            stream = new System.IO.MemoryStream((coderTestUtils.createTestInteger2Bytes()));
            val16  = decoder.decode <TestI16>(stream);
            Assert.NotNull(val16);
            Assert.Equals(val16.Value, coderTestUtils.createTestInteger2().Value);

            stream = new System.IO.MemoryStream((coderTestUtils.createTestInteger1Bytes()));
            TestI8 val8 = decoder.decode <TestI8>(stream);

            Assert.NotNull(val8);
            Assert.Equals(val8.Value, coderTestUtils.createTestInteger1().Value);

            stream = new System.IO.MemoryStream((coderTestUtils.createTestIntegerRBytes()));
            TestIR valR = decoder.decode <TestIR>(stream);

            Assert.NotNull(valR);
            Assert.Equals(valR.Value, coderTestUtils.createTestIntegerR().Value);

            stream = new System.IO.MemoryStream((coderTestUtils.createTestInteger2_12Bytes()));
            TestI14 val14 = decoder.decode <TestI14>(stream);

            Assert.NotNull(val14);
            Assert.Equals(val14.Value, coderTestUtils.createTestInteger2_12().Value);
        }