| 202 | } |
| 203 | |
| 204 | static void test_8() { |
| 205 | System.out.print("test 8..."); |
| 206 | // Variable X = new Variable("X"); |
| 207 | // Query query = new Query("r", new Term[] { new Compound("f", new Term[] { X, X }), X }); |
| 208 | String t8 = "r(f(X,X), X)"; |
| 209 | Map<String, Term>[] solutions = Query.allSolutions(t8); |
| 210 | if (solutions.length != 2) { |
| 211 | System.out.println(t8 + " failed:"); |
| 212 | System.out.println("\tExpected: 2 solutions"); |
| 213 | System.out.println("\tGot: " + solutions.length); |
| 214 | // System.exit(1); |
| 215 | } |
| 216 | System.out.println("passed"); |
| 217 | } |
| 218 | |
| 219 | // corresponds with Prolog List: [a-a,a-b] |
| 220 | static Term test_9_solution = Term.termArrayToList(new Term[] { new Compound("-", new Term[] { a, a }), new Compound("-", new Term[] { a, b }) }); |