mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
AK: Add tests for Base64 decoder
This commit is contained in:
parent
79529ffd47
commit
e14c8b2707
1 changed files with 16 additions and 0 deletions
|
@ -30,6 +30,22 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
TEST_CASE(test_decode)
|
||||
{
|
||||
auto decode_equal = [&](const char* input, const char* expected) {
|
||||
auto decoded = decode_base64(StringView(input));
|
||||
EXPECT(String::copy(decoded) == String(expected));
|
||||
};
|
||||
|
||||
decode_equal("", "");
|
||||
decode_equal("Zg==", "f");
|
||||
decode_equal("Zm8=", "fo");
|
||||
decode_equal("Zm9v", "foo");
|
||||
decode_equal("Zm9vYg==", "foob");
|
||||
decode_equal("Zm9vYmE=", "fooba");
|
||||
decode_equal("Zm9vYmFy", "foobar");
|
||||
}
|
||||
|
||||
TEST_CASE(test_encode)
|
||||
{
|
||||
auto encode_equal = [&](const char* input, const char* expected) {
|
||||
|
|
Loading…
Add table
Reference in a new issue