From e3a40e183170728fdebb378dbfe9234d957c77d3 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 8 May 2017 13:14:12 -0700 Subject: [PATCH] Update test to get it working again. --- tests/runtime/test-boyer-moore.scm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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)))) -- 2.25.1