()
| 102 | } |
| 103 | |
| 104 | static void test_5() { |
| 105 | System.out.print("test 5..."); |
| 106 | Variable X = new Variable("X"); |
| 107 | Variable Y = new Variable("Y"); |
| 108 | Query q5 = new Query("p", new Term[] { X, Y }); |
| 109 | Term[] x_target = new Term[] { a, a }; |
| 110 | Term[] y_target = new Term[] { a, b }; |
| 111 | Map<String, Term>[] solutions = q5.allSolutions(); |
| 112 | if (solutions.length != 2) { |
| 113 | System.out.println("p(X, Y) failed:"); |
| 114 | System.out.println("\tExpected: 2 solutions"); |
| 115 | System.out.println("\tGot: " + solutions.length); |
| 116 | // System.exit(1); |
| 117 | } |
| 118 | for (int i = 0; i < solutions.length; ++i) { |
| 119 | Term x_binding = solutions[i].get("X"); |
| 120 | if (!x_binding.equals(x_target[i])) { |
| 121 | System.out.println("p(X, Y) failed:"); |
| 122 | System.out.println("\tExpected: " + x_target[i]); |
| 123 | System.out.println("\tGot: " + x_binding); |
| 124 | // System.exit(1); |
| 125 | } |
| 126 | Term y_binding = solutions[i].get("Y"); |
| 127 | if (!y_binding.equals(y_target[i])) { |
| 128 | System.out.println("p( X, Y ) failed:"); |
| 129 | System.out.println("\tExpected: " + y_target[i]); |
| 130 | System.out.println("\tGot: " + y_binding); |
| 131 | // System.exit(1); |
| 132 | } |
| 133 | } |
| 134 | System.out.println("passed"); |
| 135 | } |
| 136 | |
| 137 | static void test_6() { |
| 138 | System.out.print("test 6..."); |
no test coverage detected