mirror of
https://github.com/boostorg/hash2.git
synced 2026-01-19 16:22:15 +00:00
38 lines
968 B
C++
38 lines
968 B
C++
// Copyright 2024 Peter Dimov
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// https://www.boost.org/LICENSE_1_0.txt
|
|
|
|
#include <boost/hash2/md5.hpp>
|
|
#include <boost/core/lightweight_test.hpp>
|
|
#include <boost/config.hpp>
|
|
#include <array>
|
|
|
|
#if defined(BOOST_MSVC) && BOOST_MSVC < 1920
|
|
# pragma warning(disable: 4307) // integral constant overflow
|
|
#endif
|
|
|
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
|
|
|
#if defined(BOOST_NO_CXX14_CONSTEXPR)
|
|
|
|
# define TEST_EQ(x1, x2) BOOST_TEST_EQ(x1, x2)
|
|
|
|
#else
|
|
|
|
# define TEST_EQ(x1, x2) BOOST_TEST_EQ(x1, x2); STATIC_ASSERT(x1 == x2)
|
|
|
|
#endif
|
|
|
|
int main()
|
|
{
|
|
using namespace boost::hash2;
|
|
|
|
BOOST_CXX14_CONSTEXPR digest<16> r = {{ 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04, 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E }};
|
|
|
|
TEST_EQ( md5_128().result(), r );
|
|
TEST_EQ( md5_128(0).result(), r );
|
|
TEST_EQ( md5_128(nullptr, 0).result(), r );
|
|
|
|
return boost::report_errors();
|
|
}
|