aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--email/quoted-printable.scm2
-rw-r--r--tests/base64.scm21
-rw-r--r--tests/quoted-printable.scm35
3 files changed, 34 insertions, 24 deletions
diff --git a/email/quoted-printable.scm b/email/quoted-printable.scm
index e501af1..2c5d7a7 100644
--- a/email/quoted-printable.scm
+++ b/email/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.
;;;
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")
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")