forked from boostorg/functional
Change tests so they can be used to test implementations of TR1 (maybe, eventually).
[SVN r28052]
This commit is contained in:
@@ -4,11 +4,21 @@
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
#include "./config.hpp"
|
||||
|
||||
#ifdef TEST_EXTENSIONS
|
||||
# ifdef TEST_STD_INCLUDES
|
||||
# include <functional>
|
||||
# else
|
||||
# include <boost/functional/hash/hash.hpp>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define BOOST_AUTO_TEST_MAIN
|
||||
#include <boost/test/auto_unit_test.hpp>
|
||||
|
||||
#ifdef TEST_EXTENSIONS
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
@@ -38,7 +48,7 @@ namespace boost
|
||||
|
||||
BOOST_AUTO_UNIT_TEST(custom_tests)
|
||||
{
|
||||
boost::hash<test::custom> custom_hasher;
|
||||
HASH_NAMESPACE::hash<test::custom> custom_hasher;
|
||||
BOOST_CHECK(custom_hasher(10) == 100u);
|
||||
test::custom x(55);
|
||||
BOOST_CHECK(custom_hasher(x) == 550u);
|
||||
@@ -49,11 +59,12 @@ BOOST_AUTO_UNIT_TEST(custom_tests)
|
||||
custom_vector.push_back(35);
|
||||
|
||||
std::size_t seed = 0;
|
||||
boost::hash_combine(seed, test::custom(5));
|
||||
boost::hash_combine(seed, test::custom(25));
|
||||
boost::hash_combine(seed, test::custom(35));
|
||||
HASH_NAMESPACE::hash_combine(seed, test::custom(5));
|
||||
HASH_NAMESPACE::hash_combine(seed, test::custom(25));
|
||||
HASH_NAMESPACE::hash_combine(seed, test::custom(35));
|
||||
|
||||
BOOST_CHECK(seed ==
|
||||
boost::hash_range(custom_vector.begin(), custom_vector.end()));
|
||||
HASH_NAMESPACE::hash_range(custom_vector.begin(), custom_vector.end()));
|
||||
}
|
||||
|
||||
#endif // TEST_EXTENSIONS
|
||||
|
||||
Reference in New Issue
Block a user