Implementation of Base64 encoder and decoder

This commit is contained in:
John Wellbelove 2024-06-24 17:44:53 +01:00
parent aab8630c1a
commit 208d8f9642
21 changed files with 381 additions and 2951 deletions

View File

@ -114,8 +114,8 @@ namespace etl
{
enum enum_type
{
//RFC_1421, // Not implemented yet
//RFC_2045, // Not implemented yet
//RFC_1421, // Not implemented
//RFC_2045, // Not implemented
RFC_2152,
RFC_3501,
RFC_4648,
@ -125,8 +125,8 @@ namespace etl
};
ETL_DECLARE_ENUM_TYPE(Encoding, int)
//ETL_ENUM_TYPE(RFC_1421, "RFC_1421") // Not implemented yet
//ETL_ENUM_TYPE(RFC_2045, "RFC_2045") // Not implemented yet
//ETL_ENUM_TYPE(RFC_1421, "RFC_1421") // Not implemented
//ETL_ENUM_TYPE(RFC_2045, "RFC_2045") // Not implemented
ETL_ENUM_TYPE(RFC_2152, "RFC_2152")
ETL_ENUM_TYPE(RFC_3501, "RFC_3501")
ETL_ENUM_TYPE(RFC_4648, "RFC_4648")

View File

@ -63,8 +63,8 @@ namespace etl
{
public:
typedef etl::span<const unsigned char> span_type;
typedef etl::delegate<void(span_type, bool)> callback_type;
typedef etl::span<const unsigned char> span_type;
typedef etl::delegate<void(const span_type&)> callback_type;
//*************************************************************************
/// Decode to Base64
@ -85,7 +85,7 @@ namespace etl
{
if (output_buffer_is_full())
{
callback(span(), false);
callback(span());
reset_output_buffer();
}
}
@ -144,7 +144,7 @@ namespace etl
ETL_CONSTEXPR14
bool decode_final(TInputIterator input_begin, TInputIterator input_end)
{
return (decode(input_begin, input_end) && flush());
return decode(input_begin, input_end) && flush();
}
//*************************************************************************
@ -154,7 +154,7 @@ namespace etl
ETL_CONSTEXPR14
bool decode_final(TInputIterator input_begin, size_t input_length)
{
return (decode(input_begin, input_length) && flush());
return decode(input_begin, input_length) && flush();
}
//*************************************************************************
@ -172,7 +172,15 @@ namespace etl
{
if (callback.is_valid())
{
callback(span(), true);
// Send any remaining data.
if (size() != 0)
{
callback(span());
}
// Indicate this was the final block.
callback(span_type());
reset_output_buffer();
}
}
@ -192,7 +200,7 @@ namespace etl
reset_output_buffer();
overflow_detected = false;
invalid_data_detected = false;
padding_received = false;
padding_received = false;
}
//*************************************************************************
@ -531,8 +539,8 @@ namespace etl
{
public:
static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_2152;
static ETL_CONSTANT size_t Buffer_Size = Buffer_Size_;
static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_2152;
static ETL_CONSTANT size_t Buffer_Size = Buffer_Size_;
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");

View File

@ -63,15 +63,15 @@ namespace etl
{
public:
typedef etl::span<const char> span_type;
typedef etl::delegate<void(span_type, bool)> callback_type;
typedef etl::span<const char> span_type;
typedef etl::delegate<void(const span_type&)> callback_type;
//*************************************************************************
/// Encode to Base64
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
void encode(T value)
bool encode(T value)
{
ETL_STATIC_ASSERT(ETL_IS_8_BIT_INTEGRAL(T), "Input type must be an 8 bit integral");
@ -86,11 +86,13 @@ namespace etl
{
if (output_buffer_is_full())
{
callback(span(), false);
callback(span());
reset_output_buffer();
}
}
}
return !error();
}
//*************************************************************************
@ -98,14 +100,19 @@ namespace etl
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14
void encode(TInputIterator input_begin, size_t input_length)
bool encode(TInputIterator input_begin, size_t input_length)
{
ETL_STATIC_ASSERT(ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(TInputIterator), "Input type must be an 8 bit integral");
while (input_length-- != 0)
{
encode(*input_begin++);
if (!encode(*input_begin++))
{
return false;
}
}
return true;
}
//*************************************************************************
@ -113,14 +120,19 @@ namespace etl
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14
void encode(TInputIterator input_begin, TInputIterator input_end)
bool encode(TInputIterator input_begin, TInputIterator input_end)
{
ETL_STATIC_ASSERT(ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(TInputIterator), "Input type must be an 8 bit integral");
while (input_begin != input_end)
{
encode(*input_begin++);
if (!encode(*input_begin++))
{
return false;
}
}
return true;
}
//*************************************************************************
@ -128,10 +140,9 @@ namespace etl
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14
void encode_final(TInputIterator input_begin, size_t input_length)
bool encode_final(TInputIterator input_begin, size_t input_length)
{
encode(input_begin, input_length);
flush();
return encode(input_begin, input_length) && flush();
}
//*************************************************************************
@ -139,28 +150,40 @@ namespace etl
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14
void encode_final(TInputIterator input_begin, TInputIterator input_end)
bool encode_final(TInputIterator input_begin, TInputIterator input_end)
{
encode(input_begin, input_end);
flush();
return encode(input_begin, input_end) && flush();
}
//*************************************************************************
/// Flush any remaining data to the output.
//*************************************************************************
ETL_CONSTEXPR14
void flush()
bool flush()
{
// Encode any remaining input data.
encode_block();
if (callback.is_valid())
{
callback(span(), true);
reset_output_buffer();
}
bool success = encode_block();
reset_input_buffer();
if (success)
{
if (callback.is_valid())
{
// Send any remaining data.
if (size() != 0)
{
callback(span());
}
// Indicate this was the final block.
callback(span_type());
reset_output_buffer();
}
}
return success;
}
//*************************************************************************
@ -255,6 +278,16 @@ namespace etl
return overflowed;
}
//*************************************************************************
/// Returns true if an error was detected.
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
bool error() const
{
return overflow();
}
protected:
//*************************************************************************
@ -281,7 +314,7 @@ namespace etl
/// Encode one block of data.
//*************************************************************************
ETL_CONSTEXPR14
void encode_block()
bool encode_block()
{
switch (input_buffer_length)
{
@ -341,6 +374,8 @@ namespace etl
}
ETL_ASSERT(!overflowed, ETL_ERROR(etl::base64_overflow));
return !overflowed;
}
//*************************************************************************
@ -473,8 +508,8 @@ namespace etl
{
public:
static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_2152;
static ETL_CONSTANT size_t Buffer_Size = Buffer_Size_;
static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_2152;
static ETL_CONSTANT size_t Buffer_Size = Buffer_Size_;
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0), "Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");

