Unit tests

This commit is contained in:
Jay McCarthy 2010-04-26 15:44:20 -06:00
parent 33583fd5ca
commit 8cbfe949be

View File

@ -156,7 +156,8 @@
(%which () (%constant empty)) => empty (%which () (%constant empty)) => empty
(%more) => #f (%more) => #f
; XXX %copy (%which (x) (%let (y) (%and (%copy x y) (%= y 1)))) => `([x . _])
(%more) => #f
! =error> "syntactically" ! =error> "syntactically"
@ -175,9 +176,41 @@
(%which () %fail) => #f (%which () %fail) => #f
; XXX %free-vars ; %free-vars example from documentation
(local [(define %knows
(%rel ()
[('Odysseus 'TeX)]
[('Odysseus 'Scheme)]
[('Odysseus 'Prolog)]
[('Odysseus 'Penelope)]
[('Penelope 'TeX)]
[('Penelope 'Prolog)]
[('Penelope 'Odysseus)]
[('Telemachus 'TeX)]
[('Telemachus 'calculus)]))]
(test (%which (someone things-known)
(%let (x)
(%set-of x (%knows someone x)
things-known)))
=>
`((someone . _) (things-known TeX Scheme Prolog Penelope Odysseus calculus))
(%more) => #f
(%which (someone things-known)
(%let (x)
(%bag-of x
(%free-vars (someone)
(%knows someone x))
things-known)))
=>
`((someone . Odysseus) (things-known TeX Scheme Prolog Penelope))
(%more) =>
`((someone . Penelope) (things-known TeX Prolog Odysseus))
(%more) =>
`((someone . Telemachus) (things-known TeX calculus))
(%more) =>
#f))
; XXX %freeze (%which (x) (%let (y) (%and (%freeze x y) (%nonvar y)))) => `([x . _])
(%which () (%if-then-else %true %true %true)) => empty (%which () (%if-then-else %true %true %true)) => empty
(%more) => #f (%more) => #f
@ -193,9 +226,11 @@
(%which () (%let (x) (%= x x))) => empty (%which () (%let (x) (%= x x))) => empty
(%more) => #f (%more) => #f
; XXX %melt (%which (x) (%let (y z) (%and (%freeze x y) (%melt y z) (%= z 1)))) => `([x . 1])
(%more) => #f
; XXX %melt-ne (%which (x) (%let (y z) (%and (%freeze x y) (%melt-new y z) (%= z 1)))) => `([x . _])
(%more) => #f
(%which () (%member 3 (list 1 2 3))) => empty (%which () (%member 3 (list 1 2 3))) => empty
(%more) => #f (%more) => #f