@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()); }
@Test public void testParseFunction() { parser.setUpToParse("BrotherOf(John)"); Term f = parser.parseFunction(); Assert.assertEquals(f, getBrotherOfFunction(new Constant("John"))); }
@Test public void testParseSimpleConstant() { parser.setUpToParse("John"); Term c = parser.parseConstant(); Assert.assertEquals(c, new Constant("John")); }
@Test(expected = RuntimeException.class) public void testNotAllowedParseLeadingIndexedVariable() { parser.setUpToParse("1x"); parser.parseVariable(); }
@Test public void testParseIndexedVariable() { parser.setUpToParse("x1"); Term v = parser.parseVariable(); Assert.assertEquals(v, new Variable("x1")); }