use of org.geotoolkit.sml.xml.v101.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.geotoolkit.sml.xml.v101.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.geotoolkit.sml.xml.v101.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());
}
use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testHasMoreSolutions1.
public void testHasMoreSolutions1() {
StringBuffer sb = new StringBuffer();
Query q = new Query("atom_chars(prolog, Cs), member(C, Cs)");
Map<String, Term> soln;
q.open();
while (q.hasMoreSolutions()) {
soln = q.nextSolution();
sb.append(((Atom) soln.get("C")).name());
}
q.close();
assertEquals("Query#hasMoreSolutions() + Query#nextSolution() work as intended", "prolog", sb.toString());
}
use of org.geotoolkit.sml.xml.v101.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testJRef1.
public void testJRef1() {
int i = 76543;
Integer I = new Integer(i);
Query q = new Query("jpl_call(?,intValue,[],I2)", new Term[] { Term.objectToJRef(I) });
Term I2 = q.oneSolution().get("I2");
assertTrue(I2.isInteger() && I2.intValue() == i);
}
Aggregations