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

Method test_9

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

Source from the content-addressed store, hash-verified

220 static Term test_9_solution = Term.termArrayToList(new Term[] { new Compound("-", new Term[] { a, a }), new Compound("-", new Term[] { a, b }) });
221
222 static void test_9() {
223 System.out.print("test 9...");
224 String t9 = "bagof(X-Y, p(X,Y), XYs)";
225 Map<String, Term>[] solutions = Query.allSolutions(t9);
226 if (solutions.length != 1) {
227 System.out.println(t9 + " failed:");
228 System.out.println("\tExpected: 1 solution");
229 System.out.println("\tGot: " + solutions.length);
230 // System.exit(1);
231 }
232 Term term = solutions[0].get("XYs");
233 if (!term.isListPair()) {
234 System.out.println(t9 + " failed:");
235 System.out.println("\tExpected: XYs to be a List");
236 System.out.println("\tGot: " + term);
237 // System.exit(1);
238 }
239 if (!term.equals(test_9_solution)) {
240 System.out.println(t9 + " failed:");
241 System.out.println("\tExpected: " + test_9_solution);
242 System.out.println("\tGot: " + term);
243 // System.exit(1);
244 }
245 System.out.println("passed");
246 }
247
248 static void test_10() {
249 System.out.print("test 10...");

Callers 1

run_testsMethod · 0.95

Calls 3

allSolutionsMethod · 0.95
isListPairMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected