Exemplo n.º 1
0
        public void GetTermsWithMultipleBranchesTest()
        {
            var searchTerms = new[] { "LIVERPOOL", "LIVERPOOL LIME STREET" };
            var trie = new TrieCol(searchTerms);

            var output = searchTerms;

            var result = trie.Find("L");

            Assert.IsNotNull(result);
            Assert.AreEqual(output.Count(), output.Where(result.Contains).Count());
        }
Exemplo n.º 2
0
        public void GetPartialTermTest()
        {
            var searchTerms = new[] { "DAR" };
            var trie = new TrieCol(searchTerms);

            var output = searchTerms;

            var result = trie.Find("DA");

            Assert.IsNotNull(result);
            Assert.AreEqual(output.Count(), output.Where(result.Contains).Count());
        }
Exemplo n.º 3
0
        public void GetPartialTermWithMultipleBranchesTest()
        {
            var searchTerms = new[] { "DARTFORD", "DARTMOUTH" };
            var trie = new TrieCol(searchTerms);

            var output = searchTerms;

            var result = trie.Find("DAR");

            Assert.IsNotNull(result);
            Assert.AreEqual(output.Count(), output.Where(result.Contains).Count());
        }
Exemplo n.º 4
0
        public void MultipleTermsByPrefixTest()
        {
            var searchTerms = new[] { "DAR", "TOW" };
            var trie = new TrieCol();
            var output = searchTerms;

            trie.Add(searchTerms);
            var result = trie.GetAllSearchTerms();

            Assert.IsNotNull(result);
            Assert.AreEqual(output.Count(), output.Where(result.Contains).Count());
        }
Exemplo n.º 5
0
        public void SingleCharTest()
        {
            var searchTerms = new[] { "D" };
            var trie = new TrieCol();
            var output = searchTerms;

            trie.Add(searchTerms);
            var result = trie.GetAllSearchTerms();

            Assert.IsNotNull(result);
            Assert.AreEqual(output.Count(), output.Where(result.Contains).Count());
        }