New test
This commit is contained in:
parent
9fce3c6963
commit
ca987f9020
26
collects/tests/schelog/fac.rkt
Normal file
26
collects/tests/schelog/fac.rkt
Normal file
|
@ -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)
|
Loading…
Reference in New Issue
Block a user