tests/utils: Add tests for base64Encode

Test vectors according to RFC4648
This commit is contained in:
Peter Keresztes Schmidt 2021-04-03 21:23:54 +02:00
parent bbc4afcf1b
commit 46a4b615c8
1 changed files with 10 additions and 0 deletions

View File

@ -144,3 +144,13 @@ TEST_CASE("join") {
REQUIRE(join({"a", "b"}, ",") == "a,b");
REQUIRE(join({"a", "b"}, "") == "ab");
}
TEST_CASE("base64Encode") {
REQUIRE(base64Encode("") == "");
REQUIRE(base64Encode("f") == "Zg==");
REQUIRE(base64Encode("fo") == "Zm8=");
REQUIRE(base64Encode("foo") == "Zm9v");
REQUIRE(base64Encode("foob") == "Zm9vYg==");
REQUIRE(base64Encode("fooba") == "Zm9vYmE=");
REQUIRE(base64Encode("foobar") == "Zm9vYmFy");
}