Skip to content
This repository
Browse code

pulling in all the tests from the current version of miniKanren, refo…

…rmatting the tests directory
  • Loading branch information...
commit 188454754bf4a5f48458e08cd86c7e038da0b0aa 1 parent 71c62a6
Claire Alvis authored
8 absento.rkt
@@ -19,7 +19,9 @@
19 19 (cond
20 20 ((symbol? u) a)
21 21 ((not (var? u)) #f)
22   - (else ((update-c (build-attr-oc symbol-c u symbol-uw?)) a)))))))
  22 + ((symbol-uw? u (get-attributes u c))
  23 + ((update-c (build-attr-oc symbol-c u symbol-uw?)) a))
  24 + (else #f))))))
23 25
24 26 (define (symbol-uw? x attrs)
25 27 (define incompatible '(number-c))
@@ -56,7 +58,9 @@
56 58 (cond
57 59 ((number? u) a)
58 60 ((not (var? u)) #f)
59   - (else ((update-c (build-attr-oc number-c u number-uw?)) a)))))))
  61 + ((number-uw? u (get-attributes u c))
  62 + ((update-c (build-attr-oc number-c u number-uw?)) a))
  63 + (else #f))))))
60 64
61 65 (define number-constrained?
62 66 (lambda (v c)
9 miniKanren.rkt
@@ -2,7 +2,10 @@
2 2
3 3 ;; In order to use "basic" miniKanren
4 4 (require "ck.rkt" "tree-unify.rkt")
  5 +
5 6 (provide
  7 + (all-from-out "ck.rkt")
  8 + (all-from-out "tree-unify.rkt")
6 9 run1 run2 run3 run4
7 10 run5 run6 run7 run8
8 11 run9 run10 run11 run12
@@ -20,7 +23,7 @@
20 23 addero gen-addero pluso minuso
21 24 *o odd-*o bound-*o =lo <lo <=lo
22 25 <o <=o /o splito logo exp2
23   - repeated-mul expo prnt)
  26 + repeated-mul expo prnt zeroo)
24 27
25 28
26 29 (define-syntax run1 (syntax-rules () ((_ (x) g0 g ...) (run 1 (x) g0 g ...))))
@@ -155,6 +158,10 @@
155 158 (build-num (quotient n 2))))
156 159 ((zero? n) '()))))
157 160
  161 +(define zeroo
  162 + (lambda (n)
  163 + (== '() n)))
  164 +
158 165 (define poso
159 166 (lambda (n)
160 167 (fresh (a d)
27 test-check.rkt
... ... @@ -1,27 +0,0 @@
1   -#lang racket
2   -
3   -(require "ck.rkt")
4   -(provide test (rename-out [test test-check]) test-disable)
5   -
6   -(define errorf error)
7   -
8   -(define-syntax test
9   - (syntax-rules ()
10   - ((_ title tested-expression expected-result)
11   - (begin
12   - (printf "Testing ~s\n" title)
13   - (let* ((expected expected-result)
14   - (produced tested-expression))
15   - (cond
16   - ((equal? expected produced))
17   - (else
18   - (errorf 'test
19   - "Failed: ~a~%Expected: ~a~%Computed: ~a~%"
20   - 'tested-expression expected produced))))))))
21   -
22   -(define-syntax test-disable
23   - (syntax-rules ()
24   - ((_ title tested-expression expected-result)
25   - (begin
26   - (printf "Disable testing ~s\n" title)
27   - #t))))
49 testall.rkt
... ... @@ -1,17 +1,38 @@
1 1 #lang racket
2 2
3   -(require "tests/fdtests.rkt"
4   - "tests/neqtests.rkt"
5   - "tests/comptests.rkt"
6   - "tests/nevertruetests.rkt"
7   - "tests/preftests.rkt"
8   - "tests/aktests.rkt"
9   - "tests/mk-struct.rkt")
  3 +(require
  4 + "tests/absento.rkt"
  5 + "tests/ak.rkt"
  6 + "tests/comp.rkt"
  7 + "tests/fd.rkt"
  8 + "tests/infer.rkt"
  9 + "tests/interp.rkt"
  10 + "tests/mk-struct.rkt"
  11 + "tests/mk.rkt"
  12 + "tests/neq.rkt"
  13 + "tests/nevertrue.rkt"
  14 + "tests/numbero.rkt"
  15 + "tests/no-closure.rkt"
  16 + "tests/pref.rkt"
  17 + "tests/quines.rkt"
  18 + "tests/symbolo-numbero.rkt"
  19 + "tests/symbolo.rkt"
  20 +)
  21 +
  22 +(test-absento)
  23 +(test-ak)
  24 +(test-comp)
  25 +(test-fd)
  26 +(test-infer)
  27 +(test-interp)
  28 +(test-mk-struct)
  29 +(test-mk)
  30 +(test-neq)
  31 +(test-nevertrue)
  32 +(test-numbero)
  33 +(test-no-closure)
  34 +(test-pref)
  35 +(test-quines)
  36 +(test-symbolo)
  37 +(test-symbolo-numbero)
10 38
11   -(run-fdtests)
12   -(run-neqtests)
13   -(run-comptests)
14   -(run-nevertruetests)
15   -(run-preftests)
16   -(run-aktests)
17   -(run-mk-struct-tests)
625 tests/absento-long.rkt
... ... @@ -1,625 +0,0 @@
1   -#lang racket
2   -
3   -(require "../ck.rkt"
4   - "../tree-unify.rkt"
5   - "../absento.rkt"
6   - "../neq.rkt"
7   - "../test-check.rkt")
8   -
9   -(reify-with-colon #f)
10   -(reify-prefix-dot #f)
11   -
12   -(test-check "test 0"
13   - (run* (q) (absento q q))
14   - '())
15   -
16   -(test-check "test 1"
17   - (run* (q)
18   - (fresh (a b c)
19   - (== a b)
20   - (absento b c)
21   - (== c b)
22   - (== `(,a ,b ,c) q)))
23   - '())
24   -
25   -(test-check "test 2"
26   - (run* (q)
27   - (fresh (a)
28   - (absento q a)
29   - (absento `((,q ,q) 3 (,q ,q)) `(,a 3 ,a))))
30   - '(_.0))
31   -
32   -(test-check "test 3"
33   - (run* (q)
34   - (fresh (a b)
35   - (absento q a)
36   - (absento `(3 ,a) `(,b ,a))
37   - (== 3 b)))
38   - '())
39   -
40   -(test-check "test 4"
41   - (run* (q)
42   - (fresh (a b)
43   - (absento q a)
44   - (absento `(3 ,a) `(,q ,a))
45   - (== 3 b)))
46   - '((_.0 (=/= ((_.0 3))))))
47   -
48   -(test-check "test 5"
49   - (run* (q)
50   - (fresh (a b)
51   - (numbero a)
52   - (numbero b)
53   - (absento '(3 3) `(,a ,b))
54   - (=/= a b)
55   - (== `(,a ,b) q)))
56   - '(((_.0 _.1) (=/= ((_.0 _.1))) (num _.0 _.1))))
57   -
58   -(test-check "test 6"
59   - (run* (q) (fresh (a) (absento q a) (== q a)))
60   - '())
61   -
62   -(test-check "test 7"
63   - (run* (q)
64   - (fresh (a b c)
65   - (absento '(3 . 4) c)
66   - (== `(,a . ,b) c)
67   - (== q `(,a . ,b))))
68   - '(((_.0 . _.1) (=/= ((_.0 3) (_.1 4))) (absento ((3 . 4) _.0) ((3 . 4) _.1)))))
69   -
70   -(test-check "test 8"
71   - (run* (q)
72   - (fresh (a b)
73   - (absento 5 a)
74   - (symbolo b)
75   - (== `(,q ,b) a)))
76   - '((_.0 (absento (5 _.0)))))
77   -
78   -(test-check "test 9"
79   - (run* (q)
80   - (fresh (a b)
81   - (absento 5 a)
82   - (== `(,q ,b) a)))
83   - '((_.0 (absento (5 _.0)))))
84   -
85   -(test-check "test 10"
86   - (run* (q) (fresh (a) (absento `(3 . ,a) q) (absento q `(3 . ,a))))
87   - '((_.0 (=/= ((_.0 3))))))
88   -
89   -(test-check "test 11"
90   - (run* (q)
91   - (fresh (a b c d e f)
92   - (absento `(,a . ,b) q)
93   - (absento q `(,a . ,b))
94   - (== `(,c . ,d) a)
95   - (== `(3 . ,e) c)
96   - (== `(,f . 4) d)))
97   - '((_.0 (=/= ((_.0 3)) ((_.0 4))))))
98   -
99   -(test-check "test 12"
100   - (run* (q)
101   - (fresh (a b c)
102   - (absento `(,3 . ,a) `(,b . ,c))
103   - (numbero b)
104   - (== `(,a ,b ,c) q)))
105   - '(((_.0 _.1 _.2) (=/= ((_.0 _.2) (_.1 3))) (absento ((3 . _.0) _.2)) (num _.1))))
106   -
107   -(test-check "test 13"
108   - (run* (q)
109   - (fresh (a b c)
110   - (== `(,a . ,b) q)
111   - (absento '(3 . 4) q)
112   - (numbero a)
113   - (numbero b)))
114   - '(((_.0 . _.1) (=/= ((_.0 3) (_.1 4))) (num _.0 _.1))))
115   -
116   -(test-check "test 14"
117   - (run* (q)
118   - (fresh (a b)
119   - (absento '(3 . 4) `(,a . ,b))
120   - (== `(,a . ,b) q)))
121   - '(((_.0 . _.1) (=/= ((_.0 3) (_.1 4))) (absento ((3 . 4) _.0) ((3 . 4) _.1)))))
122   -
123   -(test-check "test 15"
124   - (run* (q)
125   - (absento q `(3 . (4 . 5))))
126   - '((_.0 (=/= ((_.0 3))
127   - ((_.0 4))
128   - ((_.0 5))
129   - ((_.0 (3 . (4 . 5))))
130   - ((_.0 (4 . 5)))))))
131   -
132   -(test-check "test 16"
133   - (run* (q)
134   - (fresh (a b x)
135   - (absento a b)
136   - (symbolo a)
137   - (numbero x)
138   - (== x b)
139   - (== `(,a ,b) q)))
140   - '(((_.0 _.1) (num _.1) (sym _.0))))
141   -
142   -(test-check "test 17"
143   - (run* (q) (absento 'tag1 q) (absento 'tag2 q))
144   - '((_.0 (absento (tag1 _.0) (tag2 _.0)))))
145   -
146   -(test-check "test 18"
147   - (run* (q) (absento 'tag q) (numbero q))
148   - '((_.0 (num _.0))))
149   -
150   -(test-check "test 19"
151   - (run* (q) (absento 5 q) (absento 5 q))
152   - '((_.0 (absento (5 _.0)))))
153   -
154   -(test-check "test 20"
155   - (run* (q) (absento 5 q) (absento 6 q))
156   - '((_.0 (absento (5 _.0) (6 _.0)))))
157   -
158   -(test-check "test 21"
159   - (run* (q) (absento 5 q) (symbolo q))
160   - '((_.0 (sym _.0))))
161   -
162   -(test-check "test 22"
163   - (run* (q) (numbero q) (absento 'tag q))
164   - '((_.0 (num _.0))))
165   -
166   -(test-check "test 23"
167   - (run* (q) (absento 'tag q) (numbero q))
168   - '((_.0 (num _.0))))
169   -
170   -(test-check "test 24"
171   - (run* (q) (== 5 q) (absento 5 q))
172   - '())
173   -
174   -(test-check "test 25"
175   - (run* (q) (== q `(5 6)) (absento 5 q))
176   - '())
177   -
178   -(test-check "test 26"
179   - (run* (q) (== 5 q) (absento 5 q))
180   - '())
181   -
182   -(test-check "test 27"
183   - (run* (q) (absento 'tag1 q) (absento 'tag2 q))
184   - '((_.0 (absento (tag1 _.0) (tag2 _.0)))))
185   -
186   -(test-check "test 28"
187   - (run* (q) (absento 'tag q) (numbero q))
188   - '((_.0 (num _.0))))
189   -
190   -(test-check "test 29"
191   - (run* (q)
192   - (fresh (a b)
193   - (absento a b)
194   - (absento b a)
195   - (== `(,a ,b) q)
196   - (symbolo a)
197   - (numbero b)))
198   - '(((_.0 _.1) (num _.1) (sym _.0))))
199   -
200   -(test-check "test 30"
201   - (run* (q)
202   - (fresh (a b)
203   - (absento b a)
204   - (absento a b)
205   - (== `(,a ,b) q)
206   - (symbolo a)
207   - (symbolo b)))
208   - '(((_.0 _.1) (=/= ((_.0 _.1))) (sym _.0 _.1))))
209   -
210   -(test-check "test 31"
211   - (run* (q)
212   - (fresh (a b)
213   - (absento a b)
214   - (absento b a)
215   - (== `(,a ,b) q)))
216   - '(((_.0 _.1) (absento (_.0 _.1) (_.1 _.0)))))
217   -
218   -(test-check "test 32"
219   - (run* (q)
220   - (fresh (a b)
221   - (absento 5 a)
222   - (absento 5 b)
223   - (== `(,a . ,b) q)))
224   - '(((_.0 . _.1) (absento (5 _.0) (5 _.1)))))
225   -
226   -(test-check "test 33"
227   - (run* (q)
228   - (fresh (a b c)
229   - (== `(,a ,b) c)
230   - (== `(,c ,c) q)
231   - (symbolo b)
232   - (numbero c)))
233   - '())
234   -
235   -(test-check "test 34"
236   - (run* (q) (absento 'tag q) (symbolo q))
237   - '((_.0 (=/= ((_.0 tag))) (sym _.0))))
238   -
239   -(test-check "test 35"
240   - (run* (q) (absento 5 q) (numbero q))
241   - '((_.0 (=/= ((_.0 5))) (num _.0))))
242   -
243   -(test-check "test 36"
244   - (run* (q)
245   - (fresh (a)
246   - (== 5 a) (absento a q)))
247   - '((_.0 (absento (5 _.0)))))
248   -
249   -(test-check "test 37"
250   - (run* (q)
251   - (fresh (a b)
252   - (absento a b)
253   - (absento b a)
254   - (== `(,a ,b) q)
255   - (symbolo a)
256   - (symbolo b)))
257   - '(((_.0 _.1) (=/= ((_.0 _.1))) (sym _.0 _.1))))
258   -
259   -(test-check "test 38"
260   - (run* (q) (absento '() q))
261   - '((_.0 (absento (() _.0)))))
262   -
263   -(test-check "test 39"
264   - (run* (q) (absento `(3 4) q))
265   - '((_.0 (absento ((3 4) _.0)))))
266   -
267   -(test-check "test 40"
268   - (run* (q)
269   - (fresh (d a c)
270   - (== `(3 . ,d) q)
271   - (=/= `(,c . ,a) q)
272   - (== '(3 . 4) d)))
273   - '((3 3 . 4)))
274   -
275   -(test-check "test 41"
276   - (run* (q)
277   - (fresh (a)
278   - (== `(,a . ,a) q)))
279   - '((_.0 . _.0)))
280   -
281   -(test-check "test 42"
282   - (run* (q)
283   - (fresh (a b)
284   - (== `((3 4) (5 6)) q)
285   - (absento `(3 4) q)))
286   - '())
287   -
288   -(test-check "test 43"
289   - (run* (q) (absento q 3))
290   - '((_.0 (=/= ((_.0 3))))))
291   -
292   -(test-check "test 44"
293   - (run* (q)
294   - (fresh (a b)
295   - (absento a b)
296   - (absento b a)
297   - (== `(,a ,b) q)))
298   - '(((_.0 _.1) (absento (_.0 _.1) (_.1 _.0)))))
299   -
300   -(test-check "test 45"
301   - (run* (q)
302   - (fresh (a b)
303   - (absento `(,a . ,b) q)
304   - (== q `(3 . (,b . ,b)))))
305   - '((3 _.0 . _.0)))
306   -
307   -(test-check "test 45b"
308   - (run* (q)
309   - (fresh (a b)
310   - (absento `(,a . ,b) q)
311   - (== q `(,a 3 . (,b . ,b)))))
312   - '(((_.0 3 _.1 . _.1) (=/= ((_.0 _.1))))))
313   -
314   -(test-check "test 46"
315   - (run* (q)
316   - (fresh (a)
317   - (absento a q)
318   - (absento q a)))
319   - '(_.0))
320   -
321   -(test-check "test 47"
322   - (run* (q)
323   - (fresh (a)
324   - (absento `(,a . 3) q)))
325   - '(_.0))
326   -
327   -(test-check "test 48"
328   - (run* (q)
329   - (fresh (a)
330   - (absento `(,a . 3) q)))
331   - '(_.0))
332   -
333   -(test-check "test 49"
334   - (run* (q)
335   - (fresh (a b c d e)
336   - (absento `((3 4 ,a) (4 ,b) ((,c)) ,d ,e) q)))
337   - '(_.0))
338   -
339   -(test-check "test 50"
340   - (run* (q) (fresh (a)
341   - (absento a q)
342   - (== 5 a)))
343   - '((_.0 (absento (5 _.0)))))
344   -
345   -(test-check "test 51"
346   - (run* (q) (fresh (a b c d)
347   - (== a 5)
348   - (== a b)
349   - (== b c)
350   - (absento d q)
351   - (== c d)))
352   - '((_.0 (absento (5 _.0)))))
353   -
354   -(test-check "test 52"
355   - (run* (q) (fresh (a b c d)
356   - (== a b)
357   - (== b c)
358   - (absento a q)
359   - (== c d)
360   - (== d 5)))
361   - '((_.0 (absento (5 _.0)))))
362   -
363   -(test-check "test 53"
364   - (run* (q)
365   - (fresh (t1 t2 a)
366   - (== `(,a . 3) t1)
367   - (== `(,a . (4 . 3)) t2)
368   - (== `(,t1 ,t2) q)
369   - (absento t1 t2)))
370   - '((((_.0 . 3) (_.0 4 . 3)) (=/= ((_.0 4))))))
371   -
372   -(test-check "test 54"
373   - (run* (q)
374   - (fresh (a)
375   - (== `(,a . 3) q)
376   - (absento q `(,a . (4 . 3)))))
377   - '(((_.0 . 3) (=/= ((_.0 4))))))
378   -
379   -(test-check "test 55"
380   - (run* (q) (fresh (a d c)
381   - (== '(3 . 4) d)
382   - (absento `(3 . 4) q)
383   - (== `(3 . ,d) q)))
384   - '())
385   -
386   -(test-check "test 56"
387   - (run* (q) (fresh (a b)
388   - (absento a b)
389   - (absento b a)
390   - (== `(,a ,b) q)
391   - (symbolo a)
392   - (numbero b)))
393   - '(((_.0 _.1) (num _.1) (sym _.0))))
394   -
395   -
396   -(test-check "test 57"
397   - (run* (q)
398   - (numbero q)
399   - (absento q 3))
400   - '((_.0 (=/= ((_.0 3))) (num _.0))))
401   -
402   -
403   -(test-check "test 58"
404   - (run* (q)
405   - (fresh (a)
406   - (== `(,a . 3) q)
407   - (absento q `(,a . (4 . (,a . 3))))))
408   - '())
409   -
410   -(test-check "test 59"
411   - (run* (q)
412   - (fresh (a)
413   - (== `(,a . 3) q)
414   - (absento q `(,a . ((,a . 3) . (,a . 4))))))
415   - '())
416   -
417   -(test-check "test 60"
418   - (run* (q)
419   - (fresh (a d c)
420   - (== `(3 . ,d) q)
421   - (== '(3 . 4) d)
422   - (absento `(3 . 4) q)))
423   - '())
424   -
425   -(test-check "test 61"
426   - (run* (q)
427   - (fresh (a b c)
428   - (symbolo b)
429   - (absento `(,3 . ,a) `(,b . ,c))
430   - (== `(,a ,b ,c) q)))
431   - '(((_.0 _.1 _.2) (absento ((3 . _.0) _.2)) (sym _.1))))
432   -
433   -(test-check "test 62"
434   - (run* (q) (fresh (a b c) (absento a b) (absento b c) (absento c q) (symbolo a)))
435   - '(_.0))
436   -
437   -(test-check "test 63"
438   - (run* (q) (fresh (a b c) (=/= a b) (=/= b c) (=/= c q) (symbolo a)))
439   - '(_.0))
440   -
441   -(test-check "test 64"
442   - (run* (q) (symbolo q) (== 'tag q))
443   - '(tag))
444   -
445   -(test-check "test 65"
446   - (run* (q) (fresh (b) (absento '(3 4) `(,q ,b))))
447   - '((_.0 (absento ((3 4) _.0)))))
448   -
449   -(test-check "test 66"
450   - (run* (q) (absento 6 5))
451   - '(_.0))
452   -
453   -(test-check "test 67"
454   - (run* (q)
455   - (fresh (a b)
456   - (=/= a b)
457   - (symbolo a)
458   - (numbero b)
459   - (== `(,a ,b) q)))
460   - '(((_.0 _.1) (num _.1) (sym _.0))))
461   -
462   -(test-check "test 68"
463   - (run* (q)
464   - (fresh (a b c d)
465   - (=/= `(,a ,b) `(,c ,d))
466   - (symbolo a)
467   - (numbero c)
468   - (symbolo b)
469   - (numbero c)
470   - (== `(,a ,b ,c ,d) q)))
471   - '(((_.0 _.1 _.2 _.3) (num _.2) (sym _.0 _.1))))
472   -
473   -(test-check "test 69"
474   - (run* (q) (fresh (a b) (=/= `(,a . 3) `(,b . 3)) (symbolo a) (numbero b) (== `(,a ,b) q)))
475   - '(((_.0 _.1) (num _.1) (sym _.0))))
476   -
477   -(test-check "test 70"
478   - (run* (q) (fresh (a b)
479   - (absento a b)
480   - (absento b a)
481   - (== `(,a ,b) q)
482   - (symbolo a)
483   - (numbero b)))
484   - '(((_.0 _.1) (num _.1) (sym _.0))))
485   -
486   -
487   -(test-check "test 71"
488   - (run* (q) (fresh (a b)
489   - (absento a b)
490   - (absento b a)
491   - (== `(,a ,b) q)
492   - (symbolo a)
493   - (symbolo b)))
494   - '(((_.0 _.1) (=/= ((_.0 _.1))) (sym _.0 _.1))))
495   -
496   -(test-check "test 72"
497   - (run* (q)
498   - (fresh (a b)
499   - (absento a b)
500   - (absento b a)
501   - (== `(,a ,b) q)))
502   - '(((_.0 _.1) (absento (_.0 _.1) (_.1 _.0)))))
503   -
504   -(test-check "test 73"
505   - (run* (q)
506   - (fresh (a b)
507   - (== `(,a ,b) q)
508   - (absento b a)
509   - (absento a b)
510   - (== a '(1 . 2))))
511   - '((((1 . 2) _.0)
512   - (=/= ((_.0 1)) ((_.0 2)))
513   - (absento ((1 . 2) _.0)))))
514   -
515   -(test-check "test 74"
516   - (run* (q)
517   - (fresh (a b c)
518   - (absento a q)
519   - (absento q a)
520   - (== `(,b . ,c) a)
521   - (== '(1 . 2) b)
522   - (== '(3 . 4) c)))
523   - '((_.0
524   - (=/= ((_.0 1)) ((_.0 2)) ((_.0 3)) ((_.0 4))
525   - ((_.0 (1 . 2))) ((_.0 (3 . 4))))
526   - (absento (((1 . 2) 3 . 4) _.0)))))
527   -
528   -(test-check "test 75"
529   - (run* (q)
530   - (fresh (a b c d e f g)
531   - (absento a q)
532   - (absento q a)
533   - (== `(,b . ,c) a)
534   - (== `(,d . ,e) b)
535   - (== `(,f . ,g) c)
536   - (== '(1 . 2) d)
537   - (== '(3 . 4) e)
538   - (== '(5 . 6) f)
539   - (== '(7 . 8) g)))
540   - '((_.0
541   - (=/= ((_.0 1))
542   - ((_.0 2))
543   - ((_.0 3))
544   - ((_.0 4))
545   - ((_.0 5))
546   - ((_.0 6))
547   - ((_.0 7))
548   - ((_.0 8))
549   - ((_.0 (1 . 2)))
550   - ((_.0 (3 . 4)))
551   - ((_.0 (5 . 6)))
552   - ((_.0 (7 . 8)))
553   - ((_.0 ((1 . 2) 3 . 4)))
554   - ((_.0 ((5 . 6) 7 . 8))))
555   - (absento ((((1 . 2) 3 . 4) (5 . 6) 7 . 8) _.0)))))
556   -
557   -(test-check "test 76"
558   - (run* (q)
559   - (absento 3 q)
560   - (absento '(3 4) q))
561   - '((_.0 (absento (3 _.0)))))
562   -
563   -(test-check "test 77"
564   - (run* (q)
565   - (fresh (x a b)
566   - (== x `(,a ,b))
567   - (absento '(3 4) x)
568   - (absento 3 a)
569   - (absento 4 b)
570   - (== q `(,a 2))))
571   - '(((_.0 2) (absento (3 _.0)))))
572   -
573   -(test-check "test 78"
574   - (run* (q)
575   - (fresh (d)
576   - (== `(3 . ,d) q)
577   - (absento `(3 . 4) q)
578   - (== '(3 . 4) d)))
579   - '())
580   -
581   -(test-check "test 79"
582   - (run* (q)
583   - (fresh (d)
584   - (absento `(3 . 4) q)
585   - (== `(3 . ,d) q)
586   - (== '(3 . 4) d)))
587   - '())
588   -
589   -(test-check "test 80"
590   - (run* (q)
591   - (fresh (d a c)
592   - (== `(3 . ,d) q)
593   - (absento `(3 . ,a) q)
594   - (== c d)
595   - (== `(3 . ,a) c)))
596   - '())
597   -
598   -(test-check "test 81"
599   - (run* (q)
600   - (fresh (a b)
601   - (absento `(3 . ,a) `(,b . 4))
602   - (== `(,a . ,b) q)))
603   - '(((_.0 . _.1) (=/= ((_.0 4) (_.1 3))) (absento ((3 . _.0) _.1)))))
604   -
605   -(test-check "test 82"
606   - (run* (q)
607   - (fresh (d)
608   - (== `(3 . ,d) q)
609   - (absento `(3 . 4) q)))
610   - '(((3 . _.0) (=/= ((_.0 4))) (absento ((3 . 4) _.0)))))
611   -
612   -(test-check "test 83"
613   - (run* (q)
614   - (fresh (d)
615   - (== `(3 . ,d) q)
616   - (== '(3 . 4) d))
617   - (absento `(3 . 4) q))
618   - '())
619   -
620   -
621   -(module+ main
622   - (require "no-closureo-tests.rkt")
623   - (require "q.rkt")
624   -)
625   -
635 tests/absento.rkt
... ... @@ -0,0 +1,635 @@
  1 +#lang racket
  2 +
  3 +(require
  4 + "../ck.rkt"
  5 + "../absento.rkt"
  6 + "../tree-unify.rkt"
  7 + "../neq.rkt"
  8 + "tester.rkt")
  9 +(provide test-absento test-absento-long)
  10 +
  11 +(define (test-absento)
  12 + (parameterize ([reify-with-colon #f]
  13 + [reify-prefix-dot #f])
  14 +
  15 + (test-check "test 0"
  16 + (run* (q) (absento q q))
  17 + '())
  18 +
  19 + (test-check "test 1"
  20 + (run* (q)
  21 + (fresh (a b c)
  22 + (== a b)
  23 + (absento b c)
  24 + (== c b)
  25 + (== `(,a ,b ,c) q)))
  26 + '())
  27 +
  28 + (test-check "test 2"
  29 + (run* (q)
  30 + (fresh (a)
  31 + (absento q a)
  32 + (absento `((,q ,q) 3 (,q ,q)) `(,a 3 ,a))))
  33 + '(_.0))
  34 +
  35 + (test-check "test 3"
  36 + (run* (q)
  37 + (fresh (a b)
  38 + (absento q a)
  39 + (absento `(3 ,a) `(,b ,a))
  40 + (== 3 b)))
  41 + '())
  42 +
  43 + (test-check "test 4"
  44 + (run* (q)
  45 + (fresh (a b)
  46 + (absento q a)
  47 + (absento `(3 ,a) `(,q ,a))
  48 + (== 3 b)))
  49 + '((_.0 (=/= ((_.0 3))))))
  50 +
  51 + (test-check "test 5"
  52 + (run* (q)
  53 + (fresh (a b)
  54 + (numbero a)
  55 + (numbero b)
  56 + (absento '(3 3) `(,a ,b))
  57 + (=/= a b)
  58 + (== `(,a ,b) q)))
  59 + '(((_.0 _.1) (=/= ((_.0 _.1))) (num _.0 _.1))))
  60 +
  61 + (test-check "test 6"
  62 + (run* (q) (fresh (a) (absento q a) (== q a)))
  63 + '())
  64 +
  65 + (test-check "test 7"
  66 + (run* (q)
  67 + (fresh (a b c)
  68 + (absento '(3 . 4) c)
  69 + (== `(,a . ,b) c)
  70 + (== q `(,a . ,b))))
  71 + '(((_.0 . _.1) (=/= ((_.0 3) (_.1 4))) (absento ((3 . 4) _.0) ((3 . 4) _.1)))))
  72 +
  73 + (test-check "test 8"
  74 + (run* (q)
  75 + (fresh (a b)
  76 + (absento 5 a)
  77 + (symbolo b)
  78 + (== `(,q ,b) a)))
  79 + '((_.0 (absento (5 _.0)))))
  80 +
  81 + (test-check "test 9"
  82 + (run* (q)
  83 + (fresh (a b)
  84 + (absento 5 a)
  85 + (== `(,q ,b) a)))
  86 + '((_.0 (absento (5 _.0)))))
  87 +
  88 + (test-check "test 10"
  89 + (run* (q) (fresh (a) (absento `(3 . ,a) q) (absento q `(3 . ,a))))
  90 + '((_.0 (=/= ((_.0 3))))))
  91 +
  92 + (test-check "test 11"
  93 + (run* (q)
  94 + (fresh (a b c d e f)
  95 + (absento `(,a . ,b) q)
  96 + (absento q `(,a . ,b))
  97 + (== `(,c . ,d) a)
  98 + (== `(3 . ,e) c)
  99 + (== `(,f . 4) d)))
  100 + '((_.0 (=/= ((_.0 3)) ((_.0 4))))))
  101 +
  102 + (test-check "test 12"
  103 + (run* (q)
  104 + (fresh (a b c)
  105 + (absento `(,3 . ,a) `(,b . ,c))
  106 + (numbero b)
  107 + (== `(,a ,b ,c) q)))
  108 + '(((_.0 _.1 _.2)
  109 + (=/= ((_.0 _.2) (_.1 3)))
  110 + (absento ((3 . _.0) _.2))
  111 + (num _.1))))
  112 +
  113 + (test-check "test 13"
  114 + (run* (q)
  115 + (fresh (a b c)
  116 + (== `(,a . ,b) q)
  117 + (absento '(3 . 4) q)
  118 + (numbero a)
  119 + (numbero b)))
  120 + '(((_.0 . _.1) (=/= ((_.0 3) (_.1 4))) (num _.0 _.1))))
  121 +
  122 + (test-check "test 14"
  123 + (run* (q)
  124 + (fresh (a b)
  125 + (absento '(3 . 4) `(,a . ,b))
  126 + (== `(,a . ,b) q)))
  127 + '(((_.0 . _.1) (=/= ((_.0 3) (_.1 4))) (absento ((3 . 4) _.0) ((3 . 4) _.1)))))
  128 +
  129 + (test-check "test 15"
  130 + (run* (q)
  131 + (absento q `(3 . (4 . 5))))
  132 + '((_.0 (=/= ((_.0 3))
  133 + ((_.0 4))
  134 + ((_.0 5))
  135 + ((_.0 (3 . (4 . 5))))
  136 + ((_.0 (4 . 5)))))))
  137 +
  138 + (test-check "test 16"
  139 + (run* (q)
  140 + (fresh (a b x)
  141 + (absento a b)
  142 + (symbolo a)
  143 + (numbero x)
  144 + (== x b)
  145 + (== `(,a ,b) q)))
  146 + '(((_.0 _.1) (num _.1) (sym _.0))))
  147 +
  148 + (test-check "test 19"
  149 + (run* (q) (absento 5 q) (absento 5 q))
  150 + '((_.0 (absento (5 _.0)))))
  151 +
  152 + (test-check "test 20"
  153 + (run* (q) (absento 5 q) (absento 6 q))
  154 + '((_.0 (absento (5 _.0) (6 _.0)))))
  155 +
  156 + (test-check "test 21"
  157 + (run* (q) (absento 5 q) (symbolo q))
  158 + '((_.0 (sym _.0))))
  159 +
  160 + (test-check "test 22"
  161 + (run* (q) (numbero q) (absento 'tag q))
  162 + '((_.0 (num _.0))))
  163 +
  164 + (test-check "test 23"
  165 + (run* (q) (absento 'tag q) (numbero q))
  166 + '((_.0 (num _.0))))
  167 +
  168 + (test-check "test 24"
  169 + (run* (q) (== 5 q) (absento 5 q))
  170 + '())
  171 +
  172 + (test-check "test 25"
  173 + (run* (q) (== q `(5 6)) (absento 5 q))
  174 + '())
  175 +
  176 + (test-check "test 25b"
  177 + (run* (q) (absento 5 q) (== q `(5 6)))
  178 + '())
  179 +
  180 + (test-check "test 26"
  181 + (run* (q) (absento 5 q) (== 5 q))
  182 + '())
  183 +
  184 + (test-check "test 27"
  185 + (run* (q) (absento 'tag1 q) (absento 'tag2 q))
  186 + '((_.0 (absento (tag1 _.0) (tag2 _.0)))))
  187 +
  188 + (test-check "test 28"
  189 + (run* (q) (absento 'tag q) (numbero q))
  190 + '((_.0 (num _.0))))
  191 +
  192 + (test-check "test 29"
  193 + (run* (q)
  194 + (fresh (a b)
  195 + (absento a b)
  196 + (absento b a)
  197 + (== `(,a ,b) q)
  198 + (symbolo a)
  199 + (numbero b)))
  200 + '(((_.0 _.1) (num _.1) (sym _.0))))
  201 +
  202 + (test-check "test 30"
  203 + (run* (q)
  204 + (fresh (a b)
  205 + (absento b a)
  206 + (absento a b)
  207 + (== `(,a ,b) q)
  208 + (symbolo a)
  209 + (symbolo b)))
  210 + '(((_.0 _.1) (=/= ((_.0 _.1))) (sym _.0 _.1))))
  211 +
  212 + (test-check "test 31"
  213 + (run* (q)
  214 + (fresh (a b)
  215 + (absento a b)
  216 + (absento b a)
  217 + (== `(,a ,b) q)))
  218 + '(((_.0 _.1) (absento (_.0 _.1) (_.1 _.0)))))
  219 +
  220 + (test-check "test 32"
  221 + (run* (q)
  222 + (fresh (a b)
  223 + (absento 5 a)
  224 + (absento 5 b)
  225 + (== `(,a . ,b) q)))
  226 + '(((_.0 . _.1) (absento (5 _.0) (5 _.1)))))
  227 +
  228 + (test-check "test 33"
  229 + (run* (q)
  230 + (fresh (a b c)
  231 + (== `(,a ,b) c)
  232 + (== `(,c ,c) q)
  233 + (symbolo b)
  234 + (numbero c)))
  235 + '())
  236 +
  237 + (test-check "test 34"
  238 + (run* (q) (absento 'tag q) (symbolo q))
  239 + '((_.0 (=/= ((_.0 tag))) (sym _.0))))
  240 +
  241 + (test-check "test 35"
  242 + (run* (q) (absento 5 q) (numbero q))
  243 + '((_.0 (=/= ((_.0 5))) (num _.0))))
  244 +
  245 + (test-check "test 36"
  246 + (run* (q)
  247 + (fresh (a)
  248 + (== 5 a) (absento a q)))
  249 + '((_.0 (absento (5 _.0)))))
  250 +
  251 + (test-check "test 37"
  252 + (run* (q)
  253 + (fresh (a b)
  254 + (absento a b)
  255 + (absento b a)
  256 + (== `(,a ,b) q)
  257 + (symbolo a)
  258 + (symbolo b)))
  259 + '(((_.0 _.1) (=/= ((_.0 _.1))) (sym _.0 _.1))))
  260 +
  261 + (test-check "test 38"
  262 + (run* (q) (absento '() q))
  263 + '((_.0 (absento (() _.0)))))
  264 +
  265 + (test-check "test 39"
  266 + (run* (q) (absento `(3 4) q))
  267 + '((_.0 (absento ((3 4) _.0)))))
  268 +
  269 + (test-check "test 40"
  270 + (run* (q)
  271 + (fresh (d a c)
  272 + (== `(3 . ,d) q)
  273 + (=/= `(,c . ,a) q)
  274 + (== '(3 . 4) d)))
  275 + '((3 3 . 4)))
  276 +
  277 + (test-check "test 41"
  278 + (run* (q)
  279 + (fresh (a)
  280 + (== `(,a . ,a) q)))
  281 + '((_.0 . _.0)))
  282 +
  283 + (test-check "test 42"
  284 + (run* (q)
  285 + (fresh (a b)
  286 + (== `((3 4) (5 6)) q)
  287 + (absento `(3 4) q)))
  288 + '())
  289 +
  290 + (test-check "test 43"
  291 + (run* (q) (absento q 3))
  292 + '((_.0 (=/= ((_.0 3))))))
  293 +
  294 + (test-check "test 44"
  295 + (run* (q)
  296 + (fresh (a b)
  297 + (absento a b)
  298 + (absento b a)
  299 + (== `(,a ,b) q)))
  300 + '(((_.0 _.1) (absento (_.0 _.1) (_.1 _.0)))))
  301 +
  302 + (test-check "test 45"
  303 + (run* (q)
  304 + (fresh (a b)
  305 + (absento `(,a . ,b) q)
  306 + (== q `(3 . (,b . ,b)))))
  307 + '((3 _.0 . _.0)))
  308 +
  309 + (test-check "test 45b"
  310 + (run* (q)
  311 + (fresh (a b)
  312 + (absento `(,a . ,b) q)
  313 + (== q `(,a 3 . (,b . ,b)))))
  314 + '(((_.0 3 _.1 . _.1) (=/= ((_.0 _.1))))))
  315 +
  316 + (test-check "test 46"
  317 + (run* (q)
  318 + (fresh (a)
  319 + (absento a q)
  320 + (absento q a)))
  321 + '(_.0))
  322 +
  323 + (test-check "test 47"
  324 + (run* (q)
  325 + (fresh (a)
  326 + (absento `(,a . 3) q)))
  327 + '(_.0))
  328 +
  329 + (test-check "test 48"
  330 + (run* (q)
  331 + (fresh (a)
  332 + (absento `(,a . 3) q)))
  333 + '(_.0))
  334 +
  335 + (test-check "test 49"
  336 + (run* (q)
  337 + (fresh (a b c d e)
  338 + (absento `((3 4 ,a) (4 ,b) ((,c)) ,d ,e) q)))
  339 + '(_.0))
  340 +
  341 + (test-check "test 50"
  342 + (run* (q) (fresh (a)
  343 + (absento a q)
  344 + (== 5 a)))
  345 + '((_.0 (absento (5 _.0)))))
  346 +
  347 + (test-check "test 51"
  348 + (run* (q) (fresh (a b c d)
  349 + (== a 5)
  350 + (== a b)
  351 + (== b c)
  352 + (absento d q)
  353 + (== c d)))
  354 + '((_.0 (absento (5 _.0)))))
  355 +
  356 + (test-check "test 52"
  357 + (run* (q) (fresh (a b c d)
  358 + (== a b)
  359 + (== b c)
  360 + (absento a q)
  361 + (== c d)
  362 + (== d 5)))
  363 + '((_.0 (absento (5 _.0)))))
  364 +
  365 + (test-check "test 53"
  366 + (run* (q)
  367 + (fresh (t1 t2 a)
  368 + (== `(,a . 3) t1)
  369 + (== `(,a . (4 . 3)) t2)
  370 + (== `(,t1 ,t2) q)
  371 + (absento t1 t2)))
  372 + '((((_.0 . 3) (_.0 4 . 3)) (=/= ((_.0 4))))))
  373 +
  374 + (test-check "test 54"
  375 + (run* (q)
  376 + (fresh (a)
  377 + (== `(,a . 3) q)
  378 + (absento q `(,a . (4 . 3)))))
  379 + '(((_.0 . 3) (=/= ((_.0 4))))))
  380 +
  381 + (test-check "test 55"
  382 + (run* (q) (fresh (a d c)
  383 + (== '(3 . 4) d)
  384 + (absento `(3 . 4) q)
  385 + (== `(3 . ,d) q)))
  386 + '())
  387 +
  388 + (test-check "test 56"
  389 + (run* (q) (fresh (a b)
  390 + (absento a b)
  391 + (absento b a)
  392 + (== `(,a ,b) q)
  393 + (symbolo a)
  394 + (numbero b)))
  395 + '(((_.0 _.1) (num _.1) (sym _.0))))
  396 +
  397 +
  398 + (test-check "test 57"
  399 + (run* (q)
  400 + (numbero q)
  401 + (absento q 3))
  402 + '((_.0 (=/= ((_.0 3))) (num _.0))))
  403 +
  404 + (test-check "test 58"
  405 + (run* (q)
  406 + (fresh (a)
  407 + (== `(,a . 3) q)
  408 + (absento q `(,a . (4 . (,a . 3))))))
  409 + '())
  410 +
  411 + (test-check "test 59"
  412 + (run* (q)
  413 + (fresh (a)
  414 + (== `(,a . 3) q)
  415 + (absento q `(,a . ((,a . 3) . (,a . 4))))))
  416 + '())
  417 +
  418 + (test-check "test 60"
  419 + (run* (q)
  420 + (fresh (a d c)
  421 + (== `(3 . ,d) q)
  422 + (== '(3 . 4) d)
  423 + (absento `(3 . 4) q)))
  424 + '())
  425 +
  426 + (test-check "test 61"
  427 + (run* (q)
  428 + (fresh (a b c)
  429 + (symbolo b)
  430 + (absento `(,3 . ,a) `(,b . ,c))
  431 + (== `(,a ,b ,c) q)))
  432 + '(((_.0 _.1 _.2)
  433 + (absento ((3 . _.0) _.2))
  434 + (sym _.1))))
  435 +
  436 + (test-check "test 62"
  437 + (run* (q) (fresh (a b c) (absento a b) (absento b c) (absento c q) (symbolo a)))
  438 + '(_.0))
  439 +
  440 + (test-check "test 63"
  441 + (run* (q) (fresh (a b c) (=/= a b) (=/= b c) (=/= c q) (symbolo a)))
  442 + '(_.0))
  443 +
  444 + (test-check "test 64"
  445 + (run* (q) (symbolo q) (== 'tag q))
  446 + '(tag))
  447 +
  448 + (test-check "test 65"
  449 + (run* (q) (fresh (b) (absento '(3 4) `(,q ,b))))
  450 + '((_.0 (absento ((3 4) _.0)))))
  451 +
  452 + (test-check "test 66"
  453 + (run* (q) (absento 6 5))
  454 + '(_.0))
  455 +
  456 + (test-check "test 67"
  457 + (run* (q)
  458 + (fresh (a b)
  459 + (=/= a b)
  460 + (symbolo a)
  461 + (numbero b)
  462 + (== `(,a ,b) q)))