More "~n" -> "\n" changes
original commit: 8e0f8dd39c3744472b450021f003f9cbe8cbcb62
This commit is contained in:
parent
bfeb87cacd
commit
cd4dbaad6a
|
@ -289,7 +289,7 @@
|
||||||
(if (<= input test)
|
(if (<= input test)
|
||||||
'input-smaller
|
'input-smaller
|
||||||
'test-smaller)))]))])
|
'test-smaller)))]))])
|
||||||
; (printf "~a ~a ~a~n" compare secs (date->string date))
|
; (printf "~a ~a ~a\n" compare secs (date->string date))
|
||||||
(cond
|
(cond
|
||||||
[(eq? compare 'equal) secs]
|
[(eq? compare 'equal) secs]
|
||||||
[(or (= secs below-secs) (= secs above-secs))
|
[(or (= secs below-secs) (= secs above-secs))
|
||||||
|
@ -362,4 +362,4 @@
|
||||||
(caddr reversed-digits)
|
(caddr reversed-digits)
|
||||||
(cadr reversed-digits)
|
(cadr reversed-digits)
|
||||||
(car reversed-digits)))
|
(car reversed-digits)))
|
||||||
(loop (cdr (cdr (cdr reversed-digits))))))))))))
|
(loop (cdr (cdr (cdr reversed-digits))))))))))))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(let* defs
|
(let* defs
|
||||||
(let ((real-ans code))
|
(let ((real-ans code))
|
||||||
(unless (equal? real-ans right-ans)
|
(unless (equal? real-ans right-ans)
|
||||||
(printf "Test failed: ~e gave ~e. Expected ~e~n"
|
(printf "Test failed: ~e gave ~e. Expected ~e\n"
|
||||||
'code real-ans 'right-ans))) ...))))
|
'code real-ans 'right-ans))) ...))))
|
||||||
|
|
||||||
(define-syntax test-block
|
(define-syntax test-block
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
|
|
||||||
;; coroutine : ((bool ->) -> X) -> X-coroutine-object
|
;; coroutine : ((bool ->) -> X) -> X-coroutine-object
|
||||||
(define (coroutine f)
|
(define (coroutine f)
|
||||||
;;(printf "2. new coroutine~n")
|
;;(printf "2. new coroutine\n")
|
||||||
(let* ([can-stop-lock (make-semaphore 1)]
|
(let* ([can-stop-lock (make-semaphore 1)]
|
||||||
[done-ch (make-channel)]
|
[done-ch (make-channel)]
|
||||||
[ex-ch (make-channel)]
|
[ex-ch (make-channel)]
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
[stop-enabled? #t]
|
[stop-enabled? #t]
|
||||||
[enable-stop
|
[enable-stop
|
||||||
(lambda (enable?)
|
(lambda (enable?)
|
||||||
;;(printf "3. enabling ~a~n" enable?)
|
;;(printf "3. enabling ~a\n" enable?)
|
||||||
(cond
|
(cond
|
||||||
[(and enable? (not stop-enabled?))
|
[(and enable? (not stop-enabled?))
|
||||||
(semaphore-post can-stop-lock)
|
(semaphore-post can-stop-lock)
|
||||||
|
@ -131,11 +131,11 @@
|
||||||
[(and (not enable?) stop-enabled?)
|
[(and (not enable?) stop-enabled?)
|
||||||
(semaphore-wait can-stop-lock)
|
(semaphore-wait can-stop-lock)
|
||||||
(set! stop-enabled? #f)])
|
(set! stop-enabled? #f)])
|
||||||
;;(printf "3. finished enabling~n")
|
;;(printf "3. finished enabling\n")
|
||||||
)]
|
)]
|
||||||
[tid (thread (lambda ()
|
[tid (thread (lambda ()
|
||||||
(semaphore-wait proceed-sema)
|
(semaphore-wait proceed-sema)
|
||||||
;;(printf "3. creating coroutine thread~n")
|
;;(printf "3. creating coroutine thread\n")
|
||||||
(with-handlers ([(lambda (exn) #t)
|
(with-handlers ([(lambda (exn) #t)
|
||||||
(lambda (exn)
|
(lambda (exn)
|
||||||
(enable-stop #t)
|
(enable-stop #t)
|
||||||
|
@ -152,7 +152,7 @@
|
||||||
(if (coroutine-object-worker w)
|
(if (coroutine-object-worker w)
|
||||||
(let ([can-stop-lock (coroutine-object-can-stop-lock w)]
|
(let ([can-stop-lock (coroutine-object-can-stop-lock w)]
|
||||||
[worker (coroutine-object-worker w)])
|
[worker (coroutine-object-worker w)])
|
||||||
#;(printf "2. starting coroutine~n")
|
#;(printf "2. starting coroutine\n")
|
||||||
(thread-resume worker)
|
(thread-resume worker)
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
void
|
void
|
||||||
|
@ -162,20 +162,20 @@
|
||||||
timeout
|
timeout
|
||||||
(alarm-evt (+ timeout (current-inexact-milliseconds))))
|
(alarm-evt (+ timeout (current-inexact-milliseconds))))
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
#;(printf "2. alarm-evt~n")
|
#;(printf "2. alarm-evt\n")
|
||||||
(semaphore-wait can-stop-lock)
|
(semaphore-wait can-stop-lock)
|
||||||
(thread-suspend worker)
|
(thread-suspend worker)
|
||||||
(semaphore-post can-stop-lock)
|
(semaphore-post can-stop-lock)
|
||||||
#f))
|
#f))
|
||||||
(wrap-evt (coroutine-object-done-ch w)
|
(wrap-evt (coroutine-object-done-ch w)
|
||||||
(lambda (res)
|
(lambda (res)
|
||||||
#;(printf "2. coroutine-done-evt~n")
|
#;(printf "2. coroutine-done-evt\n")
|
||||||
(set-coroutine-object-result! w res)
|
(set-coroutine-object-result! w res)
|
||||||
(coroutine-kill w)
|
(coroutine-kill w)
|
||||||
#t))
|
#t))
|
||||||
(wrap-evt (coroutine-object-ex-ch w)
|
(wrap-evt (coroutine-object-ex-ch w)
|
||||||
(lambda (exn)
|
(lambda (exn)
|
||||||
#;(printf "2. ex-evt~n")
|
#;(printf "2. ex-evt\n")
|
||||||
(coroutine-kill w)
|
(coroutine-kill w)
|
||||||
(raise exn))))))
|
(raise exn))))))
|
||||||
;; In case we escape through a break:
|
;; In case we escape through a break:
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(lambda (load)
|
(lambda (load)
|
||||||
(lambda (filename expected-module)
|
(lambda (filename expected-module)
|
||||||
(fprintf ep
|
(fprintf ep
|
||||||
"~aloading ~a at ~a~n"
|
"~aloading ~a at ~a\n"
|
||||||
tab filename (current-process-milliseconds))
|
tab filename (current-process-milliseconds))
|
||||||
(begin0
|
(begin0
|
||||||
(let ([s tab])
|
(let ([s tab])
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
(load filename expected-module))
|
(load filename expected-module))
|
||||||
(lambda () (set! tab s))))
|
(lambda () (set! tab s))))
|
||||||
(fprintf ep
|
(fprintf ep
|
||||||
"~adone ~a at ~a~n"
|
"~adone ~a at ~a\n"
|
||||||
tab filename (current-process-milliseconds)))))])
|
tab filename (current-process-milliseconds)))))])
|
||||||
(current-load (mk-chain load))
|
(current-load (mk-chain load))
|
||||||
(current-load-extension (mk-chain load-extension))))
|
(current-load-extension (mk-chain load-extension))))
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
(define (opt-lam-test exp expected)
|
(define (opt-lam-test exp expected)
|
||||||
(let ([got (eval exp)])
|
(let ([got (eval exp)])
|
||||||
(unless (equal? got expected)
|
(unless (equal? got expected)
|
||||||
(printf "FAILED test: ~a~n expected: ~s~n got: ~s~n"
|
(printf "FAILED test: ~a\n expected: ~s\n got: ~s\n"
|
||||||
exp expected got))))
|
exp expected got))))
|
||||||
|
|
||||||
(define (opt-lam-test/bad exp expected)
|
(define (opt-lam-test/bad exp expected)
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
(lambda (exn) (exn-message exn))])
|
(lambda (exn) (exn-message exn))])
|
||||||
(cons 'got-result (eval exp)))])
|
(cons 'got-result (eval exp)))])
|
||||||
(unless (regexp-match expected got)
|
(unless (regexp-match expected got)
|
||||||
(printf "FAILED test: ~a~n expected: ~s~n got: ~s~n"
|
(printf "FAILED test: ~a\n expected: ~s\n got: ~s\n"
|
||||||
exp expected got))))
|
exp expected got))))
|
||||||
|
|
||||||
(test 1 (opt-lambda (start) start) 1)
|
(test 1 (opt-lambda (start) start) 1)
|
||||||
|
|
|
@ -51,11 +51,11 @@
|
||||||
[whole/fractional-exact-numbers whole/fractional-numbers?])
|
[whole/fractional-exact-numbers whole/fractional-numbers?])
|
||||||
(test (selector test-case) print-convert before))
|
(test (selector test-case) print-convert before))
|
||||||
(printf
|
(printf
|
||||||
">> (constructor-style-printing ~a) (quasi-read-style-printing ~a) (show-sharing ~a) (abbreviate-cons-as-list ~a) (whole/fractional-exact-numbers ~a)~n"
|
">> (constructor-style-printing ~a) (quasi-read-style-printing ~a) (show-sharing ~a) (abbreviate-cons-as-list ~a) (whole/fractional-exact-numbers ~a)\n"
|
||||||
constructor-style? quasi-read?
|
constructor-style? quasi-read?
|
||||||
sharing? cons-as-list?
|
sharing? cons-as-list?
|
||||||
whole/fractional-numbers?)))])
|
whole/fractional-numbers?)))])
|
||||||
;(printf "testing: ~s~n" before)
|
;(printf "testing: ~s\n" before)
|
||||||
;(printf ".") (flush-output (current-output-port))
|
;(printf ".") (flush-output (current-output-port))
|
||||||
(cond
|
(cond
|
||||||
[(pctest? test-case)
|
[(pctest? test-case)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user