-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest-genv.scm
41 lines (32 loc) · 1.2 KB
/
test-genv.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(use gauche.test)
(use gauche.parameter)
(use file.util)
(test-start "genv")
(test-section "LISP1.5.runtime")
(use LISP1.5.runtime)
(test-module 'LISP1.5.runtime)
(test* "Loading genv" #t (load "mx/genv.mx"))
(define-syntax evaltest
(syntax-rules ()
[(evaltest output input env)
(test* (x->string input) output
($lisp->scheme (EVAL ($scheme->lisp input)
($scheme->lisp env))))]))
(evaltest 'A '(QUOTE A) '())
(evaltest '(X . Y) '(CONS (QUOTE X) (QUOTE Y)) '())
(evaltest 'NIL 'NIL '())
(evaltest 'NIL 'F '())
(evaltest 'T 'T '())
(evaltest 'ORANGE 'APPLE '((APPLE . ORANGE)))
(evaltest '(G F E D C B A)
'(REVERSE (QUOTE (A B C D E F G)))
'((REVERSE . (LAMBDA (XS)
(COND ((NULL XS) NIL)
(T (APPEND (REVERSE (CDR XS))
(CONS (CAR XS) NIL))))))))
(evaltest '(G F E D C B A)
'#,(m-expr "reverse[(A B C D E F G)]")
'((REVERSE . #,(m-expr "lambda[[xs];\
[null[xs] -> NIL;\
T -> append[reverse[cdr[xs]];cons[car[xs];NIL]]]]"))))
(test-end)