]> Repositorios git - scryer-prolog.git/commitdiff
add more tests
authorMark Thom <[email protected]>
Tue, 25 Sep 2018 04:47:01 +0000 (22:47 -0600)
committerMark Thom <[email protected]>
Tue, 25 Sep 2018 04:47:01 +0000 (22:47 -0600)
src/tests.rs

index 4d0dd215fb7a6d0f071dee9d5aa2a060e2d9211b..0afcd720466ee3b078c90a27d0395a9dc10606ec 100644 (file)
@@ -2024,4 +2024,24 @@ fn test_queries_on_string_lists()
                             ["X = [a, b, c | _]", "Y = _"]]);
 
     assert_prolog_failure!(&mut wam, "?- partial_string(\"abc\", X), partial_string(\"bc\", Y), X = [a | Y].");
+
+    submit(&mut wam, "matcher([a|X], X) :- matcher2(X, _).
+                      matcher([b|X], X) :- matcher2(X, _).
+
+                      matcher2([c|X], X).
+                      matcher2([d|X], X).");
+
+    assert_prolog_success!(&mut wam, "?- partial_string(\"\", X), matcher(X, Y).",
+                           [["X = [a, c | _]", "Y = [c | _]"],
+                            ["X = [a, d | _]", "Y = [d | _]"],
+                            ["X = [b, c | _]", "Y = [c | _]"],
+                            ["X = [b, d | _]", "Y = [d | _]"]]);
+    assert_prolog_success!(&mut wam, "?- partial_string(\"a\", X), matcher(X, Y).",
+                           [["X = [a, c | _]", "Y = [c | _]"],
+                            ["X = [a, d | _]", "Y = [d | _]"]]);
+    assert_prolog_success!(&mut wam, "?- partial_string(\"b\", X), matcher(X, Y).",
+                           [["X = [b, c | _]", "Y = [c | _]"],
+                            ["X = [b, d | _]", "Y = [d | _]"]]);
+    assert_prolog_success!(&mut wam, "?- partial_string(\"bc\", X), matcher(X, Y).",
+                           [["X = [b, c | _]", "Y = [c | _]"]]);
 }