Example #1
0
        public void TestExtRstEqualsAndHashCode()
        {
            byte[] buf = new byte[200];
            LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0);
            String str = "\u1d02\u1d12\u1d22";

            bos.WriteShort(1);
            bos.WriteShort(5 * LittleEndianConsts.SHORT_SIZE + str.Length * 2 + 3 * LittleEndianConsts.SHORT_SIZE + 2); // data size
            bos.WriteShort(0x4711);
            bos.WriteShort(0x0815);
            bos.WriteShort(1);
            bos.WriteShort(str.Length);
            bos.WriteShort(str.Length);
            StringUtil.PutUnicodeLE(str, bos);
            bos.WriteShort(1);
            bos.WriteShort(1);
            bos.WriteShort(3);
            bos.WriteShort(42);

            LittleEndianByteArrayInputStream in1 = new LittleEndianByteArrayInputStream(buf, 0, bos.WriteIndex);

            UnicodeString.ExtRst extRst1 = new UnicodeString.ExtRst(in1, bos.WriteIndex);
            in1 = new LittleEndianByteArrayInputStream(buf, 0, bos.WriteIndex);
            UnicodeString.ExtRst extRst2 = new UnicodeString.ExtRst(in1, bos.WriteIndex);

            Assert.AreEqual(extRst1, extRst2);
            Assert.AreEqual(extRst1.GetHashCode(), extRst2.GetHashCode());
        }
Example #2
0
        public void TestExtRstEqualsAndHashCode()
        {
            byte[] buf = new byte[200];
            LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0);
            String str = "\u1d02\u1d12\u1d22";
            bos.WriteShort(1);
            bos.WriteShort(5 * LittleEndianConsts.SHORT_SIZE + str.Length * 2 + 3 * LittleEndianConsts.SHORT_SIZE + 2); // data size
            bos.WriteShort(0x4711);
            bos.WriteShort(0x0815);
            bos.WriteShort(1);
            bos.WriteShort(str.Length);
            bos.WriteShort(str.Length);
            StringUtil.PutUnicodeLE(str, bos);
            bos.WriteShort(1);
            bos.WriteShort(1);
            bos.WriteShort(3);
            bos.WriteShort(42);

            LittleEndianByteArrayInputStream in1 = new LittleEndianByteArrayInputStream(buf, 0, bos.WriteIndex);
            UnicodeString.ExtRst extRst1 = new UnicodeString.ExtRst(in1, bos.WriteIndex);
            in1 = new LittleEndianByteArrayInputStream(buf, 0, bos.WriteIndex);
            UnicodeString.ExtRst extRst2 = new UnicodeString.ExtRst(in1, bos.WriteIndex);

            Assert.AreEqual(extRst1, extRst2);
            Assert.AreEqual(extRst1.GetHashCode(), extRst2.GetHashCode());
        }