Example #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));
        }
Example #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);
        }
Example #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);
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #10
0
 public void SortKey_nullKeyData_Throws()
 {
     Assert.Throws <ArgumentNullException>(() => Collator.CreateSortKey("hello", null));
 }
Example #11
0
 public void SortKey_nullOriginalString_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.Throws <ArgumentNullException>(() => Collator.CreateSortKey(null, keyData));
 }
Example #12
0
 public void ConstructSortKey()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.IsNotNull(Collator.CreateSortKey("iou", keyData));
 }
Example #13
0
 public void SortKey_nullOriginalString_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey(null, keyData);
 }
Example #14
0
 public void SortKey_KeyDataLengthNegative_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey("hello", keyData, -1);
 }
Example #15
0
 public void SortKey_KeyDataLengthTooLarge_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey("hello", keyData, keyData.Length + 1);
 }
Example #16
0
 public void SortKey_nullKeyData_Throws()
 {
     Collator.CreateSortKey("hello", null);
 }
Example #17
0
 public void SortKey_KeyDataLengthNegative_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.Throws <ArgumentOutOfRangeException>(() => Collator.CreateSortKey("hello", keyData, -1));
 }