From: Chris Hanson Date: Mon, 8 May 2017 20:14:12 +0000 (-0700) Subject: Update test to get it working again. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~64 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e3a40e183170728fdebb378dbfe9234d957c77d3;p=mit-scheme.git Update test to get it working again. --- diff --git a/tests/runtime/test-boyer-moore.scm b/tests/runtime/test-boyer-moore.scm index fdd5c2a28..392fd591d 100644 --- a/tests/runtime/test-boyer-moore.scm +++ b/tests/runtime/test-boyer-moore.scm @@ -35,10 +35,12 @@ USA. (for-each (lambda (entry) (write-char #\+) - (let ((fr (string-search-forward text (car entry))) - (br (string-search-backward text (car entry)))) + (let ((fr (string-search-forward (car entry) text)) + (br (string-search-backward (car entry) text)) + (all (string-search-all (car entry) text))) (if (and (eqv? (cadr entry) fr) - (eqv? (fix:+ (car (last-pair entry)) die-length) br)) + (eqv? (fix:+ (last entry) die-length) br) + (equal? (cdr entry) all)) (begin (set! ok (fix:+ ok 1)) unspecific) @@ -74,7 +76,15 @@ USA. (define (file->string filename) (call-with-input-file filename (lambda (port) - ((textual-port-operation port 'REST->STRING) port)))) + (let ((builder (string-builder)) + (buffer (make-string #x1000))) + (let loop () + (let ((n (read-string! buffer port))) + (if (> n 0) + (begin + (builder (substring buffer 0 n)) + (loop))))) + (builder 'immutable))))) (define (search-speed-test text die-length die-skew procedure n-repeats) (let ((entries (map car (dice-text text die-length die-skew))))