]> Repositorios git - scryer-prolog.git/commitdiff
add tests
authorMark Thom <[email protected]>
Thu, 25 May 2017 20:46:48 +0000 (14:46 -0600)
committerMark Thom <[email protected]>
Thu, 25 May 2017 20:46:48 +0000 (14:46 -0600)
README.md
src/main.rs

index 795baa17e45e3724c8639b28b2713d79554d73b0..7502880067c67ffb0a1234acf769bc563de94aaa 100644 (file)
--- a/README.md
+++ b/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). 
+* 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
index 788faa9297149aedf8a24dcec1de4032922418c5..5bfac5db01039370166f99ccaaad22f3eee91c0b 100644 (file)
@@ -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);        
     }
 }