forked from boostorg/container_hash
Merge hash changes.
[SVN r58801]
This commit is contained in:
@@ -84,7 +84,7 @@ namespace boost {
|
||||
// the boost namespace they'll always be preferable to any other function
|
||||
// (since the arguments are built in types, ADL can't be used).
|
||||
|
||||
namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {
|
||||
namespace boost_hash_detect_float_functions {
|
||||
template <class Float> boost::hash_detail::not_found ldexp(Float, int);
|
||||
template <class Float> boost::hash_detail::not_found frexp(Float, int*);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {
|
||||
// happen mainly when there's a template in the same namesapce.
|
||||
|
||||
#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \
|
||||
namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { \
|
||||
namespace boost_hash_detect_float_functions { \
|
||||
template <class Float> \
|
||||
boost::hash_detail::not_found c99_func(Float, type2); \
|
||||
} \
|
||||
@@ -112,7 +112,7 @@ namespace boost { \
|
||||
namespace hash_detail { \
|
||||
namespace c99_func##_detect { \
|
||||
using namespace std; \
|
||||
using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS; \
|
||||
using namespace boost_hash_detect_float_functions; \
|
||||
\
|
||||
struct check { \
|
||||
static type1 x; \
|
||||
|
@@ -20,7 +20,8 @@
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
&& !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_CHAR_TRAITS string_char_traits
|
||||
#else
|
||||
#define BOOST_HASH_CHAR_TRAITS char_traits
|
||||
@@ -67,7 +68,8 @@ namespace boost
|
||||
std::size_t hash_value(long double v);
|
||||
|
||||
template <class Ch, class A>
|
||||
std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
|
||||
std::size_t hash_value(
|
||||
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
|
||||
|
||||
// Implementation
|
||||
|
||||
@@ -200,9 +202,10 @@ namespace boost
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#if BOOST_MSVC <= 1400
|
||||
#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to 'unsigned int',
|
||||
// possible loss of data
|
||||
// A misguided attempt to detect 64-bit incompatability.
|
||||
#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to
|
||||
// 'unsigned int', possible loss of data
|
||||
// A misguided attempt to detect 64-bit
|
||||
// incompatability.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -285,7 +288,8 @@ namespace boost
|
||||
#endif
|
||||
|
||||
template <class Ch, class A>
|
||||
inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
|
||||
inline std::size_t hash_value(
|
||||
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
@@ -310,8 +314,8 @@ namespace boost
|
||||
//
|
||||
|
||||
// Define the specializations required by the standard. The general purpose
|
||||
// boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS
|
||||
// is not defined.
|
||||
// boost::hash is defined later in extensions.hpp if
|
||||
// BOOST_HASH_NO_EXTENSIONS is not defined.
|
||||
|
||||
// BOOST_HASH_SPECIALIZE - define a specialization for a type which is
|
||||
// passed by copy.
|
||||
|
@@ -12,11 +12,9 @@ project hash-tests
|
||||
<toolset>intel:<cxxflags>-strict-ansi
|
||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter"
|
||||
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter"
|
||||
<toolset>gcc:<define>_GLIBCXX_DEBUG
|
||||
<toolset>darwin:<define>_GLIBCXX_DEBUG
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>darwin:<warnings-as-errors>on
|
||||
#<toolset>gcc:<warnings-as-errors>on
|
||||
#<toolset>darwin:<warnings-as-errors>on
|
||||
;
|
||||
|
||||
test-suite functional/hash
|
||||
@@ -45,6 +43,10 @@ test-suite functional/hash
|
||||
[ run link_ext_test.cpp link_no_ext_test.cpp ]
|
||||
[ run extensions_hpp_test.cpp ]
|
||||
[ run container_fwd_test.cpp ]
|
||||
[ run container_fwd_test.cpp : :
|
||||
: <toolset>gcc:<define>_GLIBCXX_DEBUG
|
||||
<toolset>darwin:<define>_GLIBCXX_DEBUG
|
||||
: container_fwd_gcc_debug ]
|
||||
[ compile-fail hash_no_ext_fail_test.cpp ]
|
||||
[ compile-fail namespace_fail_test.cpp ]
|
||||
[ run hash_no_ext_macro_1.cpp ]
|
||||
|
@@ -16,5 +16,6 @@
|
||||
#if defined(_WIN32_WCE)
|
||||
// The standard windows mobile headers trigger this warning so I disable it
|
||||
// before doing anything else.
|
||||
#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union
|
||||
#pragma warning(disable:4201) // nonstandard extension used :
|
||||
// nameless struct/union
|
||||
#endif
|
||||
|
@@ -7,14 +7,17 @@
|
||||
|
||||
#include <boost/functional/detail/container_fwd.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && \
|
||||
!defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
template <class charT, class Allocator>
|
||||
static void test(std::basic_string<charT, std::string_char_traits<charT>, Allocator> const&)
|
||||
static void test(
|
||||
std::basic_string<charT, std::string_char_traits<charT>, Allocator> const&)
|
||||
{
|
||||
}
|
||||
#else
|
||||
template <class charT, class Allocator>
|
||||
static void test(std::basic_string<charT, std::char_traits<charT>, Allocator> const&)
|
||||
static void test(
|
||||
std::basic_string<charT, std::char_traits<charT>, Allocator> const&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
@@ -20,13 +20,18 @@ int main() {}
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable:4244) // conversion from 'unsigned long' to 'unsigned short', possible loss of data
|
||||
#pragma warning(disable:4245) // conversion from 'int' to 'const unsigned short', signed/unsigned mismatch
|
||||
#pragma warning(disable:4305) // truncation from 'double' to 'const std::complex<float>::_Ty'
|
||||
#pragma warning(disable:4309) // truncation of constant value
|
||||
#pragma warning(disable:4512) // assignment operator could not be generated
|
||||
#pragma warning(disable:4244) // conversion from 'unsigned long' to
|
||||
// 'unsigned short', possible loss of data
|
||||
#pragma warning(disable:4245) // conversion from 'int' to
|
||||
// 'const unsigned short',
|
||||
// signed/unsigned mismatch
|
||||
#pragma warning(disable:4305) // truncation from 'double' to
|
||||
// 'const std::complex<float>::_Ty'
|
||||
#pragma warning(disable:4309) // truncation of constant value
|
||||
#pragma warning(disable:4512) // assignment operator could not be generated
|
||||
#if BOOST_MSVC < 1400
|
||||
#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int', possible loss of data
|
||||
#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int',
|
||||
// possible loss of data
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -84,8 +84,8 @@ void custom_tests()
|
||||
HASH_NAMESPACE::hash_combine(seed2, 250u);
|
||||
HASH_NAMESPACE::hash_combine(seed2, 350u);
|
||||
|
||||
BOOST_TEST(seed ==
|
||||
HASH_NAMESPACE::hash_range(custom_vector.begin(), custom_vector.end()));
|
||||
BOOST_TEST(seed == HASH_NAMESPACE::hash_range(
|
||||
custom_vector.begin(), custom_vector.end()));
|
||||
BOOST_TEST(seed == seed2);
|
||||
}
|
||||
|
||||
|
@@ -22,10 +22,11 @@
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4723) // conditional expression is constant
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4723) // conditional expression is constant
|
||||
#if BOOST_MSVC < 1400
|
||||
#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int', possible loss of data
|
||||
#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int',
|
||||
// possible loss of data
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -36,23 +37,33 @@ char const* float_type(long double*) { return "long double"; }
|
||||
template <class T>
|
||||
void float_tests(char const* name, T* = 0)
|
||||
{
|
||||
std::cerr<<"\n"
|
||||
<<"Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<"<<name<<">\n"
|
||||
<<"\n"
|
||||
<<"boost::hash_detail::limits<T>::digits = "
|
||||
<<boost::hash_detail::limits<T>::digits<<"\n"
|
||||
<<"boost::hash_detail::limits<int>::digits = "
|
||||
<<boost::hash_detail::limits<int>::digits<<"\n"
|
||||
<<"boost::hash_detail::limits<std::size_t>::digits = "
|
||||
<<boost::hash_detail::limits<std::size_t>::digits<<"\n"
|
||||
<<"\n"
|
||||
<<"boost::hash_detail::call_ldexp<T>::float_type = "
|
||||
<<float_type((BOOST_DEDUCED_TYPENAME boost::hash_detail::call_ldexp<T>::float_type*)0)<<"\n"
|
||||
<<"boost::hash_detail::call_frexp<T>::float_type = "
|
||||
<<float_type((BOOST_DEDUCED_TYPENAME boost::hash_detail::call_frexp<T>::float_type*)0)<<"\n"
|
||||
<<"boost::hash_detail::select_hash_type<T>::type = "
|
||||
<<float_type((BOOST_DEDUCED_TYPENAME boost::hash_detail::select_hash_type<T>::type*)0)<<"\n"
|
||||
<<"\n"
|
||||
std::cerr
|
||||
<< "\n"
|
||||
<< "Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<"
|
||||
<< name
|
||||
<< ">\n"
|
||||
<< "\n"
|
||||
<< "boost::hash_detail::limits<T>::digits = "
|
||||
<< boost::hash_detail::limits<T>::digits<< "\n"
|
||||
<< "boost::hash_detail::limits<int>::digits = "
|
||||
<< boost::hash_detail::limits<int>::digits<< "\n"
|
||||
<< "boost::hash_detail::limits<std::size_t>::digits = "
|
||||
<< boost::hash_detail::limits<std::size_t>::digits
|
||||
<< "\n"
|
||||
<< "\n"
|
||||
<< "boost::hash_detail::call_ldexp<T>::float_type = "
|
||||
<< float_type(static_cast<BOOST_DEDUCED_TYPENAME
|
||||
boost::hash_detail::call_ldexp<T>::float_type*>(0))
|
||||
<< "\n"
|
||||
<< "boost::hash_detail::call_frexp<T>::float_type = "
|
||||
<< float_type(static_cast<BOOST_DEDUCED_TYPENAME
|
||||
boost::hash_detail::call_frexp<T>::float_type*>(0))
|
||||
<< "\n"
|
||||
<< "boost::hash_detail::select_hash_type<T>::type = "
|
||||
<< float_type(static_cast<BOOST_DEDUCED_TYPENAME
|
||||
boost::hash_detail::select_hash_type<T>::type*>(0))
|
||||
<< "\n"
|
||||
<< "\n"
|
||||
;
|
||||
|
||||
HASH_NAMESPACE::hash<T> x1;
|
||||
@@ -72,7 +83,9 @@ void float_tests(char const* name, T* = 0)
|
||||
|
||||
// Doing anything with infinity causes borland to crash.
|
||||
#if defined(__BORLANDC__)
|
||||
std::cerr<<"Not running infinity checks on Borland, as it causes it to crash.\n";
|
||||
std::cerr
|
||||
<< "Not running infinity checks on Borland, as it causes it to crash."
|
||||
"\n";
|
||||
#else
|
||||
if(boost::hash_detail::limits<T>::has_infinity) {
|
||||
T infinity = -log(zero);
|
||||
@@ -111,19 +124,40 @@ void float_tests(char const* name, T* = 0)
|
||||
// This should really be 'has_denorm == denorm_present' but some
|
||||
// compilers don't have 'denorm_present'. See also a later use.
|
||||
if(boost::hash_detail::limits<T>::has_denorm) {
|
||||
if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(infinity)) {
|
||||
std::cerr<<"x1(denorm_min) == x1(infinity) == "<<x1(infinity)<<"\n";
|
||||
if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(infinity))
|
||||
{
|
||||
std::cerr
|
||||
<< "x1(denorm_min) == x1(infinity) == "
|
||||
<< x1(infinity)
|
||||
<< "\n";
|
||||
}
|
||||
if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(minus_infinity)) {
|
||||
std::cerr<<"x1(denorm_min) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
|
||||
|
||||
if(x1(boost::hash_detail::limits<T>::denorm_min()) ==
|
||||
x1(minus_infinity))
|
||||
{
|
||||
std::cerr
|
||||
<< "x1(denorm_min) == x1(-infinity) == "
|
||||
<< x1(minus_infinity)
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if(boost::hash_detail::limits<T>::has_quiet_NaN) {
|
||||
if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity)) {
|
||||
std::cerr<<"x1(quiet_NaN) == x1(infinity) == "<<x1(infinity)<<"\n";
|
||||
if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity))
|
||||
{
|
||||
std::cerr
|
||||
<< "x1(quiet_NaN) == x1(infinity) == "
|
||||
<< x1(infinity)
|
||||
<< "\n";
|
||||
}
|
||||
if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(minus_infinity)) {
|
||||
std::cerr<<"x1(quiet_NaN) == x1(-infinity) == "<<x1(minus_infinity)<<"\n";
|
||||
|
||||
if(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
|
||||
x1(minus_infinity))
|
||||
{
|
||||
std::cerr
|
||||
<< "x1(quiet_NaN) == x1(-infinity) == "
|
||||
<< x1(minus_infinity)
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,10 +180,12 @@ void float_tests(char const* name, T* = 0)
|
||||
BOOST_TEST(x1(max) == HASH_NAMESPACE::hash_value(max));
|
||||
BOOST_TEST(x1(half_max) == HASH_NAMESPACE::hash_value(half_max));
|
||||
BOOST_TEST(x1(quarter_max) == HASH_NAMESPACE::hash_value(quarter_max));
|
||||
BOOST_TEST(x1(three_quarter_max) == HASH_NAMESPACE::hash_value(three_quarter_max));
|
||||
BOOST_TEST(x1(three_quarter_max) ==
|
||||
HASH_NAMESPACE::hash_value(three_quarter_max));
|
||||
#endif
|
||||
|
||||
// The '!=' tests could legitimately fail, but with my hash it indicates a bug.
|
||||
// The '!=' tests could legitimately fail, but with my hash it indicates a
|
||||
// bug.
|
||||
BOOST_TEST(x1(max) == x1(max));
|
||||
BOOST_TEST(x1(max) != x1(quarter_max));
|
||||
BOOST_TEST(x1(max) != x1(half_max));
|
||||
@@ -179,7 +215,8 @@ void float_tests(char const* name, T* = 0)
|
||||
|
||||
#if defined(TEST_EXTENSIONS)
|
||||
BOOST_TEST(x1(boost::hash_detail::limits<T>::epsilon()) ==
|
||||
HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::epsilon()));
|
||||
HASH_NAMESPACE::hash_value(
|
||||
boost::hash_detail::limits<T>::epsilon()));
|
||||
#endif
|
||||
|
||||
BOOST_TEST(boost::hash_detail::limits<T>::epsilon() != (T) 0);
|
||||
@@ -216,14 +253,19 @@ void float_tests(char const* name, T* = 0)
|
||||
// specialization of boost::hash_detail::limits::denorm_min() for long
|
||||
// doubles which causes this test to fail.
|
||||
if(x1(boost::hash_detail::limits<T>::denorm_min()) !=
|
||||
HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::denorm_min()))
|
||||
HASH_NAMESPACE::hash_value(
|
||||
boost::hash_detail::limits<T>::denorm_min()))
|
||||
{
|
||||
std::cerr<<"x1(boost::hash_detail::limits<T>::denorm_min()) = "
|
||||
<< x1(boost::hash_detail::limits<T>::denorm_min())
|
||||
<< "\nhash_value(boost::hash_detail::limits<T>::denorm_min()) = "
|
||||
<< HASH_NAMESPACE::hash_value(
|
||||
std::cerr
|
||||
<< "x1(boost::hash_detail::limits<T>::denorm_min()) = "
|
||||
<< x1(boost::hash_detail::limits<T>::denorm_min())
|
||||
<< "\nhash_value(boost::hash_detail::limits<T>::denorm_min())"
|
||||
" = "
|
||||
<< HASH_NAMESPACE::hash_value(
|
||||
boost::hash_detail::limits<T>::denorm_min())
|
||||
<< "\nx1(0) = "<<x1(0)<<"\n";
|
||||
<< "\nx1(0) = "
|
||||
<< x1(0)
|
||||
<< "\n";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -235,7 +277,8 @@ void float_tests(char const* name, T* = 0)
|
||||
std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<<x1(1.0)<<"\n";
|
||||
}
|
||||
BOOST_TEST(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
|
||||
HASH_NAMESPACE::hash_value(boost::hash_detail::limits<T>::quiet_NaN()));
|
||||
HASH_NAMESPACE::hash_value(
|
||||
boost::hash_detail::limits<T>::quiet_NaN()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -87,8 +87,8 @@ void custom_tests()
|
||||
HASH_NAMESPACE::hash_combine(seed2, 250u);
|
||||
HASH_NAMESPACE::hash_combine(seed2, 350u);
|
||||
|
||||
BOOST_TEST(seed ==
|
||||
HASH_NAMESPACE::hash_range(custom_vector.begin(), custom_vector.end()));
|
||||
BOOST_TEST(seed == HASH_NAMESPACE::hash_range(
|
||||
custom_vector.begin(), custom_vector.end()));
|
||||
BOOST_TEST(seed == seed2);
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,8 @@ namespace test {
|
||||
template <class T>
|
||||
std::size_t hash_value(test_type3<T> const& x)
|
||||
{
|
||||
std::size_t seed = HASH_NAMESPACE::hash_range(x.values.begin(), x.values.end());
|
||||
std::size_t seed =
|
||||
HASH_NAMESPACE::hash_range(x.values.begin(), x.values.end());
|
||||
HASH_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end());
|
||||
return seed;
|
||||
}
|
||||
@@ -91,7 +92,8 @@ namespace boost
|
||||
template <class T>
|
||||
std::size_t hash_value(test::test_type3<T> const& x)
|
||||
{
|
||||
std::size_t seed = HASH_NAMESPACE::hash_range(x.values.begin(), x.values.end());
|
||||
std::size_t seed =
|
||||
HASH_NAMESPACE::hash_range(x.values.begin(), x.values.end());
|
||||
HASH_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end());
|
||||
return seed;
|
||||
}
|
||||
|
@@ -68,10 +68,12 @@ void fwd_test3()
|
||||
test::test_type3<int> x(values1.begin(), values1.end());
|
||||
test::test_type3<std::string> y(values2.begin(), values2.end());
|
||||
|
||||
std::size_t seed1 = HASH_NAMESPACE::hash_range(values1.begin(), values1.end());
|
||||
std::size_t seed1 =
|
||||
HASH_NAMESPACE::hash_range(values1.begin(), values1.end());
|
||||
HASH_NAMESPACE::hash_range(seed1, values1.begin(), values1.end());
|
||||
|
||||
std::size_t seed2 = HASH_NAMESPACE::hash_range(values2.begin(), values2.end());
|
||||
std::size_t seed2 =
|
||||
HASH_NAMESPACE::hash_range(values2.begin(), values2.end());
|
||||
HASH_NAMESPACE::hash_range(seed2, values2.begin(), values2.end());
|
||||
|
||||
HASH_NAMESPACE::hash<test::test_type3<int> > hasher_test_int;
|
||||
@@ -92,4 +94,3 @@ int main()
|
||||
#endif
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@@ -85,8 +85,8 @@ void custom_tests()
|
||||
HASH_NAMESPACE::hash_combine(seed2, 250u);
|
||||
HASH_NAMESPACE::hash_combine(seed2, 350u);
|
||||
|
||||
BOOST_TEST(seed ==
|
||||
HASH_NAMESPACE::hash_range(custom_vector.begin(), custom_vector.end()));
|
||||
BOOST_TEST(seed == HASH_NAMESPACE::hash_range(
|
||||
custom_vector.begin(), custom_vector.end()));
|
||||
BOOST_TEST(seed == seed2);
|
||||
}
|
||||
|
||||
|
@@ -22,19 +22,21 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
const int number_of_containers = 10;
|
||||
T containers[number_of_containers];
|
||||
typedef typename T::value_type pair;
|
||||
typedef BOOST_DEDUCED_TYPENAME T::value_type pair;
|
||||
typedef BOOST_DEDUCED_TYPENAME T::key_type key;
|
||||
typedef BOOST_DEDUCED_TYPENAME T::mapped_type value;
|
||||
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
for(int j = 0; j < i; ++j)
|
||||
containers[i].insert(pair(0, 0));
|
||||
containers[i].insert(pair(key(0), value(0)));
|
||||
}
|
||||
|
||||
containers[6].insert(pair(1,0));
|
||||
containers[7].insert(pair(1,0));
|
||||
containers[7].insert(pair(1,0));
|
||||
containers[8].insert(pair(-1,1));
|
||||
containers[9].insert(pair(-1,3));
|
||||
containers[9].insert(pair(-1,3));
|
||||
containers[6].insert(pair(key(1),value(0)));
|
||||
containers[7].insert(pair(key(1),value(0)));
|
||||
containers[7].insert(pair(key(1),value(0)));
|
||||
containers[8].insert(pair(key(-1),value(1)));
|
||||
containers[9].insert(pair(key(-1),value(3)));
|
||||
containers[9].insert(pair(key(-1),value(3)));
|
||||
|
||||
HASH_NAMESPACE::hash<T> hasher;
|
||||
|
||||
|
@@ -55,8 +55,11 @@ void numeric_test(T*)
|
||||
|
||||
if (limits::is_integer)
|
||||
{
|
||||
if(limits::is_signed || limits::digits <= boost::hash_detail::limits<std::size_t>::digits)
|
||||
if(limits::is_signed ||
|
||||
limits::digits <= boost::hash_detail::limits<std::size_t>::digits)
|
||||
{
|
||||
BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5));
|
||||
}
|
||||
BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u));
|
||||
BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u));
|
||||
BOOST_TEST(HASH_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u));
|
||||
|
@@ -70,10 +70,12 @@ void hash_range_tests()
|
||||
BOOST_TEST(HASH_NAMESPACE::hash_range(values3.begin(), values3.end())
|
||||
== HASH_NAMESPACE::hash_range(x.begin(), x.end()));
|
||||
|
||||
std::size_t seed = HASH_NAMESPACE::hash_range(values3.begin(), values3.end());
|
||||
std::size_t seed =
|
||||
HASH_NAMESPACE::hash_range(values3.begin(), values3.end());
|
||||
HASH_NAMESPACE::hash_range(seed, values4.begin(), values4.end());
|
||||
HASH_NAMESPACE::hash_range(seed, x.begin(), x.end());
|
||||
BOOST_TEST(seed == HASH_NAMESPACE::hash_range(values5.begin(), values5.end()));
|
||||
BOOST_TEST(seed ==
|
||||
HASH_NAMESPACE::hash_range(values5.begin(), values5.end()));
|
||||
}
|
||||
|
||||
int main()
|
||||
|
Reference in New Issue
Block a user