Lolly 1.4.28
Loading...
Searching...
No Matches
base64_test.cpp
Go to the documentation of this file.
1/** \file base64_test.cpp
2 * \copyright GPLv3
3 * \details Unitests for base64
4 * \author charonxin
5 * \date 2023
6 */
7#include "a_lolly_test.hpp"
9
12
13TEST_CASE ("encode base64") {
14 CHECK_EQ (encode_base64 ("") == "", true);
15 CHECK_EQ (encode_base64 ("f") == "Zg==", true);
16 CHECK_EQ (encode_base64 ("fo") == "Zm8=", true);
17 CHECK_EQ (encode_base64 ("foo") == "Zm9v", true);
18 CHECK_EQ (encode_base64 ("foob") == "Zm9vYg==", true);
19 CHECK_EQ (encode_base64 ("fooba") == "Zm9vYmE=", true);
20 CHECK_EQ (encode_base64 ("foobar") == "Zm9vYmFy", true);
21 CHECK_EQ (decode_base64 ("Zg==") == "f", true);
22 CHECK_EQ (decode_base64 ("Zm8=") == "fo", true);
23 CHECK_EQ (decode_base64 ("Zm9v") == "foo", true);
24 CHECK_EQ (decode_base64 ("Zm9vYg==") == "foob", true);
25 CHECK_EQ (decode_base64 ("Zm9vYmE=") == "fooba", true);
26 CHECK_EQ (decode_base64 ("Zm9vYmFy") == "foobar", true);
27}
28
29TEST_CASE ("decode base64") {
30 CHECK_EQ (decode_base64 ("") == "", true);
31 CHECK_EQ (decode_base64 ("Zg==") == "f", true);
32 CHECK_EQ (decode_base64 ("Zm8=") == "fo", true);
33 CHECK_EQ (decode_base64 ("Zm9v") == "foo", true);
34 CHECK_EQ (decode_base64 ("Zm9vYg==") == "foob", true);
35 CHECK_EQ (decode_base64 ("Zm9vYmE=") == "fooba", true);
36 CHECK_EQ (decode_base64 ("Zm9vYmFy") == "foobar", true);
37}
The list class represents a linked list.
Definition list.hpp:48
string decode_base64(array< int > ac)
Definition base64.cpp:67
static string encode_base64(char c1, char c2, char c3)
Definition base64.cpp:24
TEST_CASE("test for operator+= and advance()")