public void PL1_Conjunction_Atoms() { string atom = "Tet(a) \u2227 Tet(b)"; Conjunction conjunction = PL1Parser.Parse(atom) as Conjunction; Assert.IsNotNull(conjunction); Predicate predicate = conjunction.Arguments[0] as Predicate; Assert.IsNotNull(predicate); Assert.AreEqual(predicate.Name, "Tet"); Constant constant = predicate.Arguments[0] as Constant; Assert.IsNotNull(constant); Assert.AreEqual(constant.Name, "a"); predicate = conjunction.Arguments[1] as Predicate; Assert.IsNotNull(predicate); Assert.AreEqual(predicate.Name, "Tet"); constant = predicate.Arguments[0] as Constant; Assert.IsNotNull(constant); Assert.AreEqual(constant.Name, "b"); }
public void PL1_Predicate_Whitespaces() { string atom = "Tet( a )"; Predicate predicate = PL1Parser.Parse(atom) as Predicate; Assert.AreEqual(predicate.Name, "Tet"); Constant constant = predicate.Arguments[0] as Constant; Assert.IsNotNull(constant); Assert.AreEqual(constant.Name, "a"); }
public Game(string sentence, AWorld world, bool guess) { _sentence = sentence; _world = world; _guess = guess; try { _formula = PL1Parser.Parse(sentence); } catch (Exception e) { _formula = null; } }
public void PL1_Predicate_Multi() { string atom = "Between(a,b,c)"; Predicate predicate = PL1Parser.Parse(atom) as Predicate; Assert.AreEqual(predicate.Name, "Between"); Constant constant = predicate.Arguments[0] as Constant; Assert.IsNotNull(constant); Assert.AreEqual(constant.Name, "a"); constant = predicate.Arguments[1] as Constant; Assert.IsNotNull(constant); Assert.AreEqual(constant.Name, "b"); constant = predicate.Arguments[2] as Constant; Assert.IsNotNull(constant); Assert.AreEqual(constant.Name, "c"); }