#include <boost/test/included/unit_test.hpp>
#include <fc/crypto/base64.hpp>
#include <fc/exception/exception.hpp>
Go to the source code of this file.
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE base64 |
◆ BOOST_AUTO_TEST_CASE() [1/6]
BOOST_AUTO_TEST_CASE |
( |
base64dec | | ) |
|
Definition at line 26 of file test_base64.cpp.
26 {
27 auto input =
"YWJjMTIzJCYoKSc/tPUB+n5h"s;
28 auto expected_output =
"abc123$&()'?\xb4\xf5\x01\xfa~a"s;
29
std::string base64_decode(const std::string &encoded_string)
◆ BOOST_AUTO_TEST_CASE() [2/6]
BOOST_AUTO_TEST_CASE |
( |
base64dec_bad_stuff | | ) |
|
Definition at line 47 of file test_base64.cpp.
47 {
48 auto input =
"YWJjMTIzJCYoKSc/tPU$B+n5h="s;
49
51 return e.
to_detail_string().find(
"encountered non-base64 character") != std::string::npos;
52 });
Used to generate a useful error report when an exception is thrown.
std::string to_detail_string(log_level ll=log_level::all) const
◆ BOOST_AUTO_TEST_CASE() [3/6]
BOOST_AUTO_TEST_CASE |
( |
base64dec_extraequals | | ) |
|
Definition at line 40 of file test_base64.cpp.
40 {
41 auto input =
"YWJjMTIzJCYoKSc/tPUB+n5h========="s;
42 auto expected_output =
"abc123$&()'?\xb4\xf5\x01\xfa~a"s;
43
◆ BOOST_AUTO_TEST_CASE() [4/6]
BOOST_AUTO_TEST_CASE |
( |
base64enc | | ) |
|
Definition at line 12 of file test_base64.cpp.
12 {
13 auto input =
"abc123$&()'?\xb4\xf5\x01\xfa~a"s;
14 auto expected_output =
"YWJjMTIzJCYoKSc/tPUB+n5h"s;
15
std::string base64_encode(unsigned char const *bytes_to_encode, unsigned int in_len)
◆ BOOST_AUTO_TEST_CASE() [5/6]
BOOST_AUTO_TEST_CASE |
( |
base64urldec | | ) |
|
Definition at line 33 of file test_base64.cpp.
33 {
34 auto input =
"YWJjMTIzJCYoKSc_tPUB-n5h"s;
35 auto expected_output =
"abc123$&()'?\xb4\xf5\x01\xfa~a"s;
36
std::string base64url_decode(const std::string &encoded_string)
◆ BOOST_AUTO_TEST_CASE() [6/6]
BOOST_AUTO_TEST_CASE |
( |
base64urlenc | | ) |
|
Definition at line 19 of file test_base64.cpp.
19 {
20 auto input =
"abc123$&()'?\xb4\xf5\x01\xfa~a"s;
21 auto expected_output =
"YWJjMTIzJCYoKSc_tPUB-n5h"s;
22
std::string base64url_encode(unsigned char const *bytes_to_encode, unsigned int in_len)
◆ FC_LOG_AND_RETHROW()