Improve test-util
This commit is contained in:
parent
df520e99ca
commit
ad82c64d4d
|
|
@ -28,9 +28,9 @@
|
||||||
(let ([y (let ([x 20])
|
(let ([y (let ([x 20])
|
||||||
(+ x (let ([x 22]) x)))]) y))))
|
(+ x (let ([x 22]) x)))]) y))))
|
||||||
|
|
||||||
(for/list ([program programs] [env (build-list (length programs) (lambda (_) '()))])
|
(for ([program programs] [env (build-list (length programs) (lambda (_) '()))])
|
||||||
(test-eq ((interp-R1 env) program)
|
(test-eq ((interp-R1 env) program)
|
||||||
((interp-R1 env) (remove-complex-opera* program))))
|
((interp-R1 env) (remove-complex-opera* program))))
|
||||||
|
|
||||||
(test-eq
|
(test-eq
|
||||||
(remove-complex-opera* (list-ref programs 0))
|
(remove-complex-opera* (list-ref programs 0))
|
||||||
|
|
@ -95,5 +95,3 @@
|
||||||
(test-eq
|
(test-eq
|
||||||
(remove-complex-opera* (list-ref programs 12))
|
(remove-complex-opera* (list-ref programs 12))
|
||||||
`(program () (let ((y.1 (let ((x.1 20)) (let ((x.2 22)) (+ x.1 x.2))))) y.1)))
|
`(program () (let ((y.1 (let ((x.1 20)) (let ((x.2 22)) (+ x.1 x.2))))) y.1)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@
|
||||||
(+ x y))))
|
(+ x y))))
|
||||||
(define env2 '((y 5)))
|
(define env2 '((y 5)))
|
||||||
|
|
||||||
(for/list ([program (list p1 p2)] [env (list env1 env2)])
|
(for ([program (list p1 p2)] [env (list env1 env2)])
|
||||||
(test-eq ((interp-R1 env) program)
|
(test-eq ((interp-R1 env) program)
|
||||||
((interp-R1 env) (cadr (uniquify program)))))
|
((interp-R1 env) (cadr (uniquify program)))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
(provide test-eq ppexp)
|
(provide test-eq)
|
||||||
|
|
||||||
(define (test-eq a b)
|
(define (test-eq a b)
|
||||||
(if (equal? a b) #t (error "assert failed: " a " != " b)))
|
(if (equal? a b) (displayln "PASS") (error (format "FAIL: ~a != ~a" a b))))
|
||||||
|
|
||||||
(define (ppexp exp) (begin (print exp) (newline)))
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue