tests/utils: Add tests for base64Encode

Test vectors according to RFC4648
This commit is contained in:
Peter Keresztes Schmidt committed 2021-04-03 22:37:44 +02:00
1 parent bbc4afcf1b
commit 46a4b615c8
1 file changed
+10
+10
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");
}