示例#1
0
        public void Compare_secondnull_throws()
        {
            byte[]  keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey = Collator.CreateSortKey("heo", keyData);

            Assert.Throws <ArgumentNullException>(() => SortKey.Compare(sortKey, null));
        }
示例#2
0
        public void Compare_firstnull_throws()
        {
            byte[]  keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey = Collator.CreateSortKey("heo", keyData);

            SortKey.Compare(null, sortKey);
        }
示例#3
0
        public void Compare_secondnull_throws()
        {
            byte[]  keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey = Collator.CreateSortKey("heo", keyData);

            SortKey.Compare(sortKey, null);
        }
示例#4
0
        public void Compare_keyDataSame_same()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heo", keyData);
            SortKey sortKey2 = Collator.CreateSortKey("heol", keyData);

            Assert.AreEqual(Same, SortKey.Compare(sortKey1, sortKey2));
        }
示例#5
0
        public void Compare_SamePrefixSecondShorter_follows()
        {
            byte[]  keyData1 = new byte[] { 0xae, 0x1, 0x20, 0x30, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heol", keyData1);

            byte[]  keyData2 = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey2 = Collator.CreateSortKey("heo", keyData2);

            Assert.AreEqual(Follows, SortKey.Compare(sortKey1, sortKey2));
        }
示例#6
0
        public void Compare_SamePrefixSecondLonger_precedes()
        {
            byte[]  keyData1 = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heo", keyData1);

            byte[]  keyData2 = new byte[] { 0xae, 0x1, 0x20, 0x32, 0x1 };
            SortKey sortKey2 = Collator.CreateSortKey("heol", keyData2);

            Assert.AreEqual(Precedes, SortKey.Compare(sortKey1, sortKey2));
        }
示例#7
0
        public void Compare_SecondGreater_precedes()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heol", keyData);

            keyData[0] = 0xaf;
            SortKey sortKey2 = Collator.CreateSortKey("heo", keyData);

            Assert.AreEqual(Precedes, SortKey.Compare(sortKey1, sortKey2));
        }
示例#8
0
        public void Compare_SecondLesser_follows()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heol", keyData);

            keyData[0] = 0xad;
            SortKey sortKey2 = Collator.CreateSortKey("heo", keyData);

            Assert.AreEqual(Follows, SortKey.Compare(sortKey1, sortKey2));
        }
示例#9
0
        public void Compare_keyDataByteChanges_NotAffected()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heo", keyData);

            keyData[2] = 0x21;
            SortKey sortKey2 = Collator.CreateSortKey("hao", keyData);

            Assert.AreEqual(Precedes, SortKey.Compare(sortKey1, sortKey2));
        }
示例#10
0
 public void SortKey_nullKeyData_Throws()
 {
     Assert.Throws <ArgumentNullException>(() => Collator.CreateSortKey("hello", null));
 }
示例#11
0
 public void SortKey_nullOriginalString_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.Throws <ArgumentNullException>(() => Collator.CreateSortKey(null, keyData));
 }
示例#12
0
 public void ConstructSortKey()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.IsNotNull(Collator.CreateSortKey("iou", keyData));
 }
示例#13
0
 public void SortKey_nullOriginalString_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey(null, keyData);
 }
示例#14
0
 public void SortKey_KeyDataLengthNegative_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey("hello", keyData, -1);
 }
示例#15
0
 public void SortKey_KeyDataLengthTooLarge_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey("hello", keyData, keyData.Length + 1);
 }
示例#16
0
 public void SortKey_nullKeyData_Throws()
 {
     Collator.CreateSortKey("hello", null);
 }
示例#17
0
 public void SortKey_KeyDataLengthNegative_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.Throws <ArgumentOutOfRangeException>(() => Collator.CreateSortKey("hello", keyData, -1));
 }