Skip to content

Commit

Permalink
GH-1461 Simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 13, 2023
1 parent 9c7ca30 commit b40b13f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions libraries/libfc/test/test_base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,23 @@ BOOST_AUTO_TEST_CASE(base64dec) try {
auto expected_output = "abc123$&()'?\xb4\xf5\x01\xfa~a"s;

std::vector<char> b64 = base64_decode(input);
std::string b64_str(b64.begin(), b64.end());
BOOST_CHECK_EQUAL(expected_output, b64_str);
BOOST_CHECK_EQUAL(expected_output, std::string_view(b64.begin(), b64.end()));
} FC_LOG_AND_RETHROW();

BOOST_AUTO_TEST_CASE(base64urldec) try {
auto input = "YWJjMTIzJCYoKSc_tPUB-n5h"s;
auto expected_output = "abc123$&()'?\xb4\xf5\x01\xfa~a"s;

std::vector<char> b64 = base64url_decode(input);
std::string b64_str(b64.begin(), b64.end());
BOOST_CHECK_EQUAL(expected_output, b64_str);
BOOST_CHECK_EQUAL(expected_output, std::string_view(b64.begin(), b64.end()));
} FC_LOG_AND_RETHROW();

BOOST_AUTO_TEST_CASE(base64dec_extraequals) try {
auto input = "YWJjMTIzJCYoKSc/tPUB+n5h========="s;
auto expected_output = "abc123$&()'?\xb4\xf5\x01\xfa~a"s;

std::vector<char> b64 = base64_decode(input);
std::string b64_str(b64.begin(), b64.end());
BOOST_CHECK_EQUAL(expected_output, b64_str);
BOOST_CHECK_EQUAL(expected_output, std::string_view(b64.begin(), b64.end()));
} FC_LOG_AND_RETHROW();

BOOST_AUTO_TEST_CASE(base64dec_bad_stuff) try {
Expand Down

1 comment on commit b40b13f

@greg7mdp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even better :-)

Please sign in to comment.