View File

@ -19,12 +19,18 @@ add_executable(etl_tests
test_array_view.cpp
test_array_wrapper.cpp
test_atomic.cpp
test_base64_RFC2152.cpp
test_base64_RFC3501.cpp
test_base64_RFC4648_with_no_padding.cpp
test_base64_RFC4648_with_padding.cpp
test_base64_RFC4648_URL_with_no_padding.cpp
test_base64_RFC4648_URL_with_padding.cpp
test_base64_RFC2152_decoder.cpp
test_base64_RFC2152_encoder.cpp
test_base64_RFC3501_decoder.cpp
test_base64_RFC3501_encoder.cpp
test_base64_RFC4648_decoder_with_no_padding.cpp
test_base64_RFC4648_decoder_with_padding.cpp
test_base64_RFC4648_encoder_with_no_padding.cpp
test_base64_RFC4648_encoder_with_padding.cpp
test_base64_RFC4648_URL_decoder_with_no_padding.cpp
test_base64_RFC4648_URL_decoder_with_padding.cpp
test_base64_RFC4648_URL_encoder_with_no_padding.cpp
test_base64_RFC4648_URL_encoder_with_padding.cpp
test_binary.cpp
test_bip_buffer_spsc_atomic.cpp
test_bit.cpp
@ -59,7 +65,7 @@ add_executable(etl_tests
test_container.cpp
test_correlation.cpp
test_covariance.cpp
test_crc.cpp
test_crc1.cpp
test_crc16.cpp
test_crc16_a.cpp
test_crc16_arc.cpp

View File

@ -95,7 +95,7 @@ SOFTWARE.
#define ETL_OBSERVER_FORCE_CPP03_IMPLEMENTATION
#define ETL_MESSAGE_ROUTER_FORCE_CPP03_IMPLEMENTATION
#define ETL_FSM_FORCE_CPP03_IMPLEMENTATION
#define ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION
//#define ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION // C++03 implementation is tested at the same time as the C++11 and above.
#define ETL_SINGLETON_FORCE_CPP03_IMPLEMENTATION
#define ETL_BYTE_FORCE_CPP03_IMPLEMENTATION
#define ETL_LIST_FORCE_CPP03_IMPLEMENTATION
@ -114,10 +114,6 @@ SOFTWARE.
#include "../include/etl/profiles/determine_compiler_version.h"
#include "../include/etl/profiles/determine_development_os.h"
//#if ETL_CPP17_NOT_SUPPORTED
// #error THE UNIT TESTS REQUIRE C++17 SUPPORT
//#endif
#if defined(ETL_COMPILER_GCC)
#if (ETL_COMPILER_VERSION < 8)
#define ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED

View File

@ -8,6 +8,18 @@ etl_test_sources = files(
'test_array_view.cpp',
'test_array_wrapper.cpp',
'test_atomic.cpp',
'test_base64_RFC2152_decoder.cppp',
'test_base64_RFC2152_encoder.cppp',
'test_base64_RFC3501_decoder.cppp',
'test_base64_RFC3501_encoder.cppp',
'test_base64_RFC4648_decoder_with_no_padding.cppp',
'test_base64_RFC4648_decoder_with_padding.cppp',
'test_base64_RFC4648_encoder_with_no_padding.cppp',
'test_base64_RFC4648_encoder_with_padding.cppp',
'test_base64_RFC4648_URL_decoder_with_no_padding.cppp',
'test_base64_RFC4648_URL_decoder_with_padding.cppp',
'test_base64_RFC4648_URL_encoder_with_no_padding.cppp',
'test_base64_RFC4648_URL_encoder_with_padding.cpp',
'test_binary.cpp',
'test_bip_buffer_spsc_atomic.cpp',
'test_bit.cpp',
@ -42,7 +54,7 @@ etl_test_sources = files(
'test_container.cpp',
'test_correlation.cpp',
'test_covariance.cpp',
'test_crc.cpp',
'test_crc1.cpp',
'test_crc16.cpp',
'test_crc16_a.cpp',
'test_crc16_arc.cpp',

View File

@ -29,12 +29,12 @@ PrintHeader()
{
echo "$TitleColour"
echo "============================================================================" | tee -a log.txt
echo " Configuration : $configuration_name" | tee -a log.txt
echo " Compiler : $compiler " | tee -a log.txt
echo " Language standard : C++$cxx_standard " | tee -a log.txt
echo " ETL version : $etl_version " | tee -a log.txt
echo " Git branch : $(ParseGitBranch) " | tee -a log.txt
echo " Processes : ${CMAKE_BUILD_PARALLEL_LEVEL}" | tee -a log.txt
echo " Configuration : $configuration_name" | tee -a log.txt
echo " Compiler : $compiler " | tee -a log.txt
echo " Language : C++$cxx_standard " | tee -a log.txt
echo " ETL version : $etl_version " | tee -a log.txt
echo " Git branch : $(ParseGitBranch) " | tee -a log.txt
echo " Processes : ${CMAKE_BUILD_PARALLEL_LEVEL}" | tee -a log.txt
echo "============================================================================" | tee -a log.txt
echo "$NoColour"
}
@ -43,7 +43,7 @@ PassedCompilation()
{
echo "$PassColour"
echo "-----------------------------------------------" | tee -a log.txt
echo " Passed Compilation - $configuration_name" | tee -a log.txt
echo " Compilation Success - $configuration_name" | tee -a log.txt
echo "-----------------------------------------------" | tee -a log.txt
echo "$NoColour"
}

View File

@ -38,14 +38,14 @@ PrintHeader()
{
echo "$TitleColour"
echo "============================================================================" | tee -a log.txt
echo " Configuration : $configuration_name" | tee -a log.txt
echo " Compiler : $compiler " | tee -a log.txt
echo " Language standard : C++$cxx_standard " | tee -a log.txt
echo " Optimisation : $opt " | tee -a log.txt
echo " Sanitizer : $sanitize " | tee -a log.txt
echo " ETL version : $etl_version " | tee -a log.txt
echo " Git branch : $(ParseGitBranch) " | tee -a log.txt
echo " Processes : ${CMAKE_BUILD_PARALLEL_LEVEL}" | tee -a log.txt
echo " Configuration : $configuration_name" | tee -a log.txt
echo " Compiler : $compiler " | tee -a log.txt
echo " Language : C++$cxx_standard " | tee -a log.txt
echo " Optimisation : $opt " | tee -a log.txt
echo " Sanitizer : $sanitize " | tee -a log.txt
echo " ETL version : $etl_version " | tee -a log.txt
echo " Git branch : $(ParseGitBranch) " | tee -a log.txt
echo " Processes : ${CMAKE_BUILD_PARALLEL_LEVEL}" | tee -a log.txt
echo "============================================================================" | tee -a log.txt
echo "$NoColour"
}
@ -67,7 +67,7 @@ PassedCompilation()
{
echo "$PassColour"
echo "-----------------------------------------------" | tee -a log.txt
echo " Passed Compilation - $configuration_name" | tee -a log.txt
echo " Compilation Success - $configuration_name" | tee -a log.txt
echo "-----------------------------------------------" | tee -a log.txt
echo "$NoColour"
}

View File

@ -28,6 +28,8 @@ SOFTWARE.
#include "unit_test_framework.h"
#include <iostream>
#include "etl/base64_decoder.h"
#include "etl/string.h"
@ -52,7 +54,27 @@ namespace
{
using codec = etl::base64_rfc2152_decoder<etl::base64::Min_Decode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc2152_decoder<etl::base64::Min_Decode_Buffer_Size * 10>;
#if (ETL_USING_CPP14)
using codec_full_buffer = etl::base64_rfc2152_decoder< etl::base64_rfc2152_decoder<>::safe_output_buffer_size(342)>;
#else
using codec_full_buffer = etl::base64_rfc2152_decoder<256>;
#endif
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -342,8 +364,8 @@ namespace
{
codec_full_buffer b64;
CHECK_EQUAL(etl::base64::Encoding::RFC_2152, codec_full_buffer::Encoding);
CHECK_EQUAL("RFC_2152", codec_full_buffer::Encoding.c_str());
CHECK_EQUAL(etl::base64::Encoding::RFC_2152, codec_full_buffer::Encoding);
CHECK_EQUAL("RFC_2152", codec_full_buffer::Encoding.c_str());
}
//*************************************************************************
@ -352,7 +374,7 @@ namespace
for (size_t i = 0; i < 256; ++i)
{
size_t minimum_size = i;
size_t safe_size = codec::safe_output_buffer_size(encoded[i].size());
size_t safe_size = codec::safe_output_buffer_size(encoded[i].size());
CHECK_TRUE(safe_size >= minimum_size);
CHECK_TRUE((safe_size - minimum_size) <= 2U);
@ -362,19 +384,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +406,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -432,19 +428,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -452,7 +435,7 @@ namespace
decoded_output.clear();
received_final_block = false;
auto start = encoded[i].data();
auto start = encoded[i].data();
auto length = encoded[i].size();
while (length >= 5)
@ -484,19 +467,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -536,19 +506,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -571,19 +528,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -606,19 +550,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -658,19 +589,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -710,19 +628,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -755,19 +660,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -866,7 +758,6 @@ namespace
TEST(test_decode_overflow)
{
codec b64;
std::array<unsigned char, 1> decoded_output{ 0 };
#if ETL_USING_EXCEPTIONS
CHECK_THROW((b64.decode(encoded[10].data(), encoded[10].size())), etl::base64_overflow);
@ -880,7 +771,6 @@ namespace
TEST(test_decode_invalid_character)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycDQ#37KA");

View File

@ -53,7 +53,26 @@ namespace
{
using codec = etl::base64_rfc2152_encoder<etl::base64::Min_Encode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc2152_encoder<etl::base64::Min_Encode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc2152_encoder<etl::base64_rfc2152_encoder<>::safe_output_buffer_size(256)>;
#else
using codec_full_buffer = etl::base64_rfc2152_encoder<344>;
#endif
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -363,19 +382,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -431,19 +424,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -481,19 +461,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -531,19 +498,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -565,19 +519,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -599,19 +540,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -649,19 +577,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -699,19 +614,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -743,19 +645,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -787,14 +676,11 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_blocks_with_no_callback_and_full_size_buffer)
{
std::string actual;
codec_full_buffer b64;
for (size_t i = 250; i < 256; ++i)
{
b64.restart();
actual.clear();
auto start = input_data.data();
auto length = i;

View File

@ -52,7 +52,26 @@ namespace
{
using codec = etl::base64_rfc3501_decoder<etl::base64::Min_Decode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc3501_decoder<etl::base64::Min_Decode_Buffer_Size * 10>;
#if (ETL_USING_CPP14)
using codec_full_buffer = etl::base64_rfc3501_decoder< etl::base64_rfc3501_decoder<>::safe_output_buffer_size(342)>;
#else
using codec_full_buffer = etl::base64_rfc3501_decoder<256>;
#endif
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -362,19 +381,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -382,14 +388,7 @@ namespace
decoded_output.clear();
received_final_block = false;
try
{
b64.decode_final(encoded[i].data(), encoded[i].size());
}
catch (etl::exception e)
{
auto what = e.what();
}
b64.decode_final(encoded[i].data(), encoded[i].size());
std::vector<unsigned char> expected(input_data.begin(), input_data.begin() + i);
std::vector<unsigned char> actual(decoded_output);
@ -404,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -439,19 +425,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -491,19 +464,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -543,19 +503,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -578,19 +525,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -613,19 +547,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -665,19 +586,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -717,19 +625,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -762,19 +657,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -873,7 +755,6 @@ namespace
TEST(test_decode_overflow)
{
codec b64;
std::array<unsigned char, 1> decoded_output{ 0 };
#if ETL_USING_EXCEPTIONS
CHECK_THROW((b64.decode(encoded[10].data(), encoded[10].size())), etl::base64_overflow);
@ -887,7 +768,6 @@ namespace
TEST(test_decode_invalid_character)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycDQ#37KA");

View File

@ -53,7 +53,26 @@ namespace
{
using codec = etl::base64_rfc3501_encoder<etl::base64::Min_Encode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc3501_encoder<etl::base64::Min_Encode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc3501_encoder<etl::base64_rfc3501_encoder<>::safe_output_buffer_size(256)>;
#else
using codec_full_buffer = etl::base64_rfc3501_encoder<344>;
#endif
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -363,19 +382,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -431,19 +424,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -481,19 +461,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -531,19 +498,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -565,19 +519,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -599,19 +540,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -649,19 +577,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -699,19 +614,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -743,19 +645,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -787,14 +676,11 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_blocks_with_no_callback_and_full_size_buffer)
{
std::string actual;
codec_full_buffer b64;
for (size_t i = 250; i < 256; ++i)
{
b64.restart();
actual.clear();
auto start = input_data.data();
auto length = i;

View File

@ -52,7 +52,26 @@ namespace
{
using codec = etl::base64_rfc4648_url_decoder<etl::base64::Min_Decode_Buffer_Size> ;
using codec_larger_buffer = etl::base64_rfc4648_url_decoder<etl::base64::Min_Decode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_url_decoder<etl::base64_rfc4648_url_decoder<>::safe_output_buffer_size(342)>;
#else
using codec_full_buffer = etl::base64_rfc4648_url_decoder<256>;
#endif
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -362,19 +381,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -432,19 +425,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -484,19 +464,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -536,19 +503,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -571,19 +525,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -606,19 +547,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -658,19 +586,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -710,19 +625,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -755,19 +657,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -866,7 +755,6 @@ namespace
TEST(test_decode_overflow)
{
codec b64;
std::array<unsigned char, 1> decoded_output{ 0 };
#if ETL_USING_EXCEPTIONS
CHECK_THROW((b64.decode(encoded[10].data(), encoded[10].size())), etl::base64_overflow);
@ -880,7 +768,6 @@ namespace
TEST(test_decode_invalid_character)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycDQ#37KA");
@ -896,7 +783,6 @@ namespace
TEST(test_decode_invalid_padding)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycD=y37KA");

View File

@ -52,7 +52,26 @@ namespace
{
using codec = etl::base64_rfc4648_url_padding_decoder<etl::base64::Min_Decode_Buffer_Size> ;
using codec_larger_buffer = etl::base64_rfc4648_url_padding_decoder<etl::base64::Min_Decode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_url_padding_decoder<etl::base64_rfc4648_url_padding_decoder<>::safe_output_buffer_size(344)>;
#else
using codec_full_buffer = etl::base64_rfc4648_url_padding_decoder<256>;
#endif
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -362,19 +381,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -432,19 +425,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -484,19 +464,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -536,19 +503,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -571,19 +525,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -606,19 +547,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -658,19 +586,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -710,19 +625,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -755,19 +657,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -866,7 +755,6 @@ namespace
TEST(test_decode_overflow)
{
codec b64;
std::array<unsigned char, 1> decoded_output{ 0 };
#if ETL_USING_EXCEPTIONS
CHECK_THROW((b64.decode(encoded[10].data(), encoded[10].size())), etl::base64_overflow);
@ -880,7 +768,6 @@ namespace
TEST(test_decode_invalid_character)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycDQ#37KA");
@ -896,7 +783,6 @@ namespace
TEST(test_decode_invalid_padding)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycD=y37KA==");
@ -909,4 +795,3 @@ namespace
}
};
}

View File

@ -53,7 +53,26 @@ namespace
{
using codec = etl::base64_rfc4648_url_encoder<etl::base64::Min_Encode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc4648_url_encoder<etl::base64::Min_Encode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_url_encoder<etl::base64_rfc4648_url_encoder<>::safe_output_buffer_size(256)>;
#else
using codec_full_buffer = etl::base64_rfc4648_url_encoder<344>;
#endif
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -363,19 +382,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -431,19 +424,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -481,19 +461,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -531,19 +498,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -565,19 +519,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -599,19 +540,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -649,19 +577,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -699,19 +614,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -743,19 +645,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -787,14 +676,11 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_blocks_with_no_callback_and_full_size_buffer)
{
std::string actual;
codec_full_buffer b64;
for (size_t i = 250; i < 256; ++i)
{
b64.restart();
actual.clear();
auto start = input_data.data();
auto length = i;

View File

@ -53,7 +53,26 @@ namespace
{
using codec = etl::base64_rfc4648_url_padding_encoder<etl::base64::Min_Encode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc4648_url_padding_encoder<etl::base64::Min_Encode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_url_padding_encoder<etl::base64_rfc4648_url_padding_encoder<>::safe_output_buffer_size(256)>;
#else
using codec_full_buffer = etl::base64_rfc4648_url_padding_encoder<344>;
#endif
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -363,19 +382,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -431,19 +424,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -481,19 +461,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -531,19 +498,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -565,19 +519,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -599,19 +540,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -649,19 +577,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -699,19 +614,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -743,19 +645,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -787,14 +676,11 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_blocks_with_no_callback_and_full_size_buffer)
{
std::string actual;
codec_full_buffer b64;
for (size_t i = 250; i < 256; ++i)
{
b64.restart();
actual.clear();
auto start = input_data.data();
auto length = i;

View File

@ -52,7 +52,26 @@ namespace
{
using codec = etl::base64_rfc4648_decoder<etl::base64::Min_Decode_Buffer_Size> ;
using codec_larger_buffer = etl::base64_rfc4648_decoder<etl::base64::Min_Decode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_decoder< etl::base64_rfc4648_decoder<>::safe_output_buffer_size(342)>;
#else
using codec_full_buffer = etl::base64_rfc4648_decoder<256>;
#endif
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -362,19 +381,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -432,19 +425,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -484,19 +464,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -536,19 +503,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -571,19 +525,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -606,19 +547,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -658,19 +586,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -710,19 +625,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -755,19 +657,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -866,7 +755,6 @@ namespace
TEST(test_decode_overflow)
{
codec b64;
std::array<unsigned char, 1> decoded_output{ 0 };
#if ETL_USING_EXCEPTIONS
CHECK_THROW((b64.decode(encoded[10].data(), encoded[10].size())), etl::base64_overflow);
@ -880,7 +768,6 @@ namespace
TEST(test_decode_invalid_character)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycDQ#37KA");
@ -896,7 +783,6 @@ namespace
TEST(test_decode_invalid_padding)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycD=y37KA");

View File

@ -52,7 +52,26 @@ namespace
{
using codec = etl::base64_rfc4648_padding_decoder<etl::base64::Min_Decode_Buffer_Size> ;
using codec_larger_buffer = etl::base64_rfc4648_padding_decoder<etl::base64::Min_Decode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_padding_decoder<etl::base64_rfc4648_padding_decoder<>::safe_output_buffer_size(344)>;
#else
using codec_full_buffer = etl::base64_rfc4648_padding_decoder<256>;
#endif
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -362,19 +381,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -432,19 +425,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -484,19 +464,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_size_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -536,19 +503,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -571,19 +525,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_single_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -606,19 +547,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -658,19 +586,6 @@ namespace
//*************************************************************************
TEST(test_decode_pointer_pointer_multi_pass_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -710,19 +625,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec::callback_type callback = [&decoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -755,19 +657,6 @@ namespace
//*************************************************************************
TEST(test_decode_multi_pass_by_char_with_callback_and_larger_buffer)
{
std::vector<unsigned char> decoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&decoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(decoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -894,7 +783,6 @@ namespace
TEST(test_decode_invalid_padding)
{
codec_larger_buffer b64;
std::array<unsigned char, 50U> decoded_output{ 0 };
std::string invalid_chararacter("OycD=y37KA==");

View File

@ -53,7 +53,26 @@ namespace
{
using codec = etl::base64_rfc4648_encoder<etl::base64::Min_Encode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc4648_encoder<etl::base64::Min_Encode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_encoder<etl::base64_rfc4648_encoder<>::safe_output_buffer_size(256)>;
#else
using codec_full_buffer = etl::base64_rfc4648_encoder<344>;
#endif
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -363,19 +382,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -431,19 +424,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -481,19 +461,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -531,19 +498,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -565,19 +519,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -599,19 +540,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -649,19 +577,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -699,19 +614,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -743,19 +645,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -787,14 +676,11 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_blocks_with_no_callback_and_full_size_buffer)
{
std::string actual;
codec_full_buffer b64;
for (size_t i = 250; i < 256; ++i)
{
b64.restart();
actual.clear();
auto start = input_data.data();
auto length = i;

View File

@ -53,7 +53,26 @@ namespace
{
using codec = etl::base64_rfc4648_padding_encoder<etl::base64::Min_Encode_Buffer_Size>;
using codec_larger_buffer = etl::base64_rfc4648_padding_encoder<etl::base64::Min_Encode_Buffer_Size * 10>;
#if ETL_USING_CPP14
using codec_full_buffer = etl::base64_rfc4648_padding_encoder<etl::base64_rfc4648_padding_encoder<>::safe_output_buffer_size(256)>;
#else
using codec_full_buffer = etl::base64_rfc4648_padding_encoder<344>;
#endif
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [](const codec::span_type& sp)
{
if (sp.empty())
{
received_final_block = true;
}
else
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
}
};
std::array<unsigned char, 256> input_data =
{
@ -363,19 +382,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -397,19 +403,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_single_pass_with_callback_and_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -431,19 +424,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -481,19 +461,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_size_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -531,19 +498,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -565,19 +519,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_single_pass_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -599,19 +540,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -649,19 +577,6 @@ namespace
//*************************************************************************
TEST(test_encode_pointer_pointer_multi_pass_blocks_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -699,19 +614,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback)
{
std::string encoded_output;
bool received_final_block = false;
codec::callback_type callback = [&encoded_output, &received_final_block](codec::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -743,19 +645,6 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_by_char_with_callback_larger_buffer)
{
std::string encoded_output;
bool received_final_block = false;
codec_larger_buffer::callback_type callback = [&encoded_output, &received_final_block](codec_larger_buffer::span_type sp, bool final)
{
std::copy(sp.begin(), sp.end(), std::back_inserter(encoded_output));
if (final)
{
received_final_block = true;
}
};
codec_larger_buffer b64(callback);
for (size_t i = 0; i < 256; ++i)
@ -787,14 +676,11 @@ namespace
//*************************************************************************
TEST(test_encode_multi_pass_blocks_with_no_callback_and_full_size_buffer)
{
std::string actual;
codec_full_buffer b64;
for (size_t i = 250; i < 256; ++i)
{
b64.restart();
actual.clear();
auto start = input_data.data();
auto length = i;
@ -823,32 +709,32 @@ namespace
//*************************************************************************
#if ETL_USING_CPP14
//template <size_t Size>
//constexpr auto GetConstexprBase64(const etl::array<int8_t, Size> input) noexcept
//{
// etl::array<char, 14> output{ 0 };
//
// using codec = etl::base64_rfc4648_encoder<etl::base64::Padding::No_Padding, codec::safe_output_buffer_size(Size)>;
//
// codec b64;
// b64.encode_final(input.begin(), input.end());
// etl::copy(b64.begin(), b64.end(), output.begin());
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<int8_t, Size> input) noexcept
{
etl::array<char, 14> output{ 0 };
using codec = etl::base64_rfc4648_encoder<codec::safe_output_buffer_size(Size)>;
codec b64;
b64.encode_final(input.begin(), input.end());
etl::copy(b64.begin(), b64.end(), output.begin());
// return output;
//}
return output;
}
//TEST(test_encode_constexpr)
//{
// constexpr etl::array<int8_t, 10> input = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
TEST(test_encode_constexpr)
{
constexpr etl::array<int8_t, 10> input = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
// constexpr auto output{ GetConstexprBase64(input) };
constexpr auto output{ GetConstexprBase64(input) };
// std::string expected("AAECAwQFBgcICQ");
// std::string actual(output.data(), output.size());
std::string expected("AAECAwQFBgcICQ");
std::string actual(output.data(), output.size());
// CHECK_EQUAL(expected, actual);
// CHECK_TRUE(codec::safe_output_buffer_size(10) >= output.size());
//}
CHECK_EQUAL(expected, actual);
CHECK_TRUE(codec::safe_output_buffer_size(10) >= output.size());
}
#endif
//*************************************************************************

File diff suppressed because it is too large Load Diff