From ce24b0cc6eb459510725178145e73fe7e36d77a1 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 26 Jun 2024 14:56:00 +0100 Subject: [PATCH] Refactored base64 encoder and decoder --- include/etl/base64_decoder.h | 148 ++++++------------ include/etl/base64_encoder.h | 98 +++--------- test/test_base64_RFC2152_decoder.cpp | 11 +- test/test_base64_RFC2152_encoder.cpp | 11 +- test/test_base64_RFC3501_decoder.cpp | 11 +- test/test_base64_RFC3501_encoder.cpp | 11 +- ...64_RFC4648_URL_decoder_with_no_padding.cpp | 11 +- ...ase64_RFC4648_URL_decoder_with_padding.cpp | 11 +- ...64_RFC4648_URL_encoder_with_no_padding.cpp | 11 +- ...ase64_RFC4648_URL_encoder_with_padding.cpp | 11 +- ...base64_RFC4648_decoder_with_no_padding.cpp | 11 +- ...st_base64_RFC4648_decoder_with_padding.cpp | 11 +- ...base64_RFC4648_encoder_with_no_padding.cpp | 11 +- ...st_base64_RFC4648_encoder_with_padding.cpp | 11 +- 14 files changed, 81 insertions(+), 297 deletions(-) diff --git a/include/etl/base64_decoder.h b/include/etl/base64_decoder.h index 6ceca45c8..5ccc98a6b 100644 --- a/include/etl/base64_decoder.h +++ b/include/etl/base64_decoder.h @@ -125,7 +125,7 @@ namespace etl bool decode(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) { if (!decode(*input_begin++)) @@ -136,7 +136,7 @@ namespace etl return true; } - + //************************************************************************* /// Decode from Base64 //************************************************************************* @@ -198,9 +198,9 @@ namespace etl { reset_input_buffer(); reset_output_buffer(); - overflow_detected = false; + overflow_detected = false; invalid_data_detected = false; - padding_received = false; + padding_received = false; } //************************************************************************* @@ -248,8 +248,8 @@ namespace etl /// This only returns a useful value if a callback has not been set or called. //************************************************************************* ETL_NODISCARD - ETL_CONSTEXPR14 - size_t size() const + ETL_CONSTEXPR14 + size_t size() const { return output_buffer_length; } @@ -328,7 +328,7 @@ namespace etl , padding_received(false) { } - + //************************************************************************* /// Calculates the minimum buffer size required to decode from Base64 //************************************************************************* @@ -339,7 +339,7 @@ namespace etl { return input_length - (input_length / 4U); } - + private: //************************************************************************* @@ -350,8 +350,8 @@ namespace etl uint32_t get_index_from_sextet(T sextet) { const char* encoder_table_end = encoder_table + 64; - const char* p_sextet = etl::find(encoder_table, encoder_table_end, static_cast(sextet)); - + const char* p_sextet = etl::find(encoder_table, encoder_table_end, static_cast(sextet)); + if (p_sextet != encoder_table_end) { return static_cast(etl::distance(encoder_table, p_sextet)); @@ -362,7 +362,7 @@ namespace etl return 0; } } - + //************************************************************************* /// Gets the padding character //************************************************************************* @@ -374,7 +374,7 @@ namespace etl { return static_cast('='); } - + //************************************************************************* /// Decode one block of data. //************************************************************************* @@ -399,7 +399,7 @@ namespace etl sextets = sextets | (get_index_from_sextet(input_buffer[1]) << 6); sextets = sextets | (get_index_from_sextet(input_buffer[2])); push_to_output_buffer((sextets >> 10) & 0xFF); - push_to_output_buffer((sextets >> 2) & 0xFF); + push_to_output_buffer((sextets >> 2) & 0xFF); break; } @@ -414,8 +414,8 @@ namespace etl // Write out three octets push_to_output_buffer((sextets >> 16) & 0xFF); - push_to_output_buffer((sextets >> 8) & 0xFF); - push_to_output_buffer((sextets >> 0) & 0xFF); + push_to_output_buffer((sextets >> 8) & 0xFF); + push_to_output_buffer((sextets >> 0) & 0xFF); break; } @@ -426,7 +426,7 @@ namespace etl } ETL_ASSERT(!invalid_data_detected, ETL_ERROR(etl::base64_invalid_data)); - ETL_ASSERT(!overflow_detected, ETL_ERROR(etl::base64_overflow)); + ETL_ASSERT(!overflow_detected, ETL_ERROR(etl::base64_overflow)); return (!invalid_data_detected && !overflow_detected); } @@ -534,14 +534,11 @@ namespace etl //************************************************************************* /// Base64 RFC-2152 Decoder //************************************************************************* - template + template class base64_rfc2152_decoder : public ibase64_decoder { public: - 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"); //************************************************************************* @@ -554,7 +551,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -568,7 +565,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -589,23 +586,14 @@ namespace etl unsigned char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc2152_decoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc2152_decoder::Buffer_Size; - //************************************************************************* -/// Base64 RFC-3501 Decoder -//************************************************************************* - template + /// Base64 RFC-3501 Decoder + //************************************************************************* + template class base64_rfc3501_decoder : public ibase64_decoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_3501; - 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"); //************************************************************************* @@ -618,7 +606,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -632,7 +620,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -653,23 +641,14 @@ namespace etl unsigned char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc3501_decoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc3501_decoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648 Decoder //************************************************************************* - template + template class base64_rfc4648_decoder : public ibase64_decoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648; - 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"); //************************************************************************* @@ -682,7 +661,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -696,7 +675,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -704,9 +683,9 @@ namespace etl /// Calculate the required output encode buffer size. //************************************************************************* ETL_NODISCARD - static - ETL_CONSTEXPR14 - size_t safe_output_buffer_size(size_t input_length) + static + ETL_CONSTEXPR14 + size_t safe_output_buffer_size(size_t input_length) { return ibase64_decoder::decoded_size_from_valid_input_length(input_length); } @@ -717,23 +696,14 @@ namespace etl unsigned char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_decoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_decoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648-Padding Decoder //************************************************************************* - template + template class base64_rfc4648_padding_decoder : public ibase64_decoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648_PADDING; - 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"); //************************************************************************* @@ -746,7 +716,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -760,7 +730,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -781,23 +751,14 @@ namespace etl unsigned char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_padding_decoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_padding_decoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648-URL Decoder //************************************************************************* - template + template class base64_rfc4648_url_decoder : public ibase64_decoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648_URL; - 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"); //************************************************************************* @@ -810,7 +771,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -824,7 +785,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -832,9 +793,9 @@ namespace etl /// Calculate the required output encode buffer size. //************************************************************************* ETL_NODISCARD - static - ETL_CONSTEXPR14 - size_t safe_output_buffer_size(size_t input_length) + static + ETL_CONSTEXPR14 + size_t safe_output_buffer_size(size_t input_length) { return ibase64_decoder::decoded_size_from_valid_input_length(input_length); } @@ -845,36 +806,27 @@ namespace etl unsigned char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_url_decoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_url_decoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648-URL-Padding Decoder //************************************************************************* - template + template class base64_rfc4648_url_padding_decoder : public ibase64_decoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648_URL_PADDING; - 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"); //************************************************************************* /// Base64 RFC-4648-Padding constructor. //************************************************************************* ETL_CONSTEXPR14 - base64_rfc4648_url_padding_decoder() + base64_rfc4648_url_padding_decoder() : ibase64_decoder(etl::base64::character_set_2(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -882,13 +834,13 @@ namespace etl /// Base64 RFC-4648-Padding constructor. //************************************************************************* ETL_CONSTEXPR14 - base64_rfc4648_url_padding_decoder(callback_type callback_) + base64_rfc4648_url_padding_decoder(callback_type callback_) : ibase64_decoder(etl::base64::character_set_2(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -896,9 +848,9 @@ namespace etl /// Calculate the required output encode buffer size. //************************************************************************* ETL_NODISCARD - static - ETL_CONSTEXPR14 - size_t safe_output_buffer_size(size_t input_length) + static + ETL_CONSTEXPR14 + size_t safe_output_buffer_size(size_t input_length) { return ibase64_decoder::decoded_size_from_valid_input_length(input_length); } @@ -908,12 +860,6 @@ namespace etl /// The internal output buffer. unsigned char output_buffer[Buffer_Size]; }; - - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_url_padding_decoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_url_padding_decoder::Buffer_Size; } #undef ETL_IS_TYPE_8_BIT_INTEGRAL diff --git a/include/etl/base64_encoder.h b/include/etl/base64_encoder.h index dbee71104..4f6ea0b7d 100644 --- a/include/etl/base64_encoder.h +++ b/include/etl/base64_encoder.h @@ -503,14 +503,11 @@ namespace etl //************************************************************************* /// Base64 RFC-2152 Encoder //************************************************************************* - template + template class base64_rfc2152_encoder : public ibase64_encoder { public: - 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"); @@ -524,7 +521,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -538,7 +535,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -559,23 +556,14 @@ namespace etl char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc2152_encoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc2152_encoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-3501 Encoder //************************************************************************* - template + template class base64_rfc3501_encoder : public ibase64_encoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_3501; - 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"); @@ -589,7 +577,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -603,7 +591,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -624,25 +612,16 @@ namespace etl char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc3501_encoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc3501_encoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648 Encoder //************************************************************************* - template + template class base64_rfc4648_encoder : public ibase64_encoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648; - 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"); + 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"); //************************************************************************* /// Base64 RFC-4648 constructor. @@ -654,7 +633,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -668,7 +647,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -689,23 +668,14 @@ namespace etl char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_encoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_encoder::Buffer_Size; - //************************************************************************* -/// Base64 RFC-4648-Padding Encoder -//************************************************************************* - template + /// Base64 RFC-4648-Padding Encoder + //************************************************************************* + template class base64_rfc4648_padding_encoder : public ibase64_encoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648_PADDING; - 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"); @@ -719,7 +689,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -733,7 +703,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -754,23 +724,14 @@ namespace etl char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_padding_encoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_padding_encoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648-URL Encoder //************************************************************************* - template + template class base64_rfc4648_url_encoder : public ibase64_encoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648_URL; - 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"); @@ -784,7 +745,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -798,7 +759,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -819,23 +780,14 @@ namespace etl char output_buffer[Buffer_Size]; }; - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_url_encoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_url_encoder::Buffer_Size; - //************************************************************************* /// Base64 RFC-4648-URL_Padding Encoder //************************************************************************* - template + template class base64_rfc4648_url_padding_encoder : public ibase64_encoder { public: - static ETL_CONSTANT etl::base64::Encoding Encoding = etl::base64::Encoding::RFC_4648_URL; - 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"); @@ -849,7 +801,7 @@ namespace etl output_buffer, Buffer_Size, callback_type()) - , output_buffer{} + , output_buffer() { } @@ -863,7 +815,7 @@ namespace etl output_buffer, Buffer_Size, callback_) - , output_buffer{} + , output_buffer() { } @@ -883,12 +835,6 @@ namespace etl /// The internal output buffer. char output_buffer[Buffer_Size]; }; - - template - ETL_CONSTANT etl::base64::Encoding base64_rfc4648_url_padding_encoder::Encoding; - - template - ETL_CONSTANT size_t base64_rfc4648_url_padding_encoder::Buffer_Size; } #undef ETL_IS_TYPE_8_BIT_INTEGRAL diff --git a/test/test_base64_RFC2152_decoder.cpp b/test/test_base64_RFC2152_decoder.cpp index f8a434515..2428095e6 100644 --- a/test/test_base64_RFC2152_decoder.cpp +++ b/test/test_base64_RFC2152_decoder.cpp @@ -357,17 +357,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j/cebMXjnZljpYhuYjRbdDd/9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva/sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub/pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7/yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1/u0vQ" }; - SUITE(test_base64_rfc2152_with_no_padding) + SUITE(test_base64_rfc2152_decoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - 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()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC2152_encoder.cpp b/test/test_base64_RFC2152_encoder.cpp index ecf5051c5..bd4c2b132 100644 --- a/test/test_base64_RFC2152_encoder.cpp +++ b/test/test_base64_RFC2152_encoder.cpp @@ -355,17 +355,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j/cebMXjnZljpYhuYjRbdDd/9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva/sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub/pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7/yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1/u0vQ" }; - SUITE(test_base64_rfc2152_with_no_padding) + SUITE(test_base64_rfc2152_encoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - 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()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC3501_decoder.cpp b/test/test_base64_RFC3501_decoder.cpp index 5a57b5a1a..609157244 100644 --- a/test/test_base64_RFC3501_decoder.cpp +++ b/test/test_base64_RFC3501_decoder.cpp @@ -354,17 +354,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j,cebMXjnZljpYhuYjRbdDd,9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva,sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub,pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7,yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1,u0vQ" }; - SUITE(test_base64_rfc3501_with_no_padding) + SUITE(test_base64_rfc3501_decoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_3501, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_3501", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC3501_encoder.cpp b/test/test_base64_RFC3501_encoder.cpp index b975e84fd..de54cbe62 100644 --- a/test/test_base64_RFC3501_encoder.cpp +++ b/test/test_base64_RFC3501_encoder.cpp @@ -355,17 +355,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j,cebMXjnZljpYhuYjRbdDd,9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva,sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub,pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7,yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1,u0vQ" }; - SUITE(test_base64_rfc3501_with_no_padding) + SUITE(test_base64_rfc3501_encoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_3501, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_3501", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_URL_decoder_with_no_padding.cpp b/test/test_base64_RFC4648_URL_decoder_with_no_padding.cpp index c3bb650d8..bf8e177ef 100644 --- a/test/test_base64_RFC4648_URL_decoder_with_no_padding.cpp +++ b/test/test_base64_RFC4648_URL_decoder_with_no_padding.cpp @@ -354,17 +354,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N-27j_cebMXjnZljpYhuYjRbdDd_9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva_sgO5xJ-06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj-ycBQpH40jLsHqzvl-bN8co4QrJDWnY8gLH4u6Ub_pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7_yzVh7RQtMMGLPurxp3qFI8ns3eITQ-H7VU1_u0vQ==" }; - SUITE(test_base64_rfc4648_url_with_no_padding) + SUITE(test_base64_rfc4648_url_decoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648_URL, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648_URL", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_URL_decoder_with_padding.cpp b/test/test_base64_RFC4648_URL_decoder_with_padding.cpp index 6dd57f44e..96bd3c749 100644 --- a/test/test_base64_RFC4648_URL_decoder_with_padding.cpp +++ b/test/test_base64_RFC4648_URL_decoder_with_padding.cpp @@ -354,17 +354,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N-27j_cebMXjnZljpYhuYjRbdDd_9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva_sgO5xJ-06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj-ycBQpH40jLsHqzvl-bN8co4QrJDWnY8gLH4u6Ub_pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7_yzVh7RQtMMGLPurxp3qFI8ns3eITQ-H7VU1_u0vQ==" }; - SUITE(test_base64_rfc4648_url_with_padding) + SUITE(test_base64_rfc4648_url_decoder_with_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648_URL_PADDING, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648_URL_PADDING", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_URL_encoder_with_no_padding.cpp b/test/test_base64_RFC4648_URL_encoder_with_no_padding.cpp index 1a4b59a4b..0b97f8c99 100644 --- a/test/test_base64_RFC4648_URL_encoder_with_no_padding.cpp +++ b/test/test_base64_RFC4648_URL_encoder_with_no_padding.cpp @@ -355,17 +355,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N-27j_cebMXjnZljpYhuYjRbdDd_9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva_sgO5xJ-06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj-ycBQpH40jLsHqzvl-bN8co4QrJDWnY8gLH4u6Ub_pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7_yzVh7RQtMMGLPurxp3qFI8ns3eITQ-H7VU1_u0vQ==" }; - SUITE(test_base64_rfc4648_url_with_no_padding) + SUITE(test_base64_rfc4648_url_encoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648_URL, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648_URL", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_URL_encoder_with_padding.cpp b/test/test_base64_RFC4648_URL_encoder_with_padding.cpp index e3f8b3e2e..90a955274 100644 --- a/test/test_base64_RFC4648_URL_encoder_with_padding.cpp +++ b/test/test_base64_RFC4648_URL_encoder_with_padding.cpp @@ -355,17 +355,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N-27j_cebMXjnZljpYhuYjRbdDd_9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva_sgO5xJ-06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj-ycBQpH40jLsHqzvl-bN8co4QrJDWnY8gLH4u6Ub_pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7_yzVh7RQtMMGLPurxp3qFI8ns3eITQ-H7VU1_u0vQ==" }; - SUITE(test_base64_rfc4648_url_with_no_padding) + SUITE(test_base64_rfc4648_url_encoder_with_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648_URL, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648_URL", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_decoder_with_no_padding.cpp b/test/test_base64_RFC4648_decoder_with_no_padding.cpp index b8ca1eae4..ea21ebcce 100644 --- a/test/test_base64_RFC4648_decoder_with_no_padding.cpp +++ b/test/test_base64_RFC4648_decoder_with_no_padding.cpp @@ -354,17 +354,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j/cebMXjnZljpYhuYjRbdDd/9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva/sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub/pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7/yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1/u0vQ" }; - SUITE(test_base64_rfc4648_with_no_padding) + SUITE(test_base64_rfc4648_decoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_decoder_with_padding.cpp b/test/test_base64_RFC4648_decoder_with_padding.cpp index 43229afbd..6d910ecd1 100644 --- a/test/test_base64_RFC4648_decoder_with_padding.cpp +++ b/test/test_base64_RFC4648_decoder_with_padding.cpp @@ -354,17 +354,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j/cebMXjnZljpYhuYjRbdDd/9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva/sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub/pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7/yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1/u0vQ==" }; - SUITE(test_base64_rfc4648_with_no_padding) + SUITE(test_base64_rfc4648_decoder_with_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648_PADDING, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648_PADDING", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_encoder_with_no_padding.cpp b/test/test_base64_RFC4648_encoder_with_no_padding.cpp index 21b225796..2d964d804 100644 --- a/test/test_base64_RFC4648_encoder_with_no_padding.cpp +++ b/test/test_base64_RFC4648_encoder_with_no_padding.cpp @@ -355,17 +355,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j/cebMXjnZljpYhuYjRbdDd/9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva/sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub/pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7/yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1/u0vQ" }; - SUITE(test_base64_rfc4648_with_no_padding) + SUITE(test_base64_rfc4648_encoder_with_no_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) { diff --git a/test/test_base64_RFC4648_encoder_with_padding.cpp b/test/test_base64_RFC4648_encoder_with_padding.cpp index 56e9f8228..148b1fe42 100644 --- a/test/test_base64_RFC4648_encoder_with_padding.cpp +++ b/test/test_base64_RFC4648_encoder_with_padding.cpp @@ -355,17 +355,8 @@ namespace "OycDQy37KCphrrxJcTIBFWlcXvXVm96lV8nBfYDeTIHAzyrRhlbVcTfrgDLf5N+27j/cebMXjnZljpYhuYjRbdDd/9qoek31cXf9LvLkQHKMgwBvE3JT5GtwDjfKJc1oYsCrFMdZg9KCjJNtEyHACPltrIR4SYRva/sgO5xJ+06AaYIlhpXVTZHt0ncqJECK302ALc3VWiamcRVCDj+ycBQpH40jLsHqzvl+bN8co4QrJDWnY8gLH4u6Ub/pUYDSI7XRtFmufTAdABzYcGwWccdWCP6BrvvgktjbuVd8mctC7/yzVh7RQtMMGLPurxp3qFI8ns3eITQ+H7VU1/u0vQ==" }; - SUITE(test_base64_rfc4648_with_padding) + SUITE(test_base64_rfc4648_encoder_with_padding) { - //************************************************************************* - TEST(test_basic_information) - { - codec_full_buffer b64; - - CHECK_EQUAL(etl::base64::Encoding::RFC_4648_PADDING, codec_full_buffer::Encoding); - CHECK_EQUAL("RFC_4648_PADDING", codec_full_buffer::Encoding.c_str()); - } - //************************************************************************* TEST(test_check_encode_safe_buffer_sizes) {