Esempio n. 1
0
        public void ReadBytesSuccessfully()
        {
            var result = new List <long>(mResult.Length);
            var reader = new BitsReader(mInput);

            for (int i = 1; i < 65; i++)
            {
                result.Add(reader.ReadInt64(i));
                result.Add(reader.ReadInt64(i));
            }

            Assert.AreEqual(mResult, result.ToArray());
        }
Esempio n. 2
0
        public void ReadShouldThrow(byte[] input)
        {
            var reader = new BitsReader(input);

            for (int i = 0; i < 2; ++i)
            {
                reader.ReadInt64();
            }
        }
Esempio n. 3
0
        private static void BitsReaderSample()
        {
            byte[] buffer1 = { 25, 26, 27, 28, 29, 30, 31, 32 };

            var reader = new BitsReader(buffer1);

            sbyte b  = reader.ReadInt8();
            sbyte b1 = reader.ReadInt8(1);
            sbyte b3 = reader.ReadInt8(3);
            sbyte b4 = reader.ReadInt8(4);

            short s   = reader.ReadInt16();
            short s1  = reader.ReadInt16(1);
            short s2  = reader.ReadInt16(2);
            short s4  = reader.ReadInt16(4);
            short s5  = reader.ReadInt16(5);
            short s8  = reader.ReadInt16(8);
            short s12 = reader.ReadInt16(12);

            //receive new data in buffer1
            reader.Reset(buffer1);

            int i1  = reader.ReadInt32(1);
            int i7  = reader.ReadInt32(7);
            int i24 = reader.ReadInt32(24);
            int i   = reader.ReadInt32();

            //receive new data in buffer1
            reader.Reset(buffer1);

            long l1  = reader.ReadInt64(1);
            long l3  = reader.ReadInt64(3);
            long l24 = reader.ReadInt64(24);
            long l36 = reader.ReadInt64(36);

            //receive new data in buffer1
            reader.Reset(buffer1);

            long l = reader.ReadInt64();
        }