summaryrefslogtreecommitdiff
path: root/tests/base64.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2024-11-12 11:13:50 -0500
committerDavid Thompson <dthompson2@worcester.edu>2024-11-12 11:13:50 -0500
commit0ec29230d7e5b4706cdedc7a3c380e90e8313d73 (patch)
treedcbed466f4b1485342b049459bf445476af844d4 /tests/base64.scm
parent6d62043459088784a17eb007ce2c465b74d4bff5 (diff)
base64: Add tests for no padding cases.HEADmaster
Diffstat (limited to 'tests/base64.scm')
-rw-r--r--tests/base64.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/base64.scm b/tests/base64.scm
index c6ebe8f..2850471 100644
--- a/tests/base64.scm
+++ b/tests/base64.scm
@@ -30,9 +30,15 @@
(test-equal "one byte of padding"
"hello"
(utf8->string (base64-decode "aGVsbG8=")))
+ (test-equal "one byte of padding but no padding char"
+ "hello"
+ (utf8->string (base64-decode "aGVsbG8" #:padding? #f)))
(test-equal "two bytes of padding"
"what's up?"
- (utf8->string (base64-decode "d2hhdCdzIHVwPw=="))))
+ (utf8->string (base64-decode "d2hhdCdzIHVwPw==")))
+ (test-equal "two bytes of padding but no padding chars"
+ "what's up?"
+ (utf8->string (base64-decode "d2hhdCdzIHVwPw" #:padding? #f))))
(test-group "base64-encode"
(test-equal "empty string"
""
@@ -43,6 +49,9 @@
(test-equal "one byte of padding"
"aGVsbG8="
(base64-encode (string->utf8 "hello")))
- (test-equal "two bytes of padding"
- "d2hhdCdzIHVwPw=="
- (base64-encode (string->utf8 "what's up?")))))
+ (test-equal "one byte of padding but no padding char"
+ "aGVsbG8"
+ (base64-encode (string->utf8 "hello") #:padding? #f))
+ (test-equal "two bytes of padding but no padding chars"
+ "d2hhdCdzIHVwPw"
+ (base64-encode (string->utf8 "what's up?") #:padding? #f))))