Add test for with-db
This commit is contained in:
15
test.scm
15
test.scm
@@ -199,4 +199,17 @@
|
||||
(define get-solution (?- (zebra ? ?water-drinker ?zebra-owner)))
|
||||
(define solution (get-solution))
|
||||
(assert-equal 'norwegian (assq-ref solution '?water-drinker))
|
||||
(assert-equal 'japanese (assq-ref solution '?zebra-owner))))
|
||||
(assert-equal 'japanese (assq-ref solution '?zebra-owner)))
|
||||
(define-test "with-db"
|
||||
(define my-db '())
|
||||
(define get-solution #f)
|
||||
(define solution #f)
|
||||
(with-db my-db
|
||||
(<- (foo bar)))
|
||||
(set! get-solution (?- (foo ?x)))
|
||||
(set! solution (get-solution))
|
||||
(assert-equal #f (assq-ref solution '?x))
|
||||
(with-db my-db
|
||||
(set! get-solution (?- (foo ?x)))
|
||||
(set! solution (get-solution)))
|
||||
(assert-equal 'bar (assq-ref solution '?x))))
|
||||
|
||||
Reference in New Issue
Block a user