use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testJRef4.
public void testJRef4() {
Term jrefSB = Query.oneSolution("jpl_new('java.lang.StringBuffer',['abc'],SB)").get("SB");
assertTrue(jrefSB.isJRef() && ((StringBuffer) jrefSB.jrefToObject()).toString().equals("abc"));
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testIsJNull5.
public void testIsJNull5() {
Term t = Query.oneSolution("X = @(false)").get("X");
assertFalse("@(false) . isJNull() fails", t.isJNull());
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testTextToTerm1.
public void testTextToTerm1() {
String text = "fred(B,p(A))";
Term t = Util.textToTerm(text);
assertTrue("Util.textToTerm() converts \"fred(B,p(A))\" to a corresponding Term", t.hasFunctor("fred", 2) && t.arg(1).isVariable() && t.arg(1).name().equals("B") && t.arg(2).hasFunctor("p", 1) && t.arg(2).arg(1).isVariable() && t.arg(2).arg(1).name().equals("A"));
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testBigInteger1.
public void testBigInteger1() {
BigInteger a = new BigInteger(Long.toString(51L));
// 51**51, too big for a long
BigInteger b = a.pow(51);
Term x = Query.oneSolution("X is 51**51").get("X");
assertTrue("X is an org.jpl7.Integer", x.isInteger());
// System.out.println("X.bigValue() = " + x.bigValue().toString());
// System.out.println("b.bigValue() = " + b.toString());
assertTrue("X is a big integer", x.isBigInteger());
assertTrue("X's big value is 51**51", x.bigValue().equals(b));
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testIsJNull2.
public void testIsJNull2() {
Term t = Query.oneSolution("X = @(3)").get("X");
assertFalse("@(3) . isJNull() fails", t.isJNull());
}
Aggregations