diff options
Diffstat (limited to 'tests/base64.scm')
-rw-r--r-- | tests/base64.scm | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/base64.scm b/tests/base64.scm index c200f81..504acbf 100644 --- a/tests/base64.scm +++ b/tests/base64.scm @@ -56,18 +56,23 @@ ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=") (base64-encode (string->bytevector decoded-text charset))))) -(let ((x (random-bytevector 1000))) - (test-equal "base64 random bytevector: base64-encode and base64-decode are inverses of each other" - (base64-decode (base64-encode x)) - x)) +(test-assert "base64 random bytevector: base64-encode and base64-decode are inverses of each other" + (every (lambda (len) + (let ((x (random-bytevector len))) + (equal? x (base64-decode (base64-encode x))))) + (iota 1000))) (test-assert "base64 random bytevector: encoded output should not be more than 76 columns wide" - (each-line-has-a-maximum-of-76-characters? - (base64-encode (random-bytevector 1000)))) + (every (lambda (len) + (each-line-has-a-maximum-of-76-characters? + (base64-encode (random-bytevector len)))) + (iota 1000))) (test-assert "base64 random bytevector: encoded output must only consist of characters from the base64 alphabet" - (string-has-only-valid-base64-characters? - (base64-encode (random-bytevector 1000)))) + (every (lambda (len) + (string-has-only-valid-base64-characters? + (base64-encode (random-bytevector len)))) + (iota 1000))) (test-equal "base64 decoding should ignore invalid characters" (bytevector->string (base64-decode "..TWFu,") "utf-8") |