Esempio n. 1
0
        public void Test_Int(ByteOrder byteOrder, int index, int input)
        {
            var buffer = new ExpandableArrayBuffer();

            buffer.PutInt(index, input, byteOrder);

            var result = (byteOrder == ExpandableArrayBuffer.NATIVE_BYTE_ORDER) ? buffer.GetInt(index) : buffer.GetInt(index, byteOrder);

            Assert.AreEqual(input, result);
        }
Esempio n. 2
0
        public void Test_Equals002()
        {
            var eab1 = new ExpandableArrayBuffer();

            eab1.PutBytes(0, new byte[] { 0, 0, 0, 1 });

            var eab2 = new ExpandableArrayBuffer();

            eab2.PutInt(0, 1, ByteOrder.BigEndian);

            Assert.AreEqual(eab1, eab2);
            Assert.IsTrue(eab1.Equals(eab2));
            Assert.IsTrue(eab2.Equals(eab1));
        }
        public void ShouldExpand()
        {
            IMutableDirectBuffer buffer = new ExpandableArrayBuffer();

            int capacity = buffer.Capacity;

            int index = capacity + 50;
            int value = 777;

            buffer.PutInt(index, value);

            Assert.That(buffer.Capacity, Is.GreaterThan(capacity));
            Assert.AreEqual(buffer.GetInt(index), value);
        }
Esempio n. 4
0
        public void Test_Int(ByteOrder byteOrder, byte[] expectedResult, int index, int input)
        {
            var buffer = new ExpandableArrayBuffer();

            buffer.PutInt(index, input, byteOrder);

            var expectedResultArray = new ExpandableArrayBuffer();

            expectedResultArray.PutBytes(index, expectedResult);

            Assert.AreEqual(expectedResultArray, buffer);

            var result = (byteOrder == ExpandableArrayBuffer.NATIVE_BYTE_ORDER) ? buffer.GetInt(index) : buffer.GetInt(index, byteOrder);

            Assert.AreEqual(result, input);
        }