add more tests

This commit is contained in:
Mark Thom
2018-09-24 22:47:01 -06:00
parent af5f08ddb2
commit 5e30fa6264

View 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 | _]"]]);
}