コード例 #1
0
        public virtual void TestReadIntForPositionEndianness()
        {
            var readInt = _input.ReadInt(3, Endianness.LittleEndian);
            var theInt  = BytesExtensions.ReadIntL(InitData, 3);

            Assert.AreEqual(theInt, readInt);
        }
コード例 #2
0
        public virtual void TestReadFloatForPositionEndianness()
        {
            double readFloat = _input.ReadFloat(2, Endianness.LittleEndian);
            var    intB      = BytesExtensions.ReadIntL(InitData, 2);
            double aFloat    = BitConverter.ToSingle(BitConverter.GetBytes(intB), 0);

            Assert.AreEqual(aFloat, readFloat, 0);
        }
        public virtual void TestWriteIntForVEndianness()
        {
            var expected = 100;

            _output.Write(expected, Endianness.LittleEndian);
            var actual = BytesExtensions.ReadIntL(_output.Buffer, 0);

            Assert.AreEqual(actual, expected);
        }
        public virtual void TestWriteFloatForVEndianness()
        {
            var v = 1.1f;

            _output.Write(v, Endianness.LittleEndian);
            var expected = BitConverter.ToInt32(BitConverter.GetBytes(v), 0);
            var actual   = BytesExtensions.ReadIntL(_output.Buffer, 0);

            Assert.AreEqual(actual, expected);
        }