Skip to content

Commit bae6039

Browse files
committed
Add check info so failing tests can be debugged
1 parent 75adab7 commit bae6039

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

eval/tests.rkt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,17 @@
102102
; A little hack, the analyze below uses hint from the previous run
103103
; The analyze results must be equal. If not, something wrong has happened
104104
(match-define (list res* hint* converged?*) (rival-analyze machine hyperrect hint))
105-
(check-equal? hint hint*)
106-
(check-equal? res res*)
107-
(check-equal? converged? converged?*)
105+
106+
(with-check-info (['hyperrect hyperrect] ['hint hint])
107+
(check-equal? hint hint*)
108+
(check-equal? res res*)
109+
(check-equal? converged? converged?*))
108110

109111
(for ([_ (in-range number-of-random-pts-per-rect)])
110112
(define pt (sample-pts hyperrect))
111-
(define-values (no-hint-cnt* hint-cnt*) (rival-check-hint machine hint pt))
113+
(define-values (no-hint-cnt* hint-cnt*)
114+
(with-check-info (['pt pt] ['hint hint])
115+
(rival-check-hint machine hint pt)))
112116
(set! hint-cnt (+ hint-cnt hint-cnt*))
113117
(set! no-hint-cnt (+ no-hint-cnt no-hint-cnt*))))
114118
(define skipped-percentage (* (/ hint-cnt no-hint-cnt) 100))
@@ -119,7 +123,9 @@
119123
(define vars '(x y))
120124
(define varc (length vars))
121125
(define machine (rival-compile expressions vars discs))
122-
(define skipped-instr (hints-random-checks machine (first rect) (second rect) varc))
126+
(define skipped-instr
127+
(with-check-info (['expressions expressions])
128+
(hints-random-checks machine (first rect) (second rect) varc)))
123129
(check-true (< skipped-instr 99)
124130
(format "Almost no instructions got skipped by hint at ~a" expressions)))
125131

0 commit comments

Comments
 (0)