Esempio n. 1
0
        public HomeController()
        {
            Parser parse = new Parser(tokens);
            Node root = parse.BinaryTree.root;

            Evaluater eval = new Evaluater(root, index);
            List<string> res = eval.result.ToList<string>();
        }
Esempio n. 2
0
        public void TestAndNot()
        {
            Tokens tokens = new Tokens();
            tokens.AddToken(new ParenthesisBeginToken());
            tokens.AddToken(new WordToken("word6"));
            tokens.AddToken(new AndNotToken());
            tokens.AddToken(new WordToken("word12"));
            tokens.AddToken(new ParenthesisEndToken());

            Parser parse = new Parser(tokens);
            Node root = parse.BinaryTree.root;

            Evaluater eval = new Evaluater(root, index);
            List<string> res = eval.result.ToList<string>();
            Assert.IsNotNull(res);
            Assert.Contains("doc2", res);
            Assert.AreEqual(1, res.Count);
        }
Esempio n. 3
0
        public void TestOr()
        {
            Tokens tokens = new Tokens();
            tokens.AddToken(new WordToken("word1"));
            tokens.AddToken(new WordToken("word2"));
            tokens.AddToken(new WordToken("word4"));
            tokens.AddToken(new WordToken("word6"));
            tokens.AddToken(new WordToken("word8"));

            Parser parse = new Parser(tokens);
            Node root = parse.BinaryTree.root;

            Evaluater eval = new Evaluater(root, index);
            List<string> res = eval.result.ToList<string>();
            Assert.IsNotNull(res);
            Assert.Contains("doc1", res);
            Assert.Contains("doc2", res);
            Assert.Contains("doc3", res);
            Assert.Contains("doc4", res);
            Assert.Contains("doc6", res);
            Assert.AreEqual(5, res.Count);
            Assert.AreNotEqual(2, res.Count);
        }