use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testUtilListToTermArray1.
public void testUtilListToTermArray1() {
String goal = "T = [a,b,c]";
Term list = Query.oneSolution(goal).get("T");
Term[] array = Util.listToTermArray(list);
assertTrue(array[2].isAtom() && array[2].name().equals("c"));
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testIsJTrue3.
public void testIsJTrue3() {
Term t = Query.oneSolution("X = _").get("X");
assertFalse("_ . isJTrue() fails", t.isJTrue());
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testWouter1.
public void testWouter1() {
// Wouter says this fails under OS X Mavericks
// 10.9 x86-64
// too big for an int
long n = 7381783232223l;
Compound term = new Compound("is", new Term[] { new Variable("X"), new org.jpl7.Integer(n) });
Map<String, Term>[] solutions = new Query(term).allSolutions();
assertEquals(1, solutions.length);
Map<String, Term> solution = solutions[0];
assertTrue(solution.containsKey("X"));
Object result = solution.get("X");
assertTrue(result instanceof org.jpl7.Integer);
assertEquals(n, ((org.jpl7.Integer) result).longValue());
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testIsJTrue1.
public void testIsJTrue1() {
Term t = Query.oneSolution("X = @(true)").get("X");
assertTrue("@(true) . isJTrue() succeeds", t.isJTrue());
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testIsJTrue4.
public void testIsJTrue4() {
Term t = Query.oneSolution("X = @(false)").get("X");
assertFalse("@(false) . isJTrue() fails", t.isJTrue());
}
Aggregations