Skip to content

Commit 1727a0a

Browse files
committed
Add class design test
1 parent 510c53e commit 1727a0a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/test_md5.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <boost/crypt/hash/md5.hpp>
88
#include <boost/core/lightweight_test.hpp>
99
#include <string>
10+
#include <array>
1011

1112
void basic_tests()
1213
{
@@ -71,11 +72,28 @@ void bad_input()
7172
BOOST_TEST_EQ(message_1_result[3], 0x0);
7273
}
7374

75+
void test_class()
76+
{
77+
boost::crypt::detail::md5 hasher;
78+
constexpr auto msg = "The quick brown fox jumps over the lazy dog";
79+
hasher.process_bytes(msg, std::strlen(msg));
80+
std::array<std::uint32_t, 4> message_1_result {};
81+
hasher.get_digest(message_1_result.begin(), message_1_result.size());
82+
83+
BOOST_TEST_EQ(message_1_result[0], 0x9e107d9d);
84+
BOOST_TEST_EQ(message_1_result[1], 0x372bb682);
85+
BOOST_TEST_EQ(message_1_result[2], 0x6bd81d35);
86+
BOOST_TEST_EQ(message_1_result[3], 0x42a419d6);
87+
}
88+
89+
7490
int main()
7591
{
7692
basic_tests();
7793
string_test();
7894
bad_input();
7995

96+
test_class();
97+
8098
return boost::report_errors();
8199
}

0 commit comments

Comments
 (0)