diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-11-04 09:03:04 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-11-09 17:42:13 +0100 |
commit | faa3ec2304051be7cfbe301cfbfbda3faf7514fc (patch) | |
tree | d4bd1d6efd163452352e275beec7674de246d9af /src/test/base64_tests.cpp | |
parent | fa18038f519db76befb9a7bd0b1540143bfeb12b (diff) |
span: Add std::byte helpers
Also, add Span<std::byte> interface to strencondings.
Diffstat (limited to 'src/test/base64_tests.cpp')
-rw-r--r-- | src/test/base64_tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/base64_tests.cpp b/src/test/base64_tests.cpp index 9d1dfd46f1..c5fce7bec0 100644 --- a/src/test/base64_tests.cpp +++ b/src/test/base64_tests.cpp @@ -23,6 +23,16 @@ BOOST_AUTO_TEST_CASE(base64_testvectors) BOOST_CHECK_EQUAL(strDec, vstrIn[i]); } + { + const std::vector<uint8_t> in_u{0xff, 0x01, 0xff}; + const std::vector<std::byte> in_b{std::byte{0xff}, std::byte{0x01}, std::byte{0xff}}; + const std::string in_s{"\xff\x01\xff"}; + const std::string out_exp{"/wH/"}; + BOOST_CHECK_EQUAL(EncodeBase64(in_u), out_exp); + BOOST_CHECK_EQUAL(EncodeBase64(in_b), out_exp); + BOOST_CHECK_EQUAL(EncodeBase64(in_s), out_exp); + } + // Decoding strings with embedded NUL characters should fail bool failure; (void)DecodeBase64("invalid\0"s, &failure); |