use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestOLD method test10m.
private static void test10m() {
String text = "append(Xs,Ys,[_,_,_,_,_])";
Query q = new Query(text);
Map<String, Term>[] ss = q.allSolutions();
System.err.println("test10m:");
System.err.println(" all solutions of " + text);
for (int i = 0; i < ss.length; i++) {
System.err.println(" " + Util.toString(ss[i]));
}
System.err.println();
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestOLD method test10q.
private static void test10q() {
System.err.println("test10q:");
System.err.println((new Compound("Bad Name", new Term[] { new Atom("3 3") })).toString());
System.err.println();
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testStringXput2.
public void testStringXput2() {
String s1 = "\u0000\u007F\u0080\u00FF";
String s2 = "\u0100\u7FFF\u8000\uFFFF";
// concatenate in Java
String s = s1 + s2;
// concatenate
Term a = Query.oneSolution("string_concat(?,?,S)", new Term[] { new Atom(s1), new Atom(s2) }).get("S");
// in
// Prolog
assertEquals(s, a.name());
assertEquals("string", a.atomType());
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testEmptyParentheses.
// the tests; all public void test*()
// public void testInfo() {
// Term swi = Query.oneSolution("current_prolog_flag(version_data,Swi)").get("Swi");
// System.out.println("version = " + swi.arg(1) + "." + swi.arg(2) + "." + swi.arg(3));
// System.out.println("syntax = " + Query.oneSolution("jpl:jpl_pl_syntax(Syntax)").get("Syntax"));
// System.out.println("jpl.jar = " + JPL.version_string() + " " + JPL.jarPath());
// System.out.println("jpl.dll = " + Prolog.get_c_lib_version());
// System.out.println("jpl.pl = " + Query.oneSolution("jpl:jpl_pl_lib_version(V)").get("V").name() + " "
// + Query.oneSolution("module_property(jpl, file(F))").get("F").name());
// System.out.println("home = " + Query.oneSolution("current_prolog_flag(home,Home)").get("Home").name());
// }
public void testEmptyParentheses() {
// valid in both
Term t = Query.oneSolution("T = a()").get("T");
// traditional and
// modern syntax in SWI
// Prolog 7.x
assertTrue("T is not bound to an atom", t.isAtom());
assertTrue("the atom's name is not \"a\"", t.name().equals("a"));
}
use of org.jpl7.Term in project packages-jpl by SWI-Prolog.
the class TestJUnit method testStringXput1.
public void testStringXput1() {
Term a = Query.oneSolution("string_concat(foo,bar,S)").get("S");
assertEquals("foobar", a.name());
assertEquals("string", a.atomType());
}
Aggregations