Skip to content

Commit

Permalink
Test: Base64: Add a couple more tests for padding edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tlsa committed Jul 21, 2024
1 parent 63ed319 commit 908a3f4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/units/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "😸",
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 908a3f4

Please sign in to comment.