diff --git a/collects/tests/schelog/fac.rkt b/collects/tests/schelog/fac.rkt new file mode 100644 index 0000000000..29debcb7d5 --- /dev/null +++ b/collects/tests/schelog/fac.rkt @@ -0,0 +1,26 @@ +#lang racket +(require schelog tests/eli-tester) + +(define %factorial + (%rel (x y x1 y1) + [(0 1) !] + [(x y) (%< x 0) ! %fail] + [(x y) (%is x1 (- x 1)) + (%factorial x1 y1) + (%is y (* y1 x))])) + +(test + (%which () + (%factorial 0 1)) + => empty + (%more) + => #f + + (%which () + (%factorial -1 1)) + => #f + (%which (x) + (%factorial 3 x)) + => `((x 6)) + (%more) + => #f) \ No newline at end of file