Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (test)
- (define (test-aux xs ys)
- (cond [(null? xs) #t]
- [(= (calc (car xs)) (car ys)) (test-aux (cdr xs) (cdr ys))]
- [else (fprintf (current-output-port)
- "Fail: ~a was evaluated to ~s instead of ~v.\n"
- (car xs) (calc (car xs)) (car ys))
- (and (test-aux (cdr xs) (cdr ys)) #f)]))
- (let ((tests (list "1-2" "1/2" "1/2/3*3*2" "1-2-3-4" "1/2/3/4" "0-1+2/3"))
- (answers (list -1 0.5 1 (calc "((1-2)-3)-4") (calc "((1/2)/3)/4") (calc "0+2/3-1"))))
- (and (test-aux tests answers)
- (display "All tests passed succesfully.\n")
- #t)))
- (test)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement