mirror of
https://github.com/boostorg/container_hash.git
synced 2026-02-23 15:42:18 +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]
This commit is contained in:
@@ -5,18 +5,20 @@
|
||||
|
||||
#include "./config.hpp"
|
||||
|
||||
#ifdef TEST_EXTENSIONS
|
||||
# ifdef TEST_STD_INCLUDES
|
||||
# include <functional>
|
||||
# else
|
||||
# include <boost/functional/hash.hpp>
|
||||
# endif
|
||||
#if !defined(TEST_EXTENSIONS)
|
||||
|
||||
int main() {}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef TEST_STD_INCLUDES
|
||||
# include <functional>
|
||||
#else
|
||||
# include <boost/functional/hash.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#ifdef TEST_EXTENSIONS
|
||||
|
||||
#include <complex>
|
||||
#include <sstream>
|
||||
#include <boost/limits.hpp>
|
||||
@@ -27,11 +29,6 @@
|
||||
#pragma warning(disable:4512) // assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
#include <boost/random/uniform_int.hpp>
|
||||
#include <boost/random/uniform_real.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
@@ -61,33 +58,24 @@ void generic_complex_tests(std::complex<T> v)
|
||||
template <class Float>
|
||||
void complex_float_tests(Float*)
|
||||
{
|
||||
boost::mt19937 rng;
|
||||
boost::uniform_real<Float> uniform;
|
||||
boost::variate_generator<boost::mt19937&, boost::uniform_real<Float> >
|
||||
uniform_generator(rng, uniform);
|
||||
|
||||
for(int i = 0; i < 100; ++i)
|
||||
{
|
||||
std::complex<Float> v(uniform_generator(), uniform_generator());
|
||||
generic_complex_tests(v);
|
||||
}
|
||||
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));
|
||||
generic_complex_tests(complex(-67.5324535,56.23578678));
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
void complex_integral_tests(Integer*)
|
||||
{
|
||||
boost::mt19937 rng;
|
||||
boost::uniform_int<Integer> uniform(
|
||||
(std::numeric_limits<Integer>::min)(),
|
||||
(std::numeric_limits<Integer>::max)());
|
||||
boost::variate_generator<boost::mt19937&, boost::uniform_int<Integer> >
|
||||
uniform_generator(rng, uniform);
|
||||
|
||||
for(int i = 0; i < 100; ++i)
|
||||
{
|
||||
std::complex<Integer>v(uniform_generator(), uniform_generator());
|
||||
generic_complex_tests(v);
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -105,4 +93,4 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // TEST_EXTENSIONS
|
||||
|
||||
Reference in New Issue
Block a user