svn: r13556
This commit is contained in:
parent
3687ef84e5
commit
b9560ae309
|
@ -1,12 +1,36 @@
|
||||||
#reader "literate-reader.ss"
|
#reader "literate-reader.ss"
|
||||||
@chunk[<main>
|
@chunk[<main>
|
||||||
|
<everything-else>]
|
||||||
|
|
||||||
|
@chunk[<everything-else>
|
||||||
|
|
||||||
#;'()
|
#;'()
|
||||||
|
|
||||||
(require htdp/world lang/posn)
|
(require htdp/world lang/posn)
|
||||||
(define-syntax (check-expect stx) #'(void))
|
(define-syntax (check-expect stx)
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(_ actual expected)
|
||||||
|
(with-syntax ([line (syntax-line stx)])
|
||||||
|
#'(check-expect/proc (λ () actual)
|
||||||
|
(λ () expected)
|
||||||
|
line))]))
|
||||||
|
|
||||||
(require "hash.ss")
|
(define check-expect-count 0)
|
||||||
|
(define (check-expect/proc actual-thunk expected-thunk line)
|
||||||
|
(set! check-expect-count (+ check-expect-count 1))
|
||||||
|
(let ([actual (actual-thunk)]
|
||||||
|
[expected (expected-thunk)])
|
||||||
|
(unless (equal? actual expected)
|
||||||
|
(error 'check-expect "test ~a on line ~a failed:\n ~s\n ~s\n"
|
||||||
|
check-expect-count
|
||||||
|
line
|
||||||
|
actual
|
||||||
|
expected))))
|
||||||
|
|
||||||
|
(define (make-immutable-hash/list-init [init '()])
|
||||||
|
(make-immutable-hash
|
||||||
|
(map (λ (x) (cons (car x) (cadr x)))
|
||||||
|
init)))
|
||||||
|
|
||||||
;; constants
|
;; constants
|
||||||
(define circle-radius 20)
|
(define circle-radius 20)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user