From 9b89394b5bac2d3c814af1f4f29912019f8bf6d7 Mon Sep 17 00:00:00 2001 From: aleks-f Date: Mon, 12 Nov 2012 20:00:37 -0600 Subject: [PATCH] Base32 Encoder/Decoder Base 32 Encoder/Decoder --- Foundation/Foundation_CE_vs90.vcproj | 16 ++ Foundation/Foundation_vs100.vcxproj | 4 + Foundation/Foundation_vs100.vcxproj.filters | 12 + Foundation/Foundation_vs110.vcxproj | 4 + Foundation/Foundation_vs110.vcxproj.filters | 12 + Foundation/Foundation_vs71.vcproj | 12 + Foundation/Foundation_vs80.vcproj | 16 ++ Foundation/Foundation_vs90.vcproj | 16 ++ Foundation/Foundation_x64_vs100.vcxproj | 4 + .../Foundation_x64_vs100.vcxproj.filters | 12 + Foundation/Foundation_x64_vs110.vcxproj | 4 + .../Foundation_x64_vs110.vcxproj.filters | 12 + Foundation/Foundation_x64_vs90.vcproj | 16 ++ Foundation/Makefile | 3 +- Foundation/include/Poco/Base32Decoder.h | 126 ++++++++++ Foundation/include/Poco/Base32Encoder.h | 131 ++++++++++ Foundation/src/Base32Decoder.cpp | 181 ++++++++++++++ Foundation/src/Base32Encoder.cpp | 223 ++++++++++++++++++ Foundation/testsuite/Makefile-Driver | 4 +- Foundation/testsuite/TestSuite_CE_vs90.vcproj | 8 + Foundation/testsuite/TestSuite_vs100.vcxproj | 2 + .../testsuite/TestSuite_vs100.vcxproj.filters | 6 + Foundation/testsuite/TestSuite_vs110.vcxproj | 2 + .../testsuite/TestSuite_vs110.vcxproj.filters | 6 + Foundation/testsuite/TestSuite_vs71.vcproj | 6 + Foundation/testsuite/TestSuite_vs80.vcproj | 8 + Foundation/testsuite/TestSuite_vs90.vcproj | 8 + .../testsuite/TestSuite_x64_vs100.vcxproj | 2 + .../TestSuite_x64_vs100.vcxproj.filters | 6 + .../testsuite/TestSuite_x64_vs110.vcxproj | 2 + .../TestSuite_x64_vs110.vcxproj.filters | 6 + .../testsuite/TestSuite_x64_vs90.vcproj | 8 + Foundation/testsuite/src/Base32Test.cpp | 197 ++++++++++++++++ Foundation/testsuite/src/Base32Test.h | 62 +++++ Foundation/testsuite/src/StreamsTestSuite.cpp | 2 + 35 files changed, 1136 insertions(+), 3 deletions(-) create mode 100644 Foundation/include/Poco/Base32Decoder.h create mode 100644 Foundation/include/Poco/Base32Encoder.h create mode 100644 Foundation/src/Base32Decoder.cpp create mode 100644 Foundation/src/Base32Encoder.cpp create mode 100644 Foundation/testsuite/src/Base32Test.cpp create mode 100644 Foundation/testsuite/src/Base32Test.h diff --git a/Foundation/Foundation_CE_vs90.vcproj b/Foundation/Foundation_CE_vs90.vcproj index 532c19235..a3d1b490f 100644 --- a/Foundation/Foundation_CE_vs90.vcproj +++ b/Foundation/Foundation_CE_vs90.vcproj @@ -553,6 +553,14 @@ + + + + @@ -733,6 +741,14 @@ + + + + diff --git a/Foundation/Foundation_vs100.vcxproj b/Foundation/Foundation_vs100.vcxproj index bb79f5be5..928dcb278 100644 --- a/Foundation/Foundation_vs100.vcxproj +++ b/Foundation/Foundation_vs100.vcxproj @@ -290,6 +290,8 @@ + + @@ -977,6 +979,8 @@ + + diff --git a/Foundation/Foundation_vs100.vcxproj.filters b/Foundation/Foundation_vs100.vcxproj.filters index b5213e459..4b81261e7 100644 --- a/Foundation/Foundation_vs100.vcxproj.filters +++ b/Foundation/Foundation_vs100.vcxproj.filters @@ -888,6 +888,12 @@ Core\Source Files + + Streams\Source Files + + + Streams\Source Files + @@ -1838,6 +1844,12 @@ Core\Header Files + + Streams\Header Files + + + Streams\Header Files + diff --git a/Foundation/Foundation_vs110.vcxproj b/Foundation/Foundation_vs110.vcxproj index 5cd999f1e..07b70d901 100644 --- a/Foundation/Foundation_vs110.vcxproj +++ b/Foundation/Foundation_vs110.vcxproj @@ -390,6 +390,8 @@ + + @@ -1041,6 +1043,8 @@ + + diff --git a/Foundation/Foundation_vs110.vcxproj.filters b/Foundation/Foundation_vs110.vcxproj.filters index 13c94e4a0..c4f7b5adb 100644 --- a/Foundation/Foundation_vs110.vcxproj.filters +++ b/Foundation/Foundation_vs110.vcxproj.filters @@ -270,6 +270,12 @@ Core\Source Files + + Streams\Source Files + + + Streams\Source Files + Streams\Source Files @@ -1046,6 +1052,12 @@ Core\Header Files + + Streams\Header Files + + + Streams\Header Files + Streams\Header Files diff --git a/Foundation/Foundation_vs71.vcproj b/Foundation/Foundation_vs71.vcproj index de1d691f6..fc727e3fb 100644 --- a/Foundation/Foundation_vs71.vcproj +++ b/Foundation/Foundation_vs71.vcproj @@ -951,6 +951,12 @@ + + + + @@ -1084,6 +1090,12 @@ + + + + diff --git a/Foundation/Foundation_vs80.vcproj b/Foundation/Foundation_vs80.vcproj index 3be5ddbd8..02d04f887 100644 --- a/Foundation/Foundation_vs80.vcproj +++ b/Foundation/Foundation_vs80.vcproj @@ -1267,6 +1267,14 @@ + + + + @@ -1447,6 +1455,14 @@ + + + + diff --git a/Foundation/Foundation_vs90.vcproj b/Foundation/Foundation_vs90.vcproj index a5188311c..db163bd3e 100644 --- a/Foundation/Foundation_vs90.vcproj +++ b/Foundation/Foundation_vs90.vcproj @@ -1264,6 +1264,14 @@ + + + + @@ -1444,6 +1452,14 @@ + + + + diff --git a/Foundation/Foundation_x64_vs100.vcxproj b/Foundation/Foundation_x64_vs100.vcxproj index a68ba19f0..c6a19d868 100644 --- a/Foundation/Foundation_x64_vs100.vcxproj +++ b/Foundation/Foundation_x64_vs100.vcxproj @@ -390,6 +390,8 @@ + + @@ -1038,6 +1040,8 @@ + + diff --git a/Foundation/Foundation_x64_vs100.vcxproj.filters b/Foundation/Foundation_x64_vs100.vcxproj.filters index d91d36795..52e52d905 100644 --- a/Foundation/Foundation_x64_vs100.vcxproj.filters +++ b/Foundation/Foundation_x64_vs100.vcxproj.filters @@ -270,6 +270,12 @@ Core\Source Files + + Streams\Source Files + + + Streams\Source Files + Streams\Source Files @@ -1046,6 +1052,12 @@ Core\Header Files + + Streams\Header Files + + + Streams\Header Files + Streams\Header Files diff --git a/Foundation/Foundation_x64_vs110.vcxproj b/Foundation/Foundation_x64_vs110.vcxproj index ed1ad3eac..a27509657 100644 --- a/Foundation/Foundation_x64_vs110.vcxproj +++ b/Foundation/Foundation_x64_vs110.vcxproj @@ -396,6 +396,8 @@ + + @@ -1044,6 +1046,8 @@ + + diff --git a/Foundation/Foundation_x64_vs110.vcxproj.filters b/Foundation/Foundation_x64_vs110.vcxproj.filters index d91d36795..52e52d905 100644 --- a/Foundation/Foundation_x64_vs110.vcxproj.filters +++ b/Foundation/Foundation_x64_vs110.vcxproj.filters @@ -270,6 +270,12 @@ Core\Source Files + + Streams\Source Files + + + Streams\Source Files + Streams\Source Files @@ -1046,6 +1052,12 @@ Core\Header Files + + Streams\Header Files + + + Streams\Header Files + Streams\Header Files diff --git a/Foundation/Foundation_x64_vs90.vcproj b/Foundation/Foundation_x64_vs90.vcproj index d745db9be..282134404 100644 --- a/Foundation/Foundation_x64_vs90.vcproj +++ b/Foundation/Foundation_x64_vs90.vcproj @@ -1266,6 +1266,14 @@ + + + + @@ -1442,6 +1450,14 @@ + + + + diff --git a/Foundation/Makefile b/Foundation/Makefile index 14822e9a8..f8e150e83 100644 --- a/Foundation/Makefile +++ b/Foundation/Makefile @@ -8,7 +8,8 @@ include $(POCO_BASE)/build/rules/global -objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder \ +objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel \ + Base32Decoder Base32Encoder Base64Decoder Base64Encoder \ BinaryReader BinaryWriter Bugcheck ByteOrder Channel Checksum Configurable ConsoleChannel \ CountingStream DateTime LocalDateTime DateTimeFormat DateTimeFormatter DateTimeParser \ Debugger DeflatingStream DigestEngine DigestStream DirectoryIterator DirectoryWatcher \ diff --git a/Foundation/include/Poco/Base32Decoder.h b/Foundation/include/Poco/Base32Decoder.h new file mode 100644 index 000000000..2ffed1926 --- /dev/null +++ b/Foundation/include/Poco/Base32Decoder.h @@ -0,0 +1,126 @@ +// +// Base32Decoder.h +// +// $Id: //poco/1.4/Foundation/include/Poco/Base32Decoder.h#2 $ +// +// Library: Foundation +// Package: Streams +// Module: Base32 +// +// Definition of class Base32Decoder. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_Base32Decoder_INCLUDED +#define Foundation_Base32Decoder_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" +#include + + +namespace Poco { + + +class Foundation_API Base32DecoderBuf: public UnbufferedStreamBuf + /// This streambuf base32-decodes all data read + /// from the istream connected to it. + /// + /// Note: For performance reasons, the characters + /// are read directly from the given istream's + /// underlying streambuf, so the state + /// of the istream will not reflect that of + /// its streambuf. +{ +public: + Base32DecoderBuf(std::istream& istr); + ~Base32DecoderBuf(); + +private: + int readFromDevice(); + int readOne(); + + unsigned char _group[8]; + int _groupLength; + int _groupIndex; + std::streambuf& _buf; + + static unsigned char IN_ENCODING[256]; + static bool IN_ENCODING_INIT; + +private: + Base32DecoderBuf(const Base32DecoderBuf&); + Base32DecoderBuf& operator = (const Base32DecoderBuf&); +}; + + +class Foundation_API Base32DecoderIOS: public virtual std::ios + /// The base class for Base32Decoder. + /// + /// This class is needed to ensure the correct initialization + /// order of the stream buffer and base classes. +{ +public: + Base32DecoderIOS(std::istream& istr); + ~Base32DecoderIOS(); + Base32DecoderBuf* rdbuf(); + +protected: + Base32DecoderBuf _buf; + +private: + Base32DecoderIOS(const Base32DecoderIOS&); + Base32DecoderIOS& operator = (const Base32DecoderIOS&); +}; + + +class Foundation_API Base32Decoder: public Base32DecoderIOS, public std::istream + /// This istream base32-decodes all data + /// read from the istream connected to it. + /// + /// Note: For performance reasons, the characters + /// are read directly from the given istream's + /// underlying streambuf, so the state + /// of the istream will not reflect that of + /// its streambuf. +{ +public: + Base32Decoder(std::istream& istr); + ~Base32Decoder(); + +private: + Base32Decoder(const Base32Decoder&); + Base32Decoder& operator = (const Base32Decoder&); +}; + + +} // namespace Poco + + +#endif // Foundation_Base32Decoder_INCLUDED diff --git a/Foundation/include/Poco/Base32Encoder.h b/Foundation/include/Poco/Base32Encoder.h new file mode 100644 index 000000000..cf3dd916e --- /dev/null +++ b/Foundation/include/Poco/Base32Encoder.h @@ -0,0 +1,131 @@ +// +// Base32Encoder.h +// +// $Id: //poco/1.4/Foundation/include/Poco/Base32Encoder.h#2 $ +// +// Library: Foundation +// Package: Streams +// Module: Base32 +// +// Definition of class Base32Encoder. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_Base32Encoder_INCLUDED +#define Foundation_Base32Encoder_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/UnbufferedStreamBuf.h" +#include + + +namespace Poco { + + +class Foundation_API Base32EncoderBuf: public UnbufferedStreamBuf + /// This streambuf base32-encodes all data written + /// to it and forwards it to a connected + /// ostream. + /// + /// Note: The characters are directly written + /// to the ostream's streambuf, thus bypassing + /// the ostream. The ostream's state is therefore + /// not updated to match the buffer's state. +{ +public: + Base32EncoderBuf(std::ostream& ostr); + ~Base32EncoderBuf(); + + int close(); + /// Closes the stream buffer. + +private: + int writeToDevice(char c); + + unsigned char _group[5]; + int _groupLength; + std::streambuf& _buf; + + static const unsigned char OUT_ENCODING[32]; + + friend class Base32DecoderBuf; + + Base32EncoderBuf(const Base32EncoderBuf&); + Base32EncoderBuf& operator = (const Base32EncoderBuf&); +}; + + +class Foundation_API Base32EncoderIOS: public virtual std::ios + /// The base class for Base32Encoder. + /// + /// This class is needed to ensure the correct initialization + /// order of the stream buffer and base classes. +{ +public: + Base32EncoderIOS(std::ostream& ostr); + ~Base32EncoderIOS(); + int close(); + Base32EncoderBuf* rdbuf(); + +protected: + Base32EncoderBuf _buf; + +private: + Base32EncoderIOS(const Base32EncoderIOS&); + Base32EncoderIOS& operator = (const Base32EncoderIOS&); +}; + + +class Foundation_API Base32Encoder: public Base32EncoderIOS, public std::ostream + /// This ostream base32-encodes all data + /// written to it and forwards it to + /// a connected ostream. + /// Always call close() when done + /// writing data, to ensure proper + /// completion of the encoding operation. + /// + /// Note: The characters are directly written + /// to the ostream's streambuf, thus bypassing + /// the ostream. The ostream's state is therefore + /// not updated to match the buffer's state. +{ +public: + Base32Encoder(std::ostream& ostr); + ~Base32Encoder(); + +private: + Base32Encoder(const Base32Encoder&); + Base32Encoder& operator = (const Base32Encoder&); +}; + + +} // namespace Poco + + +#endif // Foundation_Base32Encoder_INCLUDED diff --git a/Foundation/src/Base32Decoder.cpp b/Foundation/src/Base32Decoder.cpp new file mode 100644 index 000000000..71156ac62 --- /dev/null +++ b/Foundation/src/Base32Decoder.cpp @@ -0,0 +1,181 @@ +// +// Base32Decoder.cpp +// +// $Id: //poco/1.4/Foundation/src/Base32Decoder.cpp#2 $ +// +// Library: Foundation +// Package: Streams +// Module: Base32 +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Base32Decoder.h" +#include "Poco/Base32Encoder.h" +#include "Poco/Exception.h" +#include "Poco/Mutex.h" + + +namespace Poco { + + +unsigned char Base32DecoderBuf::IN_ENCODING[256]; +bool Base32DecoderBuf::IN_ENCODING_INIT = false; + + +namespace +{ + static FastMutex mutex; +} + + +Base32DecoderBuf::Base32DecoderBuf(std::istream& istr): + _groupLength(0), + _groupIndex(0), + _buf(*istr.rdbuf()) +{ + FastMutex::ScopedLock lock(mutex); + if (!IN_ENCODING_INIT) + { + for (unsigned i = 0; i < sizeof(IN_ENCODING); i++) + { + IN_ENCODING[i] = 0xFF; + } + for (unsigned i = 0; i < sizeof(Base32EncoderBuf::OUT_ENCODING); i++) + { + IN_ENCODING[Base32EncoderBuf::OUT_ENCODING[i]] = i; + } + IN_ENCODING[static_cast('=')] = '\0'; + IN_ENCODING_INIT = true; + } +} + + +Base32DecoderBuf::~Base32DecoderBuf() +{ +} + + +int Base32DecoderBuf::readFromDevice() +{ + if (_groupIndex < _groupLength) + { + return _group[_groupIndex++]; + } + else + { + unsigned char buffer[8]; + memset(buffer, '=', sizeof(buffer)); + int c; + + // per RFC-4648, Section 6, permissible block lengths are: + // 2, 4, 5, 7, and 8 bytes. Any other length is malformed. + // + do { + if ((c = readOne()) == -1) return -1; + buffer[0] = (unsigned char) c; + if (IN_ENCODING[buffer[0]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) throw DataFormatException(); + buffer[1] = (unsigned char) c; + if (IN_ENCODING[buffer[1]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) break; + buffer[2] = (unsigned char) c; + if (IN_ENCODING[buffer[2]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) throw DataFormatException(); + buffer[3] = (unsigned char) c; + if (IN_ENCODING[buffer[3]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) break; + buffer[4] = (unsigned char) c; + if (IN_ENCODING[buffer[4]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) break; + buffer[5] = (unsigned char) c; + if (IN_ENCODING[buffer[5]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) throw DataFormatException(); + buffer[6] = (unsigned char) c; + if (IN_ENCODING[buffer[6]] == 0xFF) throw DataFormatException(); + if ((c = readOne()) == -1) break; + buffer[7] = (unsigned char) c; + if (IN_ENCODING[buffer[7]] == 0xFF) throw DataFormatException(); + } while (false); + + _group[0] = (IN_ENCODING[buffer[0]] << 3) | (IN_ENCODING[buffer[1]] >> 2); + _group[1] = ((IN_ENCODING[buffer[1]] & 0x03) << 6) | (IN_ENCODING[buffer[2]] << 1) | (IN_ENCODING[buffer[3]] >> 4); + _group[2] = ((IN_ENCODING[buffer[3]] & 0x0F) << 4) | (IN_ENCODING[buffer[4]] >> 1); + _group[3] = ((IN_ENCODING[buffer[4]] & 0x01) << 7) | (IN_ENCODING[buffer[5]] << 2) | (IN_ENCODING[buffer[6]] >> 3); + _group[4] = ((IN_ENCODING[buffer[6]] & 0x07) << 5) | IN_ENCODING[buffer[7]]; + + if (buffer[2] == '=') + _groupLength = 1; + else if (buffer[4] == '=') + _groupLength = 2; + else if (buffer[5] == '=') + _groupLength = 3; + else if (buffer[7] == '=') + _groupLength = 4; + else + _groupLength = 5; + _groupIndex = 1; + return _group[0]; + } +} + + +int Base32DecoderBuf::readOne() +{ + int ch = _buf.sbumpc(); + return ch; +} + + +Base32DecoderIOS::Base32DecoderIOS(std::istream& istr): _buf(istr) +{ + poco_ios_init(&_buf); +} + + +Base32DecoderIOS::~Base32DecoderIOS() +{ +} + + +Base32DecoderBuf* Base32DecoderIOS::rdbuf() +{ + return &_buf; +} + + +Base32Decoder::Base32Decoder(std::istream& istr): Base32DecoderIOS(istr), std::istream(&_buf) +{ +} + + +Base32Decoder::~Base32Decoder() +{ +} + + +} // namespace Poco diff --git a/Foundation/src/Base32Encoder.cpp b/Foundation/src/Base32Encoder.cpp new file mode 100644 index 000000000..1a742d8bf --- /dev/null +++ b/Foundation/src/Base32Encoder.cpp @@ -0,0 +1,223 @@ +// +// Base32Encoder.cpp +// +// $Id: //poco/1.4/Foundation/src/Base32Encoder.cpp#2 $ +// +// Library: Foundation +// Package: Streams +// Module: Base32 +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/Base32Encoder.h" + + +namespace Poco { + + +const unsigned char Base32EncoderBuf::OUT_ENCODING[32] = +{ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', '2', '3', '4', '5', '6', '8', +}; + + +Base32EncoderBuf::Base32EncoderBuf(std::ostream& ostr): + _groupLength(0), + _buf(*ostr.rdbuf()) +{ +} + + +Base32EncoderBuf::~Base32EncoderBuf() +{ + try + { + close(); + } + catch (...) + { + } +} + + + +int Base32EncoderBuf::writeToDevice(char c) +{ + static const int eof = std::char_traits::eof(); + + _group[_groupLength++] = (unsigned char) c; + if (_groupLength == 5) + { + unsigned char idx; + idx = _group[0] >> 3; + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[0] & 0x07) << 2) | (_group[1] >> 6); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x3E) >> 1); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x01) << 4) | (_group[2] >> 4); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[2] & 0x0F) << 1) | (_group[3] >> 7); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[3] & 0x7C) >> 2); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[3] & 0x03) << 3) | (_group[4] >> 5); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = (_group[4] & 0x1F); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + _groupLength = 0; + } + return charToInt(c); +} + + +int Base32EncoderBuf::close() +{ + static const int eof = std::char_traits::eof(); + + if (sync() == eof) return eof; + if (_groupLength == 1) + { + _group[1] = 0; + unsigned char idx; + idx = _group[0] >> 3; + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[0] & 0x07) << 2); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; +#if 0 + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; +#endif + } + else if (_groupLength == 2) + { + _group[2] = 0; + unsigned char idx; + idx = _group[0] >> 3; + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[0] & 0x07) << 2) | (_group[1] >> 6); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x3E) >> 1); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x01) << 4); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; +#if 0 + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; +#endif + } + else if (_groupLength == 3) + { + _group[3] = 0; + unsigned char idx; + idx = _group[0] >> 3; + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[0] & 0x07) << 2) | (_group[1] >> 6); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x3E) >> 1); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x01) << 4) | (_group[2] >> 4); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[2] & 0x0F) << 1); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; +#if 0 + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; + if (_buf.sputc('=') == eof) return eof; +#endif + } + else if (_groupLength == 4) + { + _group[4] = 0; + unsigned char idx; + idx = _group[0] >> 3; + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[0] & 0x07) << 2) | (_group[1] >> 6); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x3E) >> 1); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[1] & 0x01) << 4) | (_group[2] >> 4); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[2] & 0x0F) << 1) | (_group[3] >> 7); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[3] & 0x7C) >> 2); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; + idx = ((_group[3] & 0x03) << 3); + if (_buf.sputc(OUT_ENCODING[idx]) == eof) return eof; +#if 0 + if (_buf.sputc('=') == eof) return eof; +#endif + } + _groupLength = 0; + return _buf.pubsync(); +} + + +Base32EncoderIOS::Base32EncoderIOS(std::ostream& ostr): _buf(ostr) +{ + poco_ios_init(&_buf); +} + + +Base32EncoderIOS::~Base32EncoderIOS() +{ +} + + +int Base32EncoderIOS::close() +{ + return _buf.close(); +} + + +Base32EncoderBuf* Base32EncoderIOS::rdbuf() +{ + return &_buf; +} + + +Base32Encoder::Base32Encoder(std::ostream& ostr): Base32EncoderIOS(ostr), std::ostream(&_buf) +{ +} + + +Base32Encoder::~Base32Encoder() +{ +} + + +} // namespace Poco diff --git a/Foundation/testsuite/Makefile-Driver b/Foundation/testsuite/Makefile-Driver index bd71c490e..5645e3355 100644 --- a/Foundation/testsuite/Makefile-Driver +++ b/Foundation/testsuite/Makefile-Driver @@ -9,8 +9,8 @@ include $(POCO_BASE)/build/rules/global objects = ActiveMethodTest ActivityTest ActiveDispatcherTest \ - AutoPtrTest ArrayTest SharedPtrTest AutoReleasePoolTest Base64Test \ - BinaryReaderWriterTest LineEndingConverterTest \ + AutoPtrTest ArrayTest SharedPtrTest AutoReleasePoolTest \ + Base32Test Base64Test BinaryReaderWriterTest LineEndingConverterTest \ ByteOrderTest ChannelTest ClassLoaderTest CoreTest CoreTestSuite \ CountingStreamTest CryptTestSuite DateTimeFormatterTest \ DateTimeParserTest DateTimeTest LocalDateTimeTest DateTimeTestSuite DigestStreamTest \ diff --git a/Foundation/testsuite/TestSuite_CE_vs90.vcproj b/Foundation/testsuite/TestSuite_CE_vs90.vcproj index 39baa7482..c657fd3bb 100644 --- a/Foundation/testsuite/TestSuite_CE_vs90.vcproj +++ b/Foundation/testsuite/TestSuite_CE_vs90.vcproj @@ -774,6 +774,10 @@ + + @@ -834,6 +838,10 @@ + + diff --git a/Foundation/testsuite/TestSuite_vs100.vcxproj b/Foundation/testsuite/TestSuite_vs100.vcxproj index eeba4428f..c4b37bbdc 100644 --- a/Foundation/testsuite/TestSuite_vs100.vcxproj +++ b/Foundation/testsuite/TestSuite_vs100.vcxproj @@ -304,6 +304,7 @@ + @@ -437,6 +438,7 @@ + diff --git a/Foundation/testsuite/TestSuite_vs100.vcxproj.filters b/Foundation/testsuite/TestSuite_vs100.vcxproj.filters index 55ebe9310..1977900db 100644 --- a/Foundation/testsuite/TestSuite_vs100.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_vs100.vcxproj.filters @@ -573,6 +573,9 @@ Streams\Source Files + + Streams\Source Files + @@ -965,5 +968,8 @@ Core\Header Files + + Streams\Header Files + \ No newline at end of file diff --git a/Foundation/testsuite/TestSuite_vs110.vcxproj b/Foundation/testsuite/TestSuite_vs110.vcxproj index 7d9a0f1dc..45a580e51 100644 --- a/Foundation/testsuite/TestSuite_vs110.vcxproj +++ b/Foundation/testsuite/TestSuite_vs110.vcxproj @@ -330,6 +330,7 @@ + @@ -463,6 +464,7 @@ + diff --git a/Foundation/testsuite/TestSuite_vs110.vcxproj.filters b/Foundation/testsuite/TestSuite_vs110.vcxproj.filters index f39e374ab..a137b507f 100644 --- a/Foundation/testsuite/TestSuite_vs110.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_vs110.vcxproj.filters @@ -240,6 +240,9 @@ Core\Source Files + + Streams\Source Files + Streams\Source Files @@ -635,6 +638,9 @@ Core\Header Files + + Streams\Header Files + Streams\Header Files diff --git a/Foundation/testsuite/TestSuite_vs71.vcproj b/Foundation/testsuite/TestSuite_vs71.vcproj index 357b736f0..9f88635bd 100644 --- a/Foundation/testsuite/TestSuite_vs71.vcproj +++ b/Foundation/testsuite/TestSuite_vs71.vcproj @@ -547,6 +547,9 @@ + + @@ -590,6 +593,9 @@ + + diff --git a/Foundation/testsuite/TestSuite_vs80.vcproj b/Foundation/testsuite/TestSuite_vs80.vcproj index 7f072c28c..b6c28d8f2 100644 --- a/Foundation/testsuite/TestSuite_vs80.vcproj +++ b/Foundation/testsuite/TestSuite_vs80.vcproj @@ -743,6 +743,10 @@ + + @@ -803,6 +807,10 @@ + + diff --git a/Foundation/testsuite/TestSuite_vs90.vcproj b/Foundation/testsuite/TestSuite_vs90.vcproj index a63fd9051..d469b5d47 100644 --- a/Foundation/testsuite/TestSuite_vs90.vcproj +++ b/Foundation/testsuite/TestSuite_vs90.vcproj @@ -729,6 +729,10 @@ + + @@ -789,6 +793,10 @@ + + diff --git a/Foundation/testsuite/TestSuite_x64_vs100.vcxproj b/Foundation/testsuite/TestSuite_x64_vs100.vcxproj index 075258c75..ed762843e 100644 --- a/Foundation/testsuite/TestSuite_x64_vs100.vcxproj +++ b/Foundation/testsuite/TestSuite_x64_vs100.vcxproj @@ -324,6 +324,7 @@ + @@ -458,6 +459,7 @@ + diff --git a/Foundation/testsuite/TestSuite_x64_vs100.vcxproj.filters b/Foundation/testsuite/TestSuite_x64_vs100.vcxproj.filters index e1c5c67b1..0d596394a 100644 --- a/Foundation/testsuite/TestSuite_x64_vs100.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_x64_vs100.vcxproj.filters @@ -240,6 +240,9 @@ Core\Source Files + + Streams\Source Files + Streams\Source Files @@ -638,6 +641,9 @@ Core\Header Files + + Streams\Header Files + Streams\Header Files diff --git a/Foundation/testsuite/TestSuite_x64_vs110.vcxproj b/Foundation/testsuite/TestSuite_x64_vs110.vcxproj index e44a6b5ec..9a764a03b 100644 --- a/Foundation/testsuite/TestSuite_x64_vs110.vcxproj +++ b/Foundation/testsuite/TestSuite_x64_vs110.vcxproj @@ -330,6 +330,7 @@ + @@ -464,6 +465,7 @@ + diff --git a/Foundation/testsuite/TestSuite_x64_vs110.vcxproj.filters b/Foundation/testsuite/TestSuite_x64_vs110.vcxproj.filters index e1c5c67b1..0d596394a 100644 --- a/Foundation/testsuite/TestSuite_x64_vs110.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_x64_vs110.vcxproj.filters @@ -240,6 +240,9 @@ Core\Source Files + + Streams\Source Files + Streams\Source Files @@ -638,6 +641,9 @@ Core\Header Files + + Streams\Header Files + Streams\Header Files diff --git a/Foundation/testsuite/TestSuite_x64_vs90.vcproj b/Foundation/testsuite/TestSuite_x64_vs90.vcproj index a2a89957d..927785125 100644 --- a/Foundation/testsuite/TestSuite_x64_vs90.vcproj +++ b/Foundation/testsuite/TestSuite_x64_vs90.vcproj @@ -719,6 +719,10 @@ + + @@ -775,6 +779,10 @@ + + diff --git a/Foundation/testsuite/src/Base32Test.cpp b/Foundation/testsuite/src/Base32Test.cpp new file mode 100644 index 000000000..f2d537d94 --- /dev/null +++ b/Foundation/testsuite/src/Base32Test.cpp @@ -0,0 +1,197 @@ +// +// Base32Test.cpp +// +// $Id: //poco/1.4/Foundation/testsuite/src/Base32Test.cpp#1 $ +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Base32Test.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Base32Encoder.h" +#include "Poco/Base32Decoder.h" +#include "Poco/Exception.h" +#include + + +using Poco::Base32Encoder; +using Poco::Base32Decoder; +using Poco::DataFormatException; + + +Base32Test::Base32Test(const std::string& name): CppUnit::TestCase(name) +{ +} + + +Base32Test::~Base32Test() +{ +} + + +void Base32Test::testEncoder() +{ + { + std::ostringstream str; + Base32Encoder encoder(str); + encoder << std::string("\00\01\02\03\04\05", 6); + encoder.close(); + assert (str.str() == "AAAQEAYEAU"); + } + { + std::ostringstream str; + Base32Encoder encoder(str); + encoder << std::string("\00\01\02\03", 4); + encoder.close(); + assert (str.str() == "AAAQEAY"); + } + { + std::ostringstream str; + Base32Encoder encoder(str); + encoder << "ABCDEF"; + encoder.close(); + assert (str.str() == "IFBEGRCFIY"); + } + { + std::ostringstream str; + Base32Encoder encoder(str); + encoder << "ABCDE"; + encoder.close(); + assert (str.str() == "IFBEGRCF"); + } +} + + +void Base32Test::testDecoder() +{ + { + std::istringstream istr("AAAQEAYEAU"); + Base32Decoder decoder(istr); + assert (decoder.good() && decoder.get() == 0); + assert (decoder.good() && decoder.get() == 1); + assert (decoder.good() && decoder.get() == 2); + assert (decoder.good() && decoder.get() == 3); + assert (decoder.good() && decoder.get() == 4); + assert (decoder.good() && decoder.get() == 5); + assert (decoder.good() && decoder.get() == -1); + } + { + std::istringstream istr("AAAQEAYE"); + Base32Decoder decoder(istr); + assert (decoder.good() && decoder.get() == 0); + assert (decoder.good() && decoder.get() == 1); + assert (decoder.good() && decoder.get() == 2); + assert (decoder.good() && decoder.get() == 3); + assert (decoder.good() && decoder.get() == 4); + assert (decoder.good() && decoder.get() == -1); + } + { + std::istringstream istr("AAAQEAY"); + Base32Decoder decoder(istr); + assert (decoder.good() && decoder.get() == 0); + assert (decoder.good() && decoder.get() == 1); + assert (decoder.good() && decoder.get() == 2); + assert (decoder.good() && decoder.get() == 3); + assert (decoder.good() && decoder.get() == -1); + } + { + std::istringstream istr("IFBEGRCFIY"); + Base32Decoder decoder(istr); + std::string s; + decoder >> s; + assert (s == "ABCDEF"); + assert (decoder.eof()); + assert (!decoder.fail()); + } + { + std::istringstream istr("QUJD#REVG"); + Base32Decoder decoder(istr); + std::string s; + try + { + decoder >> s; + assert (decoder.bad()); + } + catch (DataFormatException&) + { + } + assert (!decoder.eof()); + } +} + + +void Base32Test::testEncodeDecode() +{ + { + std::stringstream str; + Base32Encoder encoder(str); + encoder << "The quick brown fox "; + encoder << "jumped over the lazy dog."; + encoder.close(); + Base32Decoder decoder(str); + std::string s; + int c = decoder.get(); + while (c != -1) { s += char(c); c = decoder.get(); } + assert (s == "The quick brown fox jumped over the lazy dog."); + } + { + std::string src; + for (int i = 0; i < 255; ++i) src += char(i); + std::stringstream str; + Base32Encoder encoder(str); + encoder.write(src.data(), (std::streamsize) src.size()); + encoder.close(); + Base32Decoder decoder(str); + std::string s; + int c = decoder.get(); + while (c != -1) { s += char(c); c = decoder.get(); } + assert (s == src); + } +} + + +void Base32Test::setUp() +{ +} + + +void Base32Test::tearDown() +{ +} + + +CppUnit::Test* Base32Test::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("Base32Test"); + + CppUnit_addTest(pSuite, Base32Test, testEncoder); + CppUnit_addTest(pSuite, Base32Test, testDecoder); + CppUnit_addTest(pSuite, Base32Test, testEncodeDecode); + + return pSuite; +} diff --git a/Foundation/testsuite/src/Base32Test.h b/Foundation/testsuite/src/Base32Test.h new file mode 100644 index 000000000..509c19954 --- /dev/null +++ b/Foundation/testsuite/src/Base32Test.h @@ -0,0 +1,62 @@ +// +// Base32Test.h +// +// $Id: //poco/1.4/Foundation/testsuite/src/Base32Test.h#1 $ +// +// Definition of the Base32Test class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Base32Test_INCLUDED +#define Base32Test_INCLUDED + + +#include "Poco/Foundation.h" +#include "CppUnit/TestCase.h" + + +class Base32Test: public CppUnit::TestCase +{ +public: + Base32Test(const std::string& name); + ~Base32Test(); + + void testEncoder(); + void testDecoder(); + void testEncodeDecode(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // Base32Test_INCLUDED diff --git a/Foundation/testsuite/src/StreamsTestSuite.cpp b/Foundation/testsuite/src/StreamsTestSuite.cpp index b0bc2a738..800e1ff61 100644 --- a/Foundation/testsuite/src/StreamsTestSuite.cpp +++ b/Foundation/testsuite/src/StreamsTestSuite.cpp @@ -31,6 +31,7 @@ #include "StreamsTestSuite.h" +#include "Base32Test.h" #include "Base64Test.h" #include "HexBinaryTest.h" #include "StreamCopierTest.h" @@ -50,6 +51,7 @@ CppUnit::Test* StreamsTestSuite::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("StreamsTestSuite"); + pSuite->addTest(Base32Test::suite()); pSuite->addTest(Base64Test::suite()); pSuite->addTest(HexBinaryTest::suite()); pSuite->addTest(StreamCopierTest::suite());