aboutsummaryrefslogtreecommitdiff
path: root/tests/quoted-printable.scm
diff options
context:
space:
mode:
authorArun Isaac2020-05-25 13:40:09 +0530
committerArun Isaac2020-05-25 19:59:26 +0530
commit88259287b5b7f84947cd21af174608b57b731fd0 (patch)
tree0a4e816c02196c57aa6d13d666f2532c056974c9 /tests/quoted-printable.scm
parent60ad69b8c968e5c4d08056ef68d990e26f950d91 (diff)
downloadguile-email-88259287b5b7f84947cd21af174608b57b731fd0.tar.gz
guile-email-88259287b5b7f84947cd21af174608b57b731fd0.tar.lz
guile-email-88259287b5b7f84947cd21af174608b57b731fd0.zip
tests: Test inputs of different lengths.
* tests/base64.scm ("base64 random bytevector: base64-encode and base64-decode are inverses of each other", "base64 random bytevector: encoded output should not be more than 76 columns wide", "base64 random bytevector: encoded output must only consist of characters from the base64 alphabet"): Test inputs of different lengths. * tests/quoted-printable.scm ("quoted-printable random bytevector: quoted-printable-encode and quoted-printable-decode are inverses of each other", "quoted-printable random bytevector: encoded output should not be more than 76 columns wide", "quoted-printable random bytevector: encoded output must only consist of printable ASCII characters", "q-encoding random bytevector: q-encoding-encode and q-encoding-decode are inverses of each other"): Test inputs of different lengths.
Diffstat (limited to 'tests/quoted-printable.scm')
-rw-r--r--tests/quoted-printable.scm35
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")