From a98c857c49b87acb308cfe62ffa373a1dfd13fba Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 19 Mar 2017 17:53:25 -0700 Subject: [PATCH] Refactor test to make it easier to see the failures. --- tests/runtime/test-string-normalization.scm | 55 ++++++++------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/tests/runtime/test-string-normalization.scm b/tests/runtime/test-string-normalization.scm index 6387cc863..775eb347f 100644 --- a/tests/runtime/test-string-normalization.scm +++ b/tests/runtime/test-string-normalization.scm @@ -93700,27 +93700,29 @@ USA. (#\x115B9 #\x0334 #\x115AF)) ))) +(define (norm-tc-source tc) (car tc)) +(define (norm-tc-nfc tc) (cadr tc)) +(define (norm-tc-nfd tc) (caddr tc)) +(define (norm-tc-nfkc tc) (cadddr tc)) +(define (norm-tc-nfkd tc) (car (cddddr tc))) + +(define (nfd-test source expected) + (lambda () + (with-test-properties + (lambda () + (assert-ts= (string->nfd source) + expected)) + 'expression `(string->nfd ,source)))) + (define-test 'string->nfd (map (lambda (tc) - (lambda () - (run-nfd-test tc))) + (list (nfd-test (norm-tc-source tc) (norm-tc-nfd tc)) + (nfd-test (norm-tc-nfc tc) (norm-tc-nfd tc)) + (nfd-test (norm-tc-nfd tc) (norm-tc-nfd tc)) + (nfd-test (norm-tc-nfkc tc) (norm-tc-nfkd tc)) + (nfd-test (norm-tc-nfkd tc) (norm-tc-nfkd tc)))) normalization-test-cases)) -(define (run-nfd-test tc) - (with-test-properties - (lambda () - (assert-ts= (string->nfd (norm-tc-source tc)) - (norm-tc-nfd tc)) - (assert-ts= (string->nfd (norm-tc-nfc tc)) - (norm-tc-nfd tc)) - (assert-ts= (string->nfd (norm-tc-nfd tc)) - (norm-tc-nfd tc)) - (assert-ts= (string->nfd (norm-tc-nfkc tc)) - (norm-tc-nfkd tc)) - (assert-ts= (string->nfd (norm-tc-nfkd tc)) - (norm-tc-nfkd tc))) - 'expression `(nfd-test ,tc))) - (define (trivial-string=? s1 s2) (let ((n (string-length s1))) (and (fix:= n (string-length s2)) @@ -93731,20 +93733,5 @@ USA. (loop (fix:+ i 1))) #t))))) -(define-comparator trivial-string=? 'trivial-string=?) -(define assert-ts= (simple-binary-assertion trivial-string=? #f)) - -(define (norm-tc-source tc) - (car tc)) - -(define (norm-tc-nfc tc) - (cadr tc)) - -(define (norm-tc-nfd tc) - (caddr tc)) - -(define (norm-tc-nfkc tc) - (cadddr tc)) - -(define (norm-tc-nfkd tc) - (car (cddddr tc))) \ No newline at end of file +(define-comparator trivial-string=? 'string=?) +(define assert-ts= (simple-binary-assertion trivial-string=? #f)) \ No newline at end of file -- 2.25.1