diff options
Diffstat (limited to 'tests/quoted-printable.scm')
-rw-r--r-- | tests/quoted-printable.scm | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/tests/quoted-printable.scm b/tests/quoted-printable.scm index 0b5b462..bfbd985 100644 --- a/tests/quoted-printable.scm +++ b/tests/quoted-printable.scm @@ -1,5 +1,5 @@ ;;; guile-email --- Guile email parser -;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2018, 2020 Arun Isaac <arunisaac@systemreboot.net> ;;; ;;; This file is part of guile-email. ;;; @@ -67,20 +67,24 @@ abriquent pour te la vendre une =C3=A2me vulgaire.") (quoted-printable-escape-encode-char #\return) (quoted-printable-escape-encode-char #\newline))) -(let ((x (random-bytevector 1000))) - (test-equal "quoted-printable random bytevector: quoted-printable-encode and quoted-printable-decode are inverses of each other" - (quoted-printable-decode - (quoted-printable-encode x)) - x)) +(test-assert "quoted-printable random bytevector: quoted-printable-encode and quoted-printable-decode are inverses of each other" + (every (lambda (len) + (let ((x (random-bytevector len))) + (equal? x (quoted-printable-decode (quoted-printable-encode x))))) + (iota 1000))) (test-assert "quoted-printable random bytevector: encoded output should not be more than 76 columns wide" - (each-line-has-a-maximum-of-76-characters? - (quoted-printable-encode - (random-bytevector 1000)))) + (every (lambda (len) + (each-line-has-a-maximum-of-76-characters? + (quoted-printable-encode + (random-bytevector len)))) + (iota 1000))) (test-assert "quoted-printable random bytevector: encoded output must only consist of printable ASCII characters" - (string-has-only-quoted-printable-valid-characters? - (quoted-printable-encode (random-bytevector 1000)))) + (every (lambda (len) + (string-has-only-quoted-printable-valid-characters? + (quoted-printable-encode (random-bytevector len)))) + (iota 1000))) (let ((encoded-text "=A1Hola,_se=F1or!") (decoded-text "¡Hola, señor!") @@ -102,9 +106,10 @@ abriquent pour te la vendre une =C3=A2me vulgaire.") (quoted-printable-escape-encode-char #\_) (quoted-printable-escape-encode-char #\?))) -(let ((x (random-bytevector 1000))) - (test-equal "q-encoding random bytevector: q-encoding-encode and q-encoding-decode are inverses of each other" - (q-encoding-decode (q-encoding-encode x)) - x)) +(test-assert "q-encoding random bytevector: q-encoding-encode and q-encoding-decode are inverses of each other" + (every (lambda (len) + (let ((x (random-bytevector len))) + (equal? x (q-encoding-decode (q-encoding-encode x))))) + (iota 1000))) (test-end "quoted-printable") |