forked from boostorg/container_hash
Stop using Boost.Assign in tests as it currently doesn't work on all the compilers I want to support. A pity, but I was already making very limited use of it because of older compilers.
[SVN r27917]
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
#else
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
|
||||
namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
@@ -21,13 +20,15 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
for(int j = 0; j < i; ++j)
|
||||
boost::assign::insert(containers[i])(0,0);
|
||||
containers[i].insert(std::make_pair(0, 0));
|
||||
}
|
||||
|
||||
boost::assign::insert(containers[6])(1,0);
|
||||
boost::assign::insert(containers[7])(1,0)(1,0);
|
||||
boost::assign::insert(containers[8])(-1,1);
|
||||
boost::assign::insert(containers[9])(-1,3)(-1,3);
|
||||
containers[6].insert(std::make_pair(1,0));
|
||||
containers[7].insert(std::make_pair(1,0));
|
||||
containers[7].insert(std::make_pair(1,0));
|
||||
containers[8].insert(std::make_pair(-1,1));
|
||||
containers[9].insert(std::make_pair(-1,3));
|
||||
containers[9].insert(std::make_pair(-1,3));
|
||||
|
||||
boost::hash<T> hasher;
|
||||
|
||||
|
@@ -39,11 +39,12 @@ void numeric_test()
|
||||
|
||||
// A hash function can legally fail these tests, but it'll not be a good
|
||||
// sign.
|
||||
BOOST_CHECK_EQUAL((T(1) != T(-1)), (x1(T(1)) != x2(T(-1))));
|
||||
BOOST_CHECK_EQUAL((T(1) != T(2)), (x1(T(1)) != x2(T(2))));
|
||||
BOOST_CHECK_EQUAL(
|
||||
((limits::max)() != (limits::max)() - 1),
|
||||
(x1((limits::max)()) != x2((limits::max)() - 1)));
|
||||
if(T(1) != T(-1))
|
||||
BOOST_CHECK(x1(T(1)) != x2(T(-1)));
|
||||
if(T(1) != T(2))
|
||||
BOOST_CHECK(x1(T(1)) != x2(T(2)));
|
||||
if((limits::max)() != (limits::max)() - 1)
|
||||
BOOST_CHECK(x1((limits::max)()) != x2((limits::max)() - 1));
|
||||
}
|
||||
|
||||
#define NUMERIC_TEST(type, name) \
|
||||
|
@@ -9,29 +9,30 @@
|
||||
#else
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
|
||||
namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
template <class T>
|
||||
void integer_tests(T* = 0)
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
const int number_of_containers = 11;
|
||||
T containers[number_of_containers];
|
||||
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
for(int j = 0; j < i; ++j)
|
||||
boost::assign::push_back(containers[i])(0);
|
||||
containers[i].push_back(0);
|
||||
}
|
||||
|
||||
boost::assign::push_back(containers[5])(1);
|
||||
boost::assign::push_back(containers[6])(1)(1);
|
||||
boost::assign::push_back(containers[7])(-1);
|
||||
boost::assign::push_back(containers[8])(-1)(-1);
|
||||
boost::assign::push_back(containers[9])(1)(-1);
|
||||
boost::assign::push_back(containers[10])(-1)(1);
|
||||
containers[5].push_back(1);
|
||||
containers[6].push_back(1);
|
||||
containers[6].push_back(1);
|
||||
containers[7].push_back(-1);
|
||||
containers[8].push_back(-1);
|
||||
containers[8].push_back(-1);
|
||||
containers[9].push_back(1);
|
||||
containers[9].push_back(-1);
|
||||
containers[10].push_back(-1);
|
||||
containers[10].push_back(1);
|
||||
|
||||
boost::hash<T> hasher;
|
||||
|
||||
|
@@ -9,28 +9,28 @@
|
||||
#else
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
|
||||
namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
|
||||
{
|
||||
template <class T>
|
||||
void integer_tests(T* = 0)
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
const int number_of_containers = 11;
|
||||
T containers[number_of_containers];
|
||||
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
for(int j = 0; j < i; ++j)
|
||||
boost::assign::insert(containers[i])(0);
|
||||
containers[i].insert(0);
|
||||
}
|
||||
|
||||
boost::assign::insert(containers[6])(1);
|
||||
boost::assign::insert(containers[7])(1)(1);
|
||||
boost::assign::insert(containers[8])(-1);
|
||||
boost::assign::insert(containers[9])(-1)(-1);
|
||||
boost::assign::insert(containers[10])(-1)(1);
|
||||
containers[6].insert(1);
|
||||
containers[7].insert(1);
|
||||
containers[7].insert(1);
|
||||
containers[8].insert(-1);
|
||||
containers[9].insert(-1);
|
||||
containers[9].insert(-1);
|
||||
containers[10].insert(-1);
|
||||
containers[10].insert(1);
|
||||
|
||||
boost::hash<T> hasher;
|
||||
|
||||
|
Reference in New Issue
Block a user