add tests
This commit is contained in:
10
README.md
10
README.md
@@ -17,19 +17,21 @@ Extend rusty-wam to include the following, among other features:
|
||||
|
||||
* call/N as a built-in meta-predicate (_done_).
|
||||
* ISO Prolog compliant throw/catch.
|
||||
* Support for built-in and user-defined operators of all fixities,
|
||||
* Built-in and user-defined operators of all fixities,
|
||||
with custom associativity and precedence.
|
||||
* Bignum and floating point arithmetic.
|
||||
* Standard built-in control operators (`;`, `->`, etc.).
|
||||
* Built-in control operators (`;`, `->`, etc.).
|
||||
* Attributed variables using the SICStus Prolog interface and
|
||||
semantics. Implementing coroutines like `dif/2`, `freeze/2`
|
||||
is easy with attributed variables.
|
||||
semantics. Adding coroutines like `dif/2`, `freeze/2`, etc.
|
||||
is straightforward with attributed variables.
|
||||
* An occurs check.
|
||||
* Built-in predicates for list processing and top-level declarative
|
||||
control (`setup_call_control/3`, `call_with_inference_limit/3`,
|
||||
etc.)
|
||||
* Mode declarations.
|
||||
* Extensions for clp(FD).
|
||||
* `if_` and related predicates, following the developments of the
|
||||
paper "Indexing `dif/2`".
|
||||
|
||||
## Tutorial
|
||||
To enter a multi-clause predicate, the brackets ":{" and "}:" are used
|
||||
|
||||
19
src/main.rs
19
src/main.rs
@@ -593,6 +593,25 @@ mod tests {
|
||||
assert_eq!(submit(&mut wam, "?- f(r, X, X)."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(r, f(X), g(Y))."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(r, j(X), h(Y))."), false);
|
||||
|
||||
submit(&mut wam, "p(one, one). p(one, two). p(two, two).");
|
||||
|
||||
assert_eq!(submit(&mut wam, "?- f(p(one), X, Y)."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(one), X, X)."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(one), one, Y)."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(one), one, two)."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(one), one, three)."), false);
|
||||
|
||||
assert_eq!(submit(&mut wam, "?- f(p(two), one, two)."), false);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(two), two, one)."), false);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(two), two, two)."), true);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(two), two, three)."), false);
|
||||
|
||||
assert_eq!(submit(&mut wam, "?- f(p(three), X, Y)."), false);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(three), X, X)."), false);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(three), one, Y)."), false);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(three), one, two)."), false);
|
||||
assert_eq!(submit(&mut wam, "?- f(p(three), one, three)."), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user