コード例 #1
0
        public virtual void TestEquals()
        {
            // equal to self
            assertTrue(buf.Equals(buf));
            Int64Buffer @readonly = buf.AsReadOnlyBuffer();

            assertTrue(buf.Equals(@readonly));
            Int64Buffer duplicate = buf.Duplicate();

            assertTrue(buf.Equals(duplicate));

            // always false, if type mismatch
            assertFalse(buf.Equals(true));

            assertTrue(buf.Capacity > 5);

            buf.SetLimit(buf.Capacity).SetPosition(0);
            @readonly.SetLimit(@readonly.Capacity).SetPosition(1);
            assertFalse(buf.Equals(@readonly));

            buf.SetLimit(buf.Capacity - 1).SetPosition(0);
            duplicate.SetLimit(duplicate.Capacity).SetPosition(0);
            assertFalse(buf.Equals(duplicate));
        }