From 46a4b615c8a3ccf126cd37a06cfc0f74c9e43873 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Sat, 3 Apr 2021 21:23:54 +0200 Subject: [PATCH] tests/utils: Add tests for base64Encode Test vectors according to RFC4648 --- tests/zm_utils.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/zm_utils.cpp b/tests/zm_utils.cpp index 887bda45a..1581949ff 100644 --- a/tests/zm_utils.cpp +++ b/tests/zm_utils.cpp @@ -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"); +}