Exemplo n.º 1
0
        public void TestELookupAllPrefixes2()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("i");
            t = t.Add("ice");
            StringBuilder sb = new StringBuilder();

            sb.Append(t.Contains(""));
            sb.Append(t.Contains("i"));
            sb.Append(t.Contains("ic"));
            sb.Append(t.Contains("ice"));
            Assert.That(sb.ToString(), Is.EqualTo("FalseTrueFalseTrue"));
        }
Exemplo n.º 2
0
        public void TestFAddDifferentLetterLookUpAll()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("i");
            t = t.Add("ice");
            t = t.Add("cream");
            StringBuilder sb = new StringBuilder();

            sb.Append(t.Contains(""));
            sb.Append(t.Contains("i"));
            sb.Append(t.Contains("ice"));
            sb.Append(t.Contains("cream"));
            Assert.That(sb.ToString, Is.EqualTo("FalseTrueTrueTrue"));
        }
Exemplo n.º 3
0
        public void TestBAddEmptyLookItUp()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("");
            Assert.That(t.Contains(""), Is.True);
        }
Exemplo n.º 4
0
        public void TestDAddWordLookUpPrefix()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("word");
            Assert.That(t.Contains("wo"), Is.False);
        }
Exemplo n.º 5
0
        public void TestDAddLongWordLookItUp()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("word");
            Assert.That(t.Contains("word"), Is.True);
        }
Exemplo n.º 6
0
        public void TestCAddShortWordLookUpEmpty()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("i");
            Assert.That(t.Contains(""), Is.False);
        }
Exemplo n.º 7
0
        public void TestCAddShortWordLookItUp()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("i");
            Assert.That(t.Contains("i"), Is.True);
        }
Exemplo n.º 8
0
        public void TestFAddEmptyAndDifferentLetterLookUpEmpty()
        {
            ITrie t = new TrieWithNoChildren();

            t = t.Add("");
            t = t.Add("i");
            t = t.Add("ice");
            t = t.Add("cream");
            Assert.That(t.Contains(""), Is.EqualTo(true));
        }
Exemplo n.º 9
0
        public void TestAEmptyContainsInvalidString()
        {
            ITrie t = new TrieWithNoChildren();

            Assert.That(t.Contains("`"), Is.False);
        }
Exemplo n.º 10
0
        public void TestAEmptyContainsNonemptyString()
        {
            ITrie t = new TrieWithNoChildren();

            Assert.That(t.Contains("word"), Is.False);
        }