public void TestNullKeyMap()
        {
            PatriciaTrie <string> .KeyMapper <String> keyMapper = new PatriciaTrie <string> .StringKeyMapper();

            Assert.IsFalse(keyMapper.IsSet(0, null));
            Assert.IsFalse(keyMapper.IsSet(100, null));
            Assert.IsFalse(keyMapper.IsSet(1000, null));
        }
Beispiel #2
0
        public void TestNullKeyMap()
        {
            var keyMapper = new PatriciaTrie <string> .StringKeyMapper();

            keyMapper.IsSet(0, null).IsFalse();
            keyMapper.IsSet(100, null).IsFalse();
            keyMapper.IsSet(1000, null).IsFalse();
        }
        public void TestEmptyKeyMap()
        {
            PatriciaTrie <string> .KeyMapper <string> keyMapper = new PatriciaTrie <string> .StringKeyMapper();

            // Note: this is a special case handled in PatriciaTrie
            Assert.IsTrue(keyMapper.IsSet(0, ""));
            Assert.IsTrue(keyMapper.IsSet(100, ""));
            Assert.IsTrue(keyMapper.IsSet(1000, ""));
        }
Beispiel #4
0
        public void TestEmptyKeyMap()
        {
            var keyMapper = new PatriciaTrie <string> .StringKeyMapper();

            // Note: this is a special case handled in PatriciaTrie
            keyMapper.IsSet(0, "").IsTrue();
            keyMapper.IsSet(100, "").IsTrue();
            keyMapper.IsSet(1000, "").IsTrue();
        }
        public void TestOverflowBit()
        {
            PatriciaTrie <string> .KeyMapper <String> keyMapper = new PatriciaTrie <string> .StringKeyMapper();

            String key = "a";

            // a = U+0061 = 0000 0000 0110 0001
            Assert.IsFalse(keyMapper.IsSet(0, key));
            Assert.IsFalse(keyMapper.IsSet(1, key));
            Assert.IsFalse(keyMapper.IsSet(2, key));
            Assert.IsFalse(keyMapper.IsSet(3, key));

            Assert.IsFalse(keyMapper.IsSet(4, key));
            Assert.IsFalse(keyMapper.IsSet(5, key));
            Assert.IsFalse(keyMapper.IsSet(6, key));
            Assert.IsFalse(keyMapper.IsSet(7, key));

            Assert.IsFalse(keyMapper.IsSet(8, key));
            Assert.IsTrue(keyMapper.IsSet(9, key));
            Assert.IsTrue(keyMapper.IsSet(10, key));
            Assert.IsFalse(keyMapper.IsSet(11, key));

            Assert.IsFalse(keyMapper.IsSet(12, key));
            Assert.IsFalse(keyMapper.IsSet(13, key));
            Assert.IsFalse(keyMapper.IsSet(14, key));
            Assert.IsTrue(keyMapper.IsSet(15, key));

            // Asking for overflow bits should return 1
            Assert.IsTrue(keyMapper.IsSet(16, key));
            Assert.IsTrue(keyMapper.IsSet(17, key));
            Assert.IsTrue(keyMapper.IsSet(100, key));
        }
        public void TestSimpleKey()
        {
            PatriciaTrie <string> .KeyMapper <string> keyMapper = new PatriciaTrie <string> .StringKeyMapper();

            string key = "abc";

            // a = U+0061 = 0000 0000 0110 0001
            Assert.IsFalse(keyMapper.IsSet(0, key));
            Assert.IsFalse(keyMapper.IsSet(1, key));
            Assert.IsFalse(keyMapper.IsSet(2, key));
            Assert.IsFalse(keyMapper.IsSet(3, key));

            Assert.IsFalse(keyMapper.IsSet(4, key));
            Assert.IsFalse(keyMapper.IsSet(5, key));
            Assert.IsFalse(keyMapper.IsSet(6, key));
            Assert.IsFalse(keyMapper.IsSet(7, key));

            Assert.IsFalse(keyMapper.IsSet(8, key));
            Assert.IsTrue(keyMapper.IsSet(9, key));
            Assert.IsTrue(keyMapper.IsSet(10, key));
            Assert.IsFalse(keyMapper.IsSet(11, key));

            Assert.IsFalse(keyMapper.IsSet(12, key));
            Assert.IsFalse(keyMapper.IsSet(13, key));
            Assert.IsFalse(keyMapper.IsSet(14, key));
            Assert.IsTrue(keyMapper.IsSet(15, key));

            // b = U+0062 = 0000 0000 0110 0010
            Assert.IsFalse(keyMapper.IsSet(16, key));
            Assert.IsFalse(keyMapper.IsSet(17, key));
            Assert.IsFalse(keyMapper.IsSet(18, key));
            Assert.IsFalse(keyMapper.IsSet(19, key));

            Assert.IsFalse(keyMapper.IsSet(20, key));
            Assert.IsFalse(keyMapper.IsSet(21, key));
            Assert.IsFalse(keyMapper.IsSet(22, key));
            Assert.IsFalse(keyMapper.IsSet(23, key));

            Assert.IsFalse(keyMapper.IsSet(24, key));
            Assert.IsTrue(keyMapper.IsSet(25, key));
            Assert.IsTrue(keyMapper.IsSet(26, key));
            Assert.IsFalse(keyMapper.IsSet(27, key));

            Assert.IsFalse(keyMapper.IsSet(28, key));
            Assert.IsFalse(keyMapper.IsSet(29, key));
            Assert.IsTrue(keyMapper.IsSet(30, key));
            Assert.IsFalse(keyMapper.IsSet(31, key));

            // c = U+0063 = 0000 0000 0110 0011
            Assert.IsFalse(keyMapper.IsSet(32, key));
            Assert.IsFalse(keyMapper.IsSet(33, key));
            Assert.IsFalse(keyMapper.IsSet(34, key));
            Assert.IsFalse(keyMapper.IsSet(35, key));

            Assert.IsFalse(keyMapper.IsSet(36, key));
            Assert.IsFalse(keyMapper.IsSet(37, key));
            Assert.IsFalse(keyMapper.IsSet(38, key));
            Assert.IsFalse(keyMapper.IsSet(39, key));

            Assert.IsFalse(keyMapper.IsSet(40, key));
            Assert.IsTrue(keyMapper.IsSet(41, key));
            Assert.IsTrue(keyMapper.IsSet(42, key));
            Assert.IsFalse(keyMapper.IsSet(43, key));

            Assert.IsFalse(keyMapper.IsSet(44, key));
            Assert.IsFalse(keyMapper.IsSet(45, key));
            Assert.IsTrue(keyMapper.IsSet(46, key));
            Assert.IsTrue(keyMapper.IsSet(47, key));
        }