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

Method test_4

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

Source from the content-addressed store, hash-verified

78 }
79
80 static void test_4() {
81 System.out.print("test 4...");
82 Variable X = new Variable("X");
83 Query q4 = new Query("p", new Term[] { X });
84 Term[] target = new Term[] { a, f_a, pair_a_b, new Variable("_") };
85 Map<String, Term>[] solutions = q4.allSolutions();
86 if (solutions.length != 4) {
87 System.out.println("p(X) failed:");
88 System.out.println("\tExpected: 4 solutions");
89 System.out.println("\tGot: " + solutions.length);
90 // System.exit(1);
91 }
92 for (int i = 0; i < solutions.length - 1; ++i) {
93 Term binding = solutions[i].get("X");
94 if (!binding.equals(target[i])) {
95 System.out.println("p(X) failed");
96 System.out.println("\tExpected: " + target[i]);
97 System.out.println("\tGot: " + binding);
98 // System.exit(1);
99 }
100 }
101 System.out.println("passed");
102 }
103
104 static void test_5() {
105 System.out.print("test 5...");

Callers 1

run_testsMethod · 0.95

Calls 2

allSolutionsMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected