aboutsummaryrefslogtreecommitdiff
path: root/src/test/base32_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/base32_tests.cpp')
-rw-r--r--src/test/base32_tests.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/base32_tests.cpp b/src/test/base32_tests.cpp
index d519eca859..3f7c5e99ee 100644
--- a/src/test/base32_tests.cpp
+++ b/src/test/base32_tests.cpp
@@ -6,6 +6,9 @@
#include <util/strencodings.h>
#include <boost/test/unit_test.hpp>
+#include <string>
+
+using namespace std::literals;
BOOST_FIXTURE_TEST_SUITE(base32_tests, BasicTestingSetup)
@@ -26,14 +29,14 @@ BOOST_AUTO_TEST_CASE(base32_testvectors)
// Decoding strings with embedded NUL characters should fail
bool failure;
- (void)DecodeBase32(std::string("invalid", 7), &failure);
- BOOST_CHECK_EQUAL(failure, true);
- (void)DecodeBase32(std::string("AWSX3VPP", 8), &failure);
- BOOST_CHECK_EQUAL(failure, false);
- (void)DecodeBase32(std::string("AWSX3VPP\0invalid", 16), &failure);
- BOOST_CHECK_EQUAL(failure, true);
- (void)DecodeBase32(std::string("AWSX3VPPinvalid", 15), &failure);
- BOOST_CHECK_EQUAL(failure, true);
+ (void)DecodeBase32("invalid\0"s, &failure); // correct size, invalid due to \0
+ BOOST_CHECK(failure);
+ (void)DecodeBase32("AWSX3VPP"s, &failure); // valid
+ BOOST_CHECK(!failure);
+ (void)DecodeBase32("AWSX3VPP\0invalid"s, &failure); // correct size, invalid due to \0
+ BOOST_CHECK(failure);
+ (void)DecodeBase32("AWSX3VPPinvalid"s, &failure); // invalid size
+ BOOST_CHECK(failure);
}
BOOST_AUTO_TEST_SUITE_END()