summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-27 19:06:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-27 19:06:47 (GMT)
commitaa09a889108c4d0e3c5888ad98958d8f3e12bd3b (patch)
tree3c621ae0a6e2150281be182b37e2837b804adcba /Swiften/StringCodecs/UnitTest/HexifyTest.cpp
parentc89ef0ffae597ac8c1063732e1d9a2d84703a80c (diff)
downloadswift-contrib-aa09a889108c4d0e3c5888ad98958d8f3e12bd3b.zip
swift-contrib-aa09a889108c4d0e3c5888ad98958d8f3e12bd3b.tar.bz2
Added MD5 hashing algorithm.
Moved 'hexifying' of hashes into its own class, such that it can be shared between all hashes.
Diffstat (limited to 'Swiften/StringCodecs/UnitTest/HexifyTest.cpp')
-rw-r--r--Swiften/StringCodecs/UnitTest/HexifyTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Swiften/StringCodecs/UnitTest/HexifyTest.cpp b/Swiften/StringCodecs/UnitTest/HexifyTest.cpp
new file mode 100644
index 0000000..bf032a3
--- /dev/null
+++ b/Swiften/StringCodecs/UnitTest/HexifyTest.cpp
@@ -0,0 +1,21 @@
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include "Swiften/StringCodecs/Hexify.h"
+#include "Swiften/Base/String.h"
+#include "Swiften/Base/ByteArray.h"
+
+using namespace Swift;
+
+class HexifyTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(HexifyTest);
+ CPPUNIT_TEST(testHexify);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void testHexify() {
+ CPPUNIT_ASSERT_EQUAL(String("4206b23ca6b0a643d20d89b04ff58cf78b8096ed"), Hexify::hexify(ByteArray("\x42\x06\xb2\x3c\xa6\xb0\xa6\x43\xd2\x0d\x89\xb0\x4f\xf5\x8c\xf7\x8b\x80\x96\xed")));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(HexifyTest);