2006-03-19 22:24:06 +00:00
|
|
|
|
2007-03-18 20:00:59 +00:00
|
|
|
// Copyright 2006-2007 Daniel James.
|
2006-07-01 22:31:26 +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)
|
2006-03-19 22:24:06 +00:00
|
|
|
|
|
|
|
// This test creates the containers with members that meet their minimum
|
|
|
|
// requirements. Makes sure everything compiles and is defined correctly.
|
|
|
|
|
|
|
|
#include <boost/unordered_set.hpp>
|
|
|
|
|
|
|
|
#include <iostream>
|
2008-03-24 17:03:15 +00:00
|
|
|
#include "../helpers/test.hpp"
|
2006-03-19 22:24:06 +00:00
|
|
|
#include "../objects/minimal.hpp"
|
|
|
|
#include "./compile_tests.hpp"
|
|
|
|
|
2008-03-24 17:03:15 +00:00
|
|
|
UNORDERED_AUTO_TEST(test0)
|
2006-03-19 22:24:06 +00:00
|
|
|
{
|
|
|
|
test::minimal::assignable assignable = test::minimal::assignable::create();
|
|
|
|
|
|
|
|
std::cout<<"Test unordered_set.\n";
|
|
|
|
boost::unordered_set<
|
|
|
|
test::minimal::assignable,
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
test::minimal::allocator<test::minimal::assignable> > set;
|
|
|
|
|
|
|
|
container_test(set, assignable);
|
|
|
|
|
|
|
|
std::cout<<"Test unordered_multiset.\n";
|
|
|
|
boost::unordered_multiset<
|
|
|
|
test::minimal::assignable,
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
test::minimal::allocator<test::minimal::assignable> > multiset;
|
|
|
|
|
|
|
|
container_test(multiset, assignable);
|
2008-01-06 17:13:15 +00:00
|
|
|
}
|
|
|
|
|
2008-03-24 17:03:15 +00:00
|
|
|
UNORDERED_AUTO_TEST(test1)
|
2008-01-06 17:13:15 +00:00
|
|
|
{
|
|
|
|
boost::hash<int> hash;
|
|
|
|
std::equal_to<int> equal_to;
|
|
|
|
int value = 0;
|
|
|
|
|
|
|
|
std::cout<<"Test unordered_set.\n";
|
|
|
|
|
|
|
|
boost::unordered_set<int> set;
|
|
|
|
|
|
|
|
unordered_unique_test(set, value);
|
|
|
|
unordered_set_test(set, value);
|
|
|
|
unordered_test(set, value, value, hash, equal_to);
|
|
|
|
|
|
|
|
std::cout<<"Test unordered_multiset.\n";
|
|
|
|
|
|
|
|
boost::unordered_multiset<int> multiset;
|
|
|
|
|
|
|
|
unordered_equivalent_test(multiset, value);
|
|
|
|
unordered_set_test(multiset, value);
|
|
|
|
unordered_test(multiset, value, value, hash, equal_to);
|
|
|
|
}
|
|
|
|
|
2008-03-24 17:03:15 +00:00
|
|
|
UNORDERED_AUTO_TEST(test2)
|
2008-01-06 17:13:15 +00:00
|
|
|
{
|
|
|
|
test::minimal::assignable assignable
|
|
|
|
= test::minimal::assignable::create();
|
|
|
|
test::minimal::copy_constructible copy_constructible
|
|
|
|
= test::minimal::copy_constructible::create();
|
|
|
|
test::minimal::hash<test::minimal::assignable> hash
|
|
|
|
= test::minimal::hash<test::minimal::assignable>::create();
|
|
|
|
test::minimal::equal_to<test::minimal::assignable> equal_to
|
|
|
|
= test::minimal::equal_to<test::minimal::assignable>::create();
|
|
|
|
|
|
|
|
std::cout<<"Test unordered_set.\n";
|
|
|
|
|
|
|
|
boost::unordered_set<
|
|
|
|
test::minimal::assignable,
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
test::minimal::allocator<test::minimal::assignable> > set;
|
|
|
|
|
|
|
|
unordered_unique_test(set, assignable);
|
|
|
|
unordered_set_test(set, assignable);
|
|
|
|
unordered_test(set, assignable, assignable, hash, equal_to);
|
|
|
|
|
|
|
|
std::cout<<"Test unordered_multiset.\n";
|
|
|
|
|
|
|
|
boost::unordered_multiset<
|
|
|
|
test::minimal::assignable,
|
|
|
|
test::minimal::hash<test::minimal::assignable>,
|
|
|
|
test::minimal::equal_to<test::minimal::assignable>,
|
|
|
|
test::minimal::allocator<test::minimal::assignable> > multiset;
|
|
|
|
|
|
|
|
unordered_equivalent_test(multiset, assignable);
|
|
|
|
unordered_set_test(multiset, assignable);
|
|
|
|
unordered_test(multiset, assignable, assignable, hash, equal_to);
|
|
|
|
}
|
|
|
|
|
2008-03-24 17:03:15 +00:00
|
|
|
RUN_TESTS()
|