From: Chris Hanson Date: Mon, 20 Mar 2017 00:53:25 +0000 (-0700) Subject: Refactor test to make it easier to see the failures. X-Git-Tag: mit-scheme-pucked-9.2.12~158^2~78 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a98c857c49b87acb308cfe62ffa373a1dfd13fba;p=mit-scheme.git Refactor test to make it easier to see the failures. --- 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