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>(); }
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); }
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); }