More tests for unordered associative containers.

[SVN r2959]
This commit is contained in:
Daniel James
2006-05-21 17:14:11 +00:00
parent 822b0c7ffd
commit fbd37a946b
28 changed files with 1975 additions and 86 deletions

View File

@@ -15,20 +15,38 @@
namespace test
{
template <class T>
bool equivalent(T const& x, T const& y) {
bool equivalent_impl(T const& x, T const& y) {
return x == y;
}
template <class T>
bool equivalent(boost::hash<T> const&, boost::hash<T> const&) {
bool equivalent_impl(boost::hash<T> const&, boost::hash<T> const&) {
return true;
}
template <class T>
bool equivalent(std::equal_to<T> const&, std::equal_to<T> const&) {
bool equivalent_impl(std::equal_to<T> const&, std::equal_to<T> const&) {
return true;
}
template <class T1, class T2, class T3, class T4>
bool equivalent_impl(std::pair<T1, T2> const& x1,
std::pair<T3, T4> const& x2) {
return equivalent_impl(x1.first, x2.first) &&
equivalent_impl(x1.second, x2.second);
}
struct equivalent_type {
template <class T1, class T2>
bool operator()(T1 const& x, T2 const& y) {
return equivalent_impl(x, y);
}
};
namespace {
equivalent_type equivalent;
}
template <class Container>
class unordered_equivalence_tester
{
@@ -56,8 +74,8 @@ namespace test
bool operator()(Container const& x) const
{
if(!((size_ == x.size()) &&
(test::equivalent(hasher_, x.hash_function())) &&
(test::equivalent(key_equal_, x.key_eq())) &&
(test::equivalent_impl(hasher_, x.hash_function())) &&
(test::equivalent_impl(key_equal_, x.key_eq())) &&
(max_load_factor_ == x.max_load_factor()) &&
(values_.size() == x.size()))) return false;