Print seed used for TR random testing.

To make it possible to reproduce test runs.

original commit: 1f3e38d305eefd4e79615688e6327e8b3c8faec0
This commit is contained in:
Vincent St-Amour 2013-04-22 11:55:00 -04:00
parent c0b5f31c90
commit 6350738866

View File

@ -216,6 +216,7 @@
(define tr-eval (mk-eval 'typed/racket))
(define (check-all-reals sexp)
(when verbose? (displayln sexp))
(or (with-handlers
;; something went wrong, almost certainly typechecking failed
;; in which case we ignore the expression
@ -248,9 +249,16 @@
(equal? racket-result tr-result))))))))
(define n-attempts 1000)
(define seed (+ 1 (random (expt 2 30))))
(define verbose? #f)
(command-line
#:once-each
[("-n") n "Number of attempts" (set! n-attempts (string->number n))])
[("-n") n "Number of attempts" (set! n-attempts (string->number n))]
[("-s") s "RNG seed" (set! seed (string->number s))]
[("-v") "Print test cases" (set! verbose? #t)])
(random-seed seed)
(printf "seed: ~s~n" seed)
(call-with-limits
#f 1000
@ -259,4 +267,4 @@
#:attempts n-attempts
#:prepare exp->real-exp)))
;(printf "bad tests (usually typechecking failed): ~v~n" num-exceptions)
(printf "bad tests (usually typechecking failed): ~v~n" num-exceptions)