MCPcopy Create free account
hub / github.com/SWI-Prolog/packages-jpl / test_11

Method test_11

src/examples/java/test/Test.java:264–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262 }
263
264 static void test_11() {
265 System.out.print("test 11...");
266 Term tuple = new Compound("t", new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
267 try {
268 Variable X = new Variable("X");
269 Query q11 = new Query("tuple", new Term[] { X });
270 Term result = q11.oneSolution().get("X");
271 if (result == null || !result.equals(tuple)) {
272 System.out.println("failed:");
273 System.out.println("\tresult: " + result);
274 System.out.println("\ttuple: " + tuple);
275 // System.exit(1);
276 }
277 if (result.arg(1) == null || !result.arg(1).equals(new Atom("a"))) {
278 System.out.println("failed:");
279 System.out.println("\tresult.arg(1): " + result.arg(1));
280 // System.exit(1);
281 }
282 if (result.arg(2) == null || !result.arg(2).equals(new Atom("b"))) {
283 System.out.println("failed:");
284 System.out.println("\tresult.arg(2): " + result.arg(2));
285 // System.exit(1);
286 }
287 if (result.arg(5) == null || !result.arg(5).equals(new Atom("e"))) {
288 System.out.println("failed:");
289 System.out.println("\tresult.arg(5): " + result.arg(5));
290 // System.exit(1);
291 }
292 // arg0(6) throws an exception, as I'd expect it to...
293 // if ( ((Compound)result).arg( 7 ) != null ){
294 // System.out.println( "failed:" );
295 // System.out.println( "\t((Compound)result).arg( 7 ): " + ((Compound)result).arg( 7 ) );
296 // System.out.println( "\tshould be null" );
297 // System.exit( 1 );
298 // }
299 } catch (PrologException e) {
300 System.out.println("failed");
301 e.printStackTrace();
302 // System.exit(1);
303 }
304 System.out.println("passed");
305 }
306
307 static void test_101() {
308 System.out.print("test 101...");

Callers 1

run_testsMethod · 0.95

Calls 3

oneSolutionMethod · 0.95
argMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected