use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testCompoundZeroArity1.
public void testCompoundZeroArity1() {
Term t = new Compound("foo", new Term[] {});
assertTrue(t.isCompound());
assertFalse(t.isAtom());
assertTrue(t.name().equals("foo"));
assertTrue(t.arity() == 0);
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testCompoundZeroArity2.
public void testCompoundZeroArity2() {
Term t = Query.oneSolution("T = foo()").get("T");
// System.out.println("type = " + t.typeName());
assertTrue(t.name().equals("foo"));
assertTrue(t.arity() == 0);
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testBigInteger2.
public void testBigInteger2() {
BigInteger b = new BigInteger("12345678901234567890123456789");
// too big for a long
Term i = new Integer(b);
Term g = new Compound("is", new Term[] { new Variable("X"), i });
Term x = Query.oneSolution(g).get("X");
assertTrue("X is an org.jpl7.Integer", x.isInteger());
assertTrue("X is a big org.jpl7.Integer", x.isBigInteger());
assertTrue("X's value is as expected", x.bigValue().equals(b));
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testJRef2.
public void testJRef2() {
int i = 76543;
Integer I = new Integer(i);
Query q = new Query("jpl_call(?,intValue,[],I2)", JPL.newJRef(I));
Term I2 = q.oneSolution().get("I2");
assertTrue(I2.isInteger() && I2.intValue() == i);
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testIsJNull3.
public void testIsJNull3() {
Term t = Query.oneSolution("X = _").get("X");
assertFalse("_ . isJNull() fails", t.isJNull());
}
Aggregations