9static void test_decode(
const std::string& encoded,
const std::string& decoded)
11 auto buf = Base64::decode(encoded);
12 REQUIRE(buf.size() == decoded.size());
16static void test(
const std::string& decoded,
const std::string& encoded)
18 CHECK(Base64::encode(std::span{std::bit_cast<const uint8_t*>(decoded.data()),
21 test_decode(encoded, decoded);
31 test(
"abc\n",
"YWJjCg==");
32 test(
"0123456789\n",
"MDEyMzQ1Njc4OQo=");
33 test(
"abcdefghijklmnopqrstuvwxyz\n",
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoK");
34 test(
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n",
35 "MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1\n"
37 test(
"111111111111111111111111111111111111111111111111111111111111111111111111111111"
38 "111111111111111111111111111111111111111111111111111111111111111111111111111111"
39 "111111111111111111111111111111111111111111111111111111111111111111111111111111"
40 "111111111111111111111111111111111111111111111\n",
41 "MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\n"
42 "MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\n"
43 "MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\n"
44 "MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\n"
45 "MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExCg==");
49 test_decode(
"M\nDEyM\nzQ1Njc\n4OQo=",
"0123456789\n");
51 test_decode(
"MDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoK",
52 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n");
constexpr bool equal(InputRange1 &&range1, InputRange2 &&range2, Pred pred={}, Proj1 proj1={}, Proj2 proj2={})