Ejemplo n.º 1
0
  @Test
  public void testParseMultiArityFunctionEquality() {
    parser.setUpToParse("LegsOf(John,Saladin,Richard)");
    Term f = parser.parseFunction();

    parser.setUpToParse("LegsOf(John,Saladin,Richard)");
    Term f2 = parser.parseFunction();
    Assert.assertEquals(f, f2);
    Assert.assertEquals(3, ((Function) f).getTerms().size());
  }
Ejemplo n.º 2
0
 @Test
 public void testParseFunction() {
   parser.setUpToParse("BrotherOf(John)");
   Term f = parser.parseFunction();
   Assert.assertEquals(f, getBrotherOfFunction(new Constant("John")));
 }
Ejemplo n.º 3
0
 @Test
 public void testParseSimpleConstant() {
   parser.setUpToParse("John");
   Term c = parser.parseConstant();
   Assert.assertEquals(c, new Constant("John"));
 }
Ejemplo n.º 4
0
 @Test(expected = RuntimeException.class)
 public void testNotAllowedParseLeadingIndexedVariable() {
   parser.setUpToParse("1x");
   parser.parseVariable();
 }
Ejemplo n.º 5
0
 @Test
 public void testParseIndexedVariable() {
   parser.setUpToParse("x1");
   Term v = parser.parseVariable();
   Assert.assertEquals(v, new Variable("x1"));
 }