2007-11-25 18:38:02 +00:00
|
|
|
|
Merge hash and unordered changes.
Remove deprecated headers, move hash_fwd.hpp into hash subdirectory. And
several minor internal changes.
Mostly minor internal details.
Merged revisions 51262-51263,51407-51409,51504-51505,51644-51646,51667 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r51262 | danieljames | 2009-02-15 19:32:04 +0000 (Sun, 15 Feb 2009) | 1 line
Use the new 'boost:' links for the hash, unordered and quickbook documentation.
........
r51263 | danieljames | 2009-02-15 19:32:19 +0000 (Sun, 15 Feb 2009) | 2 lines
Don't copy images for the standalone hash and unordered documentation, was only
really required before the libraries were integrated into boost.
........
r51407 | danieljames | 2009-02-22 23:49:51 +0000 (Sun, 22 Feb 2009) | 1 line
Fix the hash dirname.
........
r51408 | danieljames | 2009-02-22 23:50:04 +0000 (Sun, 22 Feb 2009) | 1 line
Make copy_buckets and move_buckets member functions - so that calling them is a bit simpler.
........
r51409 | danieljames | 2009-02-22 23:50:20 +0000 (Sun, 22 Feb 2009) | 1 line
Move some of the data structure classes out of hash table data.
........
r51504 | danieljames | 2009-03-01 14:15:09 +0000 (Sun, 01 Mar 2009) | 1 line
Add missing return for operator=.
........
r51505 | danieljames | 2009-03-01 14:15:39 +0000 (Sun, 01 Mar 2009) | 3 lines
Make the sort stable.
Doesn't really matter, but it might as well be.
........
r51644 | danieljames | 2009-03-08 09:44:51 +0000 (Sun, 08 Mar 2009) | 1 line
Detab.
........
r51645 | danieljames | 2009-03-08 09:45:11 +0000 (Sun, 08 Mar 2009) | 4 lines
Move hash_fwd into the hash subdirectory.
I should have done this in the last release. But now all of the hash
implementation is in the hash subdirectory.
........
r51646 | danieljames | 2009-03-08 09:45:30 +0000 (Sun, 08 Mar 2009) | 3 lines
Remove deprecated headers.
Fixes #2412.
........
r51667 | danieljames | 2009-03-09 20:56:23 +0000 (Mon, 09 Mar 2009) | 1 line
Update copyright dates in hash and unordered.
........
[SVN r51729]
2009-03-11 22:51:09 +00:00
|
|
|
// Copyright 2005-2009 Daniel James.
|
2007-11-25 18:38:02 +00:00
|
|
|
// Distributed under the 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 "./config.hpp"
|
|
|
|
|
|
Merge latest hash developments:
* Avoid float to int warning.
* Work around 'using namespace' bug in Visual C++.
* Make `<boost/functional/hash/extensions.hpp> self contained.
* Move some of the extension implementation from the main hash header
into the exensions header.
* Remove BOOST_HASH_CHAR_TRAITS from `container_fwd.hpp`.
* Other minor changes.
Merged revisions 53828,53924,54024-54025,54033-54034,54139-54145,54399 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53828 | danieljames | 2009-06-12 19:24:47 +0100 (Fri, 12 Jun 2009) | 1 line
Try to avoid float to int warning when a float function doesn't exist.
........
r53924 | danieljames | 2009-06-15 08:37:42 +0100 (Mon, 15 Jun 2009) | 4 lines
Remove hash_complex_test's dependency on Boost.Random.
Only test for a few values, but that should be okay as there isn't much
to test.
........
r54024 | danieljames | 2009-06-17 22:22:49 +0100 (Wed, 17 Jun 2009) | 1 line
Put the minimum amount of implementation in the same namespace as the 'using namespace' directives in order to avoid Visual C++ 8 bug.
........
r54025 | danieljames | 2009-06-17 22:23:42 +0100 (Wed, 17 Jun 2009) | 1 line
Try to avoid using special macro handling code.
........
r54033 | danieljames | 2009-06-18 00:24:28 +0100 (Thu, 18 Jun 2009) | 1 line
Add copyright to namespace_fail_test.cpp
........
r54034 | danieljames | 2009-06-18 00:25:12 +0100 (Thu, 18 Jun 2009) | 1 line
A couple of missing newlines.
........
r54139 | danieljames | 2009-06-21 10:41:11 +0100 (Sun, 21 Jun 2009) | 1 line
A few more comments in boost::hash.
........
r54140 | danieljames | 2009-06-21 10:41:30 +0100 (Sun, 21 Jun 2009) | 1 line
Move includes to the header which they're used in.
........
r54141 | danieljames | 2009-06-21 10:41:46 +0100 (Sun, 21 Jun 2009) | 1 line
Revert [54025] "Try to avoid using special macro handling code."
........
r54142 | danieljames | 2009-06-21 10:42:05 +0100 (Sun, 21 Jun 2009) | 1 line
Get <boost/functional/hash/extensions.hpp> to work.
........
r54143 | danieljames | 2009-06-21 10:42:20 +0100 (Sun, 21 Jun 2009) | 1 line
Move BOOST_HASH_CHAR_TRAITS from container_fwd into the hash headers, and undefine it.
........
r54144 | danieljames | 2009-06-21 10:42:40 +0100 (Sun, 21 Jun 2009) | 1 line
Move the support for hashing containers into the extension header, and improve the standard tests.
........
r54145 | danieljames | 2009-06-21 10:51:59 +0100 (Sun, 21 Jun 2009) | 1 line
I didn't mean to comment this out.
........
r54399 | danieljames | 2009-06-27 08:39:12 +0100 (Sat, 27 Jun 2009) | 1 line
Add am implementation note about the Visual C++ problems.
........
[SVN r54402]
2009-06-27 08:12:20 +00:00
|
|
|
#if !defined(TEST_EXTENSIONS)
|
|
|
|
|
|
|
|
|
|
int main() {}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
#ifdef TEST_STD_INCLUDES
|
|
|
|
|
# include <functional>
|
|
|
|
|
#else
|
|
|
|
|
# include <boost/functional/hash.hpp>
|
2007-11-25 18:38:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
2008-07-19 09:02:10 +00:00
|
|
|
#include <boost/detail/lightweight_test.hpp>
|
2007-11-25 18:38:02 +00:00
|
|
|
|
|
|
|
|
#if defined(BOOST_MSVC)
|
2010-01-08 05:38:39 +00:00
|
|
|
#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
|
2009-11-29 16:14:10 +00:00
|
|
|
#if BOOST_MSVC < 1400
|
2010-01-08 05:38:39 +00:00
|
|
|
#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int',
|
|
|
|
|
// possible loss of data
|
2007-11-25 18:38:02 +00:00
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-05-03 22:05:21 +00:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-11-29 16:14:10 +00:00
|
|
|
#include <complex>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <boost/limits.hpp>
|
|
|
|
|
|
2007-11-25 18:38:02 +00:00
|
|
|
template <class T>
|
|
|
|
|
void generic_complex_tests(std::complex<T> v)
|
|
|
|
|
{
|
|
|
|
|
HASH_NAMESPACE::hash<std::complex<T> > complex_hasher;
|
|
|
|
|
|
2008-07-19 09:02:10 +00:00
|
|
|
BOOST_TEST(complex_hasher(v) == complex_hasher(v));
|
2007-11-25 18:38:02 +00:00
|
|
|
|
|
|
|
|
HASH_NAMESPACE::hash<T> real_hasher;
|
|
|
|
|
T real = v.real();
|
|
|
|
|
T imag = v.imag();
|
|
|
|
|
|
2008-07-19 09:02:10 +00:00
|
|
|
BOOST_TEST(real_hasher(real) == complex_hasher(std::complex<T>(real)));
|
2007-11-25 18:38:02 +00:00
|
|
|
|
|
|
|
|
if(imag != 0 && real_hasher(real) == complex_hasher(v)) {
|
|
|
|
|
std::ostringstream os;
|
|
|
|
|
os<<"real_hasher("<<real<<") == complex_hasher("
|
|
|
|
|
<<v.real()<<" + "<<v.imag()<<"i) == "
|
|
|
|
|
<<real_hasher(real)<<" (This might not be a bug).";
|
|
|
|
|
BOOST_ERROR(os.str().c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <class Float>
|
|
|
|
|
void complex_float_tests(Float*)
|
|
|
|
|
{
|
Merge latest hash developments:
* Avoid float to int warning.
* Work around 'using namespace' bug in Visual C++.
* Make `<boost/functional/hash/extensions.hpp> self contained.
* Move some of the extension implementation from the main hash header
into the exensions header.
* Remove BOOST_HASH_CHAR_TRAITS from `container_fwd.hpp`.
* Other minor changes.
Merged revisions 53828,53924,54024-54025,54033-54034,54139-54145,54399 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53828 | danieljames | 2009-06-12 19:24:47 +0100 (Fri, 12 Jun 2009) | 1 line
Try to avoid float to int warning when a float function doesn't exist.
........
r53924 | danieljames | 2009-06-15 08:37:42 +0100 (Mon, 15 Jun 2009) | 4 lines
Remove hash_complex_test's dependency on Boost.Random.
Only test for a few values, but that should be okay as there isn't much
to test.
........
r54024 | danieljames | 2009-06-17 22:22:49 +0100 (Wed, 17 Jun 2009) | 1 line
Put the minimum amount of implementation in the same namespace as the 'using namespace' directives in order to avoid Visual C++ 8 bug.
........
r54025 | danieljames | 2009-06-17 22:23:42 +0100 (Wed, 17 Jun 2009) | 1 line
Try to avoid using special macro handling code.
........
r54033 | danieljames | 2009-06-18 00:24:28 +0100 (Thu, 18 Jun 2009) | 1 line
Add copyright to namespace_fail_test.cpp
........
r54034 | danieljames | 2009-06-18 00:25:12 +0100 (Thu, 18 Jun 2009) | 1 line
A couple of missing newlines.
........
r54139 | danieljames | 2009-06-21 10:41:11 +0100 (Sun, 21 Jun 2009) | 1 line
A few more comments in boost::hash.
........
r54140 | danieljames | 2009-06-21 10:41:30 +0100 (Sun, 21 Jun 2009) | 1 line
Move includes to the header which they're used in.
........
r54141 | danieljames | 2009-06-21 10:41:46 +0100 (Sun, 21 Jun 2009) | 1 line
Revert [54025] "Try to avoid using special macro handling code."
........
r54142 | danieljames | 2009-06-21 10:42:05 +0100 (Sun, 21 Jun 2009) | 1 line
Get <boost/functional/hash/extensions.hpp> to work.
........
r54143 | danieljames | 2009-06-21 10:42:20 +0100 (Sun, 21 Jun 2009) | 1 line
Move BOOST_HASH_CHAR_TRAITS from container_fwd into the hash headers, and undefine it.
........
r54144 | danieljames | 2009-06-21 10:42:40 +0100 (Sun, 21 Jun 2009) | 1 line
Move the support for hashing containers into the extension header, and improve the standard tests.
........
r54145 | danieljames | 2009-06-21 10:51:59 +0100 (Sun, 21 Jun 2009) | 1 line
I didn't mean to comment this out.
........
r54399 | danieljames | 2009-06-27 08:39:12 +0100 (Sat, 27 Jun 2009) | 1 line
Add am implementation note about the Visual C++ problems.
........
[SVN r54402]
2009-06-27 08:12:20 +00:00
|
|
|
typedef std::complex<Float> complex;
|
|
|
|
|
generic_complex_tests(complex(0,0));
|
|
|
|
|
generic_complex_tests(complex(0.5,0));
|
|
|
|
|
generic_complex_tests(complex(25,0));
|
|
|
|
|
generic_complex_tests(complex(25,0));
|
2011-01-04 23:06:53 +00:00
|
|
|
generic_complex_tests(complex(static_cast<Float>(-67.5324535),static_cast<Float>(56.23578678)));
|
2007-11-25 18:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <class Integer>
|
|
|
|
|
void complex_integral_tests(Integer*)
|
|
|
|
|
{
|
Merge latest hash developments:
* Avoid float to int warning.
* Work around 'using namespace' bug in Visual C++.
* Make `<boost/functional/hash/extensions.hpp> self contained.
* Move some of the extension implementation from the main hash header
into the exensions header.
* Remove BOOST_HASH_CHAR_TRAITS from `container_fwd.hpp`.
* Other minor changes.
Merged revisions 53828,53924,54024-54025,54033-54034,54139-54145,54399 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53828 | danieljames | 2009-06-12 19:24:47 +0100 (Fri, 12 Jun 2009) | 1 line
Try to avoid float to int warning when a float function doesn't exist.
........
r53924 | danieljames | 2009-06-15 08:37:42 +0100 (Mon, 15 Jun 2009) | 4 lines
Remove hash_complex_test's dependency on Boost.Random.
Only test for a few values, but that should be okay as there isn't much
to test.
........
r54024 | danieljames | 2009-06-17 22:22:49 +0100 (Wed, 17 Jun 2009) | 1 line
Put the minimum amount of implementation in the same namespace as the 'using namespace' directives in order to avoid Visual C++ 8 bug.
........
r54025 | danieljames | 2009-06-17 22:23:42 +0100 (Wed, 17 Jun 2009) | 1 line
Try to avoid using special macro handling code.
........
r54033 | danieljames | 2009-06-18 00:24:28 +0100 (Thu, 18 Jun 2009) | 1 line
Add copyright to namespace_fail_test.cpp
........
r54034 | danieljames | 2009-06-18 00:25:12 +0100 (Thu, 18 Jun 2009) | 1 line
A couple of missing newlines.
........
r54139 | danieljames | 2009-06-21 10:41:11 +0100 (Sun, 21 Jun 2009) | 1 line
A few more comments in boost::hash.
........
r54140 | danieljames | 2009-06-21 10:41:30 +0100 (Sun, 21 Jun 2009) | 1 line
Move includes to the header which they're used in.
........
r54141 | danieljames | 2009-06-21 10:41:46 +0100 (Sun, 21 Jun 2009) | 1 line
Revert [54025] "Try to avoid using special macro handling code."
........
r54142 | danieljames | 2009-06-21 10:42:05 +0100 (Sun, 21 Jun 2009) | 1 line
Get <boost/functional/hash/extensions.hpp> to work.
........
r54143 | danieljames | 2009-06-21 10:42:20 +0100 (Sun, 21 Jun 2009) | 1 line
Move BOOST_HASH_CHAR_TRAITS from container_fwd into the hash headers, and undefine it.
........
r54144 | danieljames | 2009-06-21 10:42:40 +0100 (Sun, 21 Jun 2009) | 1 line
Move the support for hashing containers into the extension header, and improve the standard tests.
........
r54145 | danieljames | 2009-06-21 10:51:59 +0100 (Sun, 21 Jun 2009) | 1 line
I didn't mean to comment this out.
........
r54399 | danieljames | 2009-06-27 08:39:12 +0100 (Sat, 27 Jun 2009) | 1 line
Add am implementation note about the Visual C++ problems.
........
[SVN r54402]
2009-06-27 08:12:20 +00:00
|
|
|
typedef std::complex<Integer> complex;
|
|
|
|
|
generic_complex_tests(complex(0,0));
|
|
|
|
|
generic_complex_tests(complex(15342,124));
|
|
|
|
|
generic_complex_tests(complex(25,54356));
|
|
|
|
|
generic_complex_tests(complex(5325,2346));
|
|
|
|
|
generic_complex_tests(complex(-243897,-49923874));
|
|
|
|
|
generic_complex_tests(complex(-543,763));
|
2007-11-25 18:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-19 09:02:10 +00:00
|
|
|
int main()
|
2007-11-25 18:38:02 +00:00
|
|
|
{
|
2009-11-29 16:14:10 +00:00
|
|
|
// I've comments out the short and unsigned short tests
|
|
|
|
|
// as they cause warnings and don't really test
|
|
|
|
|
// anything that the other tests already deal with.
|
|
|
|
|
|
2007-11-25 18:38:02 +00:00
|
|
|
complex_float_tests((float*) 0);
|
|
|
|
|
complex_float_tests((double*) 0);
|
|
|
|
|
complex_float_tests((long double*) 0);
|
2009-11-29 16:14:10 +00:00
|
|
|
//complex_integral_tests((short*) 0);
|
2007-11-25 18:38:02 +00:00
|
|
|
complex_integral_tests((int*) 0);
|
|
|
|
|
complex_integral_tests((long*) 0);
|
2009-11-29 16:14:10 +00:00
|
|
|
//complex_integral_tests((unsigned short*) 0);
|
2007-11-25 18:38:02 +00:00
|
|
|
complex_integral_tests((unsigned int*) 0);
|
|
|
|
|
complex_integral_tests((unsigned long*) 0);
|
|
|
|
|
|
2008-07-19 09:02:10 +00:00
|
|
|
return boost::report_errors();
|
2007-11-25 18:38:02 +00:00
|
|
|
}
|
|
|
|
|
|
Merge latest hash developments:
* Avoid float to int warning.
* Work around 'using namespace' bug in Visual C++.
* Make `<boost/functional/hash/extensions.hpp> self contained.
* Move some of the extension implementation from the main hash header
into the exensions header.
* Remove BOOST_HASH_CHAR_TRAITS from `container_fwd.hpp`.
* Other minor changes.
Merged revisions 53828,53924,54024-54025,54033-54034,54139-54145,54399 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r53828 | danieljames | 2009-06-12 19:24:47 +0100 (Fri, 12 Jun 2009) | 1 line
Try to avoid float to int warning when a float function doesn't exist.
........
r53924 | danieljames | 2009-06-15 08:37:42 +0100 (Mon, 15 Jun 2009) | 4 lines
Remove hash_complex_test's dependency on Boost.Random.
Only test for a few values, but that should be okay as there isn't much
to test.
........
r54024 | danieljames | 2009-06-17 22:22:49 +0100 (Wed, 17 Jun 2009) | 1 line
Put the minimum amount of implementation in the same namespace as the 'using namespace' directives in order to avoid Visual C++ 8 bug.
........
r54025 | danieljames | 2009-06-17 22:23:42 +0100 (Wed, 17 Jun 2009) | 1 line
Try to avoid using special macro handling code.
........
r54033 | danieljames | 2009-06-18 00:24:28 +0100 (Thu, 18 Jun 2009) | 1 line
Add copyright to namespace_fail_test.cpp
........
r54034 | danieljames | 2009-06-18 00:25:12 +0100 (Thu, 18 Jun 2009) | 1 line
A couple of missing newlines.
........
r54139 | danieljames | 2009-06-21 10:41:11 +0100 (Sun, 21 Jun 2009) | 1 line
A few more comments in boost::hash.
........
r54140 | danieljames | 2009-06-21 10:41:30 +0100 (Sun, 21 Jun 2009) | 1 line
Move includes to the header which they're used in.
........
r54141 | danieljames | 2009-06-21 10:41:46 +0100 (Sun, 21 Jun 2009) | 1 line
Revert [54025] "Try to avoid using special macro handling code."
........
r54142 | danieljames | 2009-06-21 10:42:05 +0100 (Sun, 21 Jun 2009) | 1 line
Get <boost/functional/hash/extensions.hpp> to work.
........
r54143 | danieljames | 2009-06-21 10:42:20 +0100 (Sun, 21 Jun 2009) | 1 line
Move BOOST_HASH_CHAR_TRAITS from container_fwd into the hash headers, and undefine it.
........
r54144 | danieljames | 2009-06-21 10:42:40 +0100 (Sun, 21 Jun 2009) | 1 line
Move the support for hashing containers into the extension header, and improve the standard tests.
........
r54145 | danieljames | 2009-06-21 10:51:59 +0100 (Sun, 21 Jun 2009) | 1 line
I didn't mean to comment this out.
........
r54399 | danieljames | 2009-06-27 08:39:12 +0100 (Sat, 27 Jun 2009) | 1 line
Add am implementation note about the Visual C++ problems.
........
[SVN r54402]
2009-06-27 08:12:20 +00:00
|
|
|
#endif // TEST_EXTENSIONS
|