Revert hash_value for std::complex

This commit is contained in:
Peter Dimov
2022-05-29 21:59:17 +03:00
parent 7ad0365048
commit f08204e29a
2 changed files with 14 additions and 17 deletions
+8 -10
View File
@@ -53,11 +53,11 @@ void generic_complex_tests(std::complex<T> v)
BOOST_HASH_TEST_NAMESPACE::hash<T> real_hasher;
T real = v.real();
// T imag = v.imag();
T imag = v.imag();
// BOOST_TEST(real_hasher(real) == complex_hasher(std::complex<T>(real)));
BOOST_TEST(real_hasher(real) == complex_hasher(std::complex<T>(real)));
if(real_hasher(real) == complex_hasher(v)) {
if(imag != 0 && real_hasher(real) == complex_hasher(v)) {
std::ostringstream os;
os<<"real_hasher("<<real<<") == complex_hasher("
<<v.real()<<" + "<<v.imag()<<"i) == "
@@ -89,10 +89,8 @@ void complex_integral_tests(Integer*)
generic_complex_tests(complex(Integer(-543),Integer(763)));
}
template<class T> void complex_grid_test()
template<class T> void complex_grid_test( short N )
{
short const N = 16;
std::set<std::size_t> hashes;
for( short i = 0; i < N; ++i )
@@ -122,10 +120,10 @@ int main()
complex_integral_tests((unsigned int*) 0);
complex_integral_tests((unsigned long*) 0);
complex_grid_test<int>();
complex_grid_test<float>();
complex_grid_test<double>();
complex_grid_test<long double>();
complex_grid_test<int>( 16 );
complex_grid_test<float>( 7 );
complex_grid_test<double>( 16 );
complex_grid_test<long double>( 16 );
return boost::report_errors();
}