Skip to content

Commit

Permalink
base32 splitted testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
itzandroidtab committed Mar 6, 2024
1 parent 853099a commit e6a1127
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions klib/crypt/base32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ TEST_CASE("Base32 invalid output size works", "[klib::base32]") {
REQUIRE(!klib::crypt::base32::decode("ABCDEFGH", buf, 2));
REQUIRE(!klib::crypt::base32::decode("ABCDEFGH", buf, 3));
REQUIRE(!klib::crypt::base32::decode("ABCDEFGH", buf, 4));
}

TEST_CASE("Base32 valid output size works", "[klib::base32]") {
// note, every character in the input needs 5 bits.
// ((8 * 5) / 8 = 5 bytes are required for 8 input characters)
uint8_t buf[5];

// this should pass as we need 5 bytes
REQUIRE(klib::crypt::base32::decode("ABCDEFGH", buf, sizeof(buf)));
Expand Down

0 comments on commit e6a1127

Please sign in to comment.