From 908a3f43cc9f7b5a8ba100115ebd34f1ceaa68f7 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 21 Jul 2024 10:33:15 +0100 Subject: [PATCH] Test: Base64: Add a couple more tests for padding edge cases --- test/units/base64.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/units/base64.c b/test/units/base64.c index 296474c..fcf4010 100644 --- a/test/units/base64.c +++ b/test/units/base64.c @@ -180,7 +180,15 @@ static bool test_base64_decode_odd( .err = CYAML_OK, }, { - .name = "no_padding", + .name = "no_padding_1", + .enc = "S2l0dHk", + .enc_len = 7, + .dec = "Kitty", + .dec_len = 5, + .err = CYAML_OK, + }, + { + .name = "no_padding_2", .enc = "8J+YuA", .enc_len = 6, .dec = "😸", @@ -223,6 +231,12 @@ static bool test_base64_decode_odd( .enc_len = 4, .err = CYAML_ERR_INVALID_BASE64, }, + { + .name = "wrong_padding", + .enc = "S2l0dHk==", + .enc_len = 9, + .err = CYAML_ERR_INVALID_BASE64, + }, }; for (unsigned i = 0; i < CYAML_ARRAY_LEN(odd_data); i++) {