Skip to content

Commit 6e14fa5

Browse files
committed
Actually make this test unlikely to succeed.
The original fix in f8fd456 added more random generation but did not use it in the output so this test still had a 1/50 chance of failing. Related to #132.
1 parent 2b256e6 commit 6e14fa5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

htdp-test/tests/test-engine/racket-tests.rkt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
(check-pred null? failed-checks))
4646
(initialize-test-object!))
4747

48-
(define (check-failure reason? . selector+value-list)
48+
49+
(define-syntax-rule (check-failure reason . selector+value-list)
50+
(check-failure* #'reason reason . selector+value-list))
51+
52+
(define (check-failure* src reason? . selector+value-list)
4953
(let* ((test-object (run-tests!))
5054
(failed-checks (test-object-failed-checks test-object)))
5155
(check-equal? (length failed-checks) 1)
@@ -54,7 +58,7 @@
5458
(for/fold ([l (object-name reason?)])
5559
([f selector+value-list] [i (in-naturals)] #:when (even? i))
5660
(~a l ", " (object-name f))))
57-
(error 'check-failure "expected failed check, none failed (~a)" names))
61+
(error 'check-failure "expected failed check, none failed (~a) (~a)" names src))
5862
(apply assert-failed-check (car failed-checks) reason? selector+value-list))
5963
(initialize-test-object!))
6064

@@ -376,12 +380,12 @@
376380
(list x1 x2 x3 x4)))
377381
(check-failure unequal?)
378382

379-
(define (h _x) (car (list (random 50) (random 20) (random 100) (random 70))))
383+
(define (h _x) (list (random 50) (random 20) (random 100) (random 70)))
380384

381-
(check-random (h 0) (begin0 (random 50) (random 20) (random 100) (random 70)))
385+
(check-random (h 0) (list (random 50) (random 20) (random 100) (random 70)))
382386
(check-success)
383387

384-
(check-random (h 0) (begin (random 20) (random 50) (random 70) (random 100))) ;; fails
388+
(check-random (h 0) (list (random 20) (random 50) (random 70) (random 100)))
385389
(check-failure unequal?)
386390

387391
(check-property

0 commit comments

Comments
 (0)