summaryrefslogtreecommitdiffstats
blob: edfae10204eafd5b510eb1f85fef8a2dea173754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>

#include "Swiften/Base/ByteArray.h"
#include "Swiften/StringCodecs/HMACSHA1.h"

using namespace Swift;

class HMACSHA1Test : public CppUnit::TestFixture {
		CPPUNIT_TEST_SUITE(HMACSHA1Test);
		CPPUNIT_TEST(testGetResult);
		CPPUNIT_TEST_SUITE_END();

	public:
		void testGetResult() {
			ByteArray result(HMACSHA1::getResult("foo", "foobar"));
			CPPUNIT_ASSERT_EQUAL(ByteArray("\xa4\xee\xba\x8e\x63\x3d\x77\x88\x69\xf5\x68\xd0\x5a\x1b\x3d\xc7\x2b\xfd\x4\xdd"), result);
		}
};

CPPUNIT_TEST_SUITE_REGISTRATION(HMACSHA1Test);