[libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", part 8/12.

Add static_cast<std::size_t> when comparing distance() to size().

These replacements were performed programmatically with regex_replace():

const vector<pair<regex, string>> reg_fmt = {
    { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"),
        "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" },
    { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"),
        "assert(static_cast<std::size_t>(distance($1)) == $2.size())" },
    { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"),
        "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" },
};

Also, include <cstddef> when it wasn't already being included.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288745 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stephan T. Lavavej
2016-12-06 01:12:34 +00:00
parent d95f62ecd2
commit 98605940df
117 changed files with 1046 additions and 943 deletions

View File

@@ -65,8 +65,8 @@ int main()
V(8, 2) V(8, 2)
}; };
std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::map<int, double>::iterator i; std::map<int, double>::iterator i;
i = m.begin(); i = m.begin();
std::map<int, double>::const_iterator k = i; std::map<int, double>::const_iterator k = i;
@@ -109,10 +109,10 @@ int main()
V(8, 2) V(8, 2)
}; };
const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::map<int, double>::const_iterator i; std::map<int, double>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
@@ -152,8 +152,8 @@ int main()
V(8, 2) V(8, 2)
}; };
std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::map<int, double, std::less<int>, min_allocator<V>>::iterator i; std::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
i = m.begin(); i = m.begin();
std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i; std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
@@ -196,10 +196,10 @@ int main()
V(8, 2) V(8, 2)
}; };
const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i; std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)

View File

@@ -28,6 +28,7 @@
#include <map> #include <map>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -64,8 +65,8 @@ int main()
V(8, 2) V(8, 2)
}; };
std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multimap<int, double>::iterator i; std::multimap<int, double>::iterator i;
i = m.begin(); i = m.begin();
std::multimap<int, double>::const_iterator k = i; std::multimap<int, double>::const_iterator k = i;
@@ -109,10 +110,10 @@ int main()
V(8, 2) V(8, 2)
}; };
const std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multimap<int, double>::const_iterator i; std::multimap<int, double>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; j <= 8; ++j) for (int j = 1; j <= 8; ++j)
@@ -153,8 +154,8 @@ int main()
V(8, 2) V(8, 2)
}; };
std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i; std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
i = m.begin(); i = m.begin();
std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i; std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
@@ -198,10 +199,10 @@ int main()
V(8, 2) V(8, 2)
}; };
const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i; std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; j <= 8; ++j) for (int j = 1; j <= 8; ++j)

View File

@@ -15,6 +15,7 @@
#include <set> #include <set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "min_allocator.h" #include "min_allocator.h"
@@ -27,7 +28,7 @@ int main()
C m = {10, 8}; C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6}); m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8); assert(m.size() == 8);
assert(distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin(); C::const_iterator i = m.cbegin();
assert(*i == V(1)); assert(*i == V(1));
assert(*++i == V(2)); assert(*++i == V(2));
@@ -46,7 +47,7 @@ int main()
C m = {10, 8}; C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6}); m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8); assert(m.size() == 8);
assert(distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin(); C::const_iterator i = m.cbegin();
assert(*i == V(1)); assert(*i == V(1));
assert(*++i == V(2)); assert(*++i == V(2));

View File

@@ -28,6 +28,7 @@
#include <set> #include <set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -64,8 +65,8 @@ int main()
8 8
}; };
std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multiset<int>::iterator i; std::multiset<int>::iterator i;
i = m.begin(); i = m.begin();
std::multiset<int>::const_iterator k = i; std::multiset<int>::const_iterator k = i;
@@ -104,10 +105,10 @@ int main()
8 8
}; };
const std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multiset<int>::const_iterator i; std::multiset<int>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; j <= 8; ++j) for (int j = 1; j <= 8; ++j)
@@ -145,8 +146,8 @@ int main()
8 8
}; };
std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multiset<int, std::less<int>, min_allocator<int>>::iterator i; std::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
i = m.begin(); i = m.begin();
std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i; std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
@@ -185,10 +186,10 @@ int main()
8 8
}; };
const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i; std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; j <= 8; ++j) for (int j = 1; j <= 8; ++j)

View File

@@ -15,6 +15,7 @@
#include <set> #include <set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "min_allocator.h" #include "min_allocator.h"
@@ -27,7 +28,7 @@ int main()
C m = {10, 8}; C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6}); m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8); assert(m.size() == 8);
assert(distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin(); C::const_iterator i = m.cbegin();
assert(*i == V(1)); assert(*i == V(1));
assert(*++i == V(2)); assert(*++i == V(2));
@@ -45,7 +46,7 @@ int main()
C m = {10, 8}; C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6}); m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8); assert(m.size() == 8);
assert(distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin(); C::const_iterator i = m.cbegin();
assert(*i == V(1)); assert(*i == V(1));
assert(*++i == V(2)); assert(*++i == V(2));

View File

@@ -65,8 +65,8 @@ int main()
8 8
}; };
std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::set<int>::iterator i; std::set<int>::iterator i;
i = m.begin(); i = m.begin();
std::set<int>::const_iterator k = i; std::set<int>::const_iterator k = i;
@@ -104,10 +104,10 @@ int main()
8 8
}; };
const std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::set<int>::const_iterator i; std::set<int>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
@@ -144,8 +144,8 @@ int main()
8 8
}; };
std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::set<int, std::less<int>, min_allocator<int>>::iterator i; std::set<int, std::less<int>, min_allocator<int>>::iterator i;
i = m.begin(); i = m.begin();
std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i; std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
@@ -183,10 +183,10 @@ int main()
8 8
}; };
const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size()); assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::set<int, std::less<int>, min_allocator<int>>::const_iterator i; std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin(); i = m.begin();
for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)

View File

@@ -50,7 +50,7 @@ test(C& c1, int size)
typename C::size_type c1_osize = c1.size(); typename C::size_type c1_osize = c1.size();
c1.resize(size); c1.resize(size);
assert(c1.size() == size); assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
CI i = c1.begin(); CI i = c1.begin();
for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i) for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
assert(*i == j); assert(*i == j);

View File

@@ -50,7 +50,7 @@ test(C& c1, int size, int x)
typename C::size_type c1_osize = c1.size(); typename C::size_type c1_osize = c1.size();
c1.resize(size, x); c1.resize(size, x);
assert(c1.size() == size); assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
CI i = c1.begin(); CI i = c1.begin();
for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i) for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
assert(*i == j); assert(*i == j);

View File

@@ -14,6 +14,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -46,7 +47,7 @@ void
test(C& c1, const C& c2) test(C& c1, const C& c2)
{ {
c1.assign(c2.begin(), c2.end()); c1.assign(c2.begin(), c2.end());
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
assert(c1 == c2); assert(c1 == c2);
} }
@@ -66,7 +67,7 @@ testI(C& c1, const C& c2)
typedef typename C::const_iterator CI; typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI; typedef input_iterator<CI> ICI;
c1.assign(ICI(c2.begin()), ICI(c2.end())); c1.assign(ICI(c2.begin()), ICI(c2.end()));
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
assert(c1 == c2); assert(c1 == c2);
} }

View File

@@ -13,6 +13,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -47,7 +48,7 @@ test(C& c1, int size, int v)
typedef typename C::const_iterator CI; typedef typename C::const_iterator CI;
c1.assign(size, v); c1.assign(size, v);
assert(c1.size() == size); assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
for (CI i = c1.begin(); i != c1.end(); ++i) for (CI i = c1.begin(); i != c1.end(); ++i)
assert(*i == v); assert(*i == v);
} }

View File

@@ -13,6 +13,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_allocator.h" #include "test_allocator.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -27,8 +28,8 @@ test(InputIterator f, InputIterator l)
typedef std::deque<T, Allocator> C; typedef std::deque<T, Allocator> C;
typedef typename C::const_iterator const_iterator; typedef typename C::const_iterator const_iterator;
C d(f, l); C d(f, l);
assert(d.size() == std::distance(f, l)); assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
assert(*i == *f); assert(*i == *f);
} }
@@ -41,8 +42,8 @@ test(InputIterator f, InputIterator l)
typedef std::deque<T, Allocator> C; typedef std::deque<T, Allocator> C;
typedef typename C::const_iterator const_iterator; typedef typename C::const_iterator const_iterator;
C d(f, l); C d(f, l);
assert(d.size() == std::distance(f, l)); assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
assert(*i == *f); assert(*i == *f);
} }

View File

@@ -14,6 +14,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_iterators.h" #include "test_iterators.h"
#include "test_allocator.h" #include "test_allocator.h"
@@ -28,8 +29,8 @@ test(InputIterator f, InputIterator l, const Allocator& a)
typedef typename C::const_iterator const_iterator; typedef typename C::const_iterator const_iterator;
C d(f, l, a); C d(f, l, a);
assert(d.get_allocator() == a); assert(d.get_allocator() == a);
assert(d.size() == std::distance(f, l)); assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
assert(*i == *f); assert(*i == *f);
} }

View File

@@ -13,6 +13,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_allocator.h" #include "test_allocator.h"
@@ -31,7 +32,7 @@ test2(unsigned n)
C d(n, Allocator()); C d(n, Allocator());
assert(DefaultOnly::count == n); assert(DefaultOnly::count == n);
assert(d.size() == n); assert(d.size() == n);
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == T()); assert(*i == T());
@@ -52,7 +53,7 @@ test1(unsigned n)
C d(n); C d(n);
assert(DefaultOnly::count == n); assert(DefaultOnly::count == n);
assert(d.size() == n); assert(d.size() == n);
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == T()); assert(*i == T());

View File

@@ -13,6 +13,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_allocator.h" #include "test_allocator.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -25,7 +26,7 @@ test(unsigned n, const T& x)
typedef typename C::const_iterator const_iterator; typedef typename C::const_iterator const_iterator;
C d(n, x); C d(n, x);
assert(d.size() == n); assert(d.size() == n);
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == x); assert(*i == x);
} }

View File

@@ -13,6 +13,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "min_allocator.h" #include "min_allocator.h"
@@ -25,7 +26,7 @@ test(unsigned n, const T& x, const Allocator& a)
C d(n, x, a); C d(n, x, a);
assert(d.get_allocator() == a); assert(d.get_allocator() == a);
assert(d.size() == n); assert(d.size() == n);
assert(distance(d.begin(), d.end()) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == x); assert(*i == x);
} }

View File

@@ -15,6 +15,7 @@
#include <deque> #include <deque>
#include <cassert> #include <cassert>
#include <cstddef>
#include "../../../Emplaceable.h" #include "../../../Emplaceable.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -51,7 +52,7 @@ test(int P, C& c1)
CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5)); CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + 1); assert(c1.size() == c1_osize + 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
assert(*i == Emplaceable(1, 2.5)); assert(*i == Emplaceable(1, 2.5));
} }

View File

@@ -51,7 +51,7 @@ test(int P, C& c1)
I i = c1.erase(c1.cbegin() + P); I i = c1.erase(c1.cbegin() + P);
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize - 1); assert(c1.size() == c1_osize - 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
int j = 0; int j = 0;
for (; j < P; ++j, ++i) for (; j < P; ++j, ++i)

View File

@@ -53,7 +53,7 @@ test(int P, C& c1, int size)
I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size)); I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize - size); assert(c1.size() == c1_osize - size);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
int j = 0; int j = 0;
for (; j < P; ++j, ++i) for (; j < P; ++j, ++i)

View File

@@ -58,7 +58,7 @@ test(int P, const C& c0, const C& c2)
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end())); CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size()); assert(c1.size() == c1_osize + c2.size());
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == j); assert(*i == j);
@@ -75,7 +75,7 @@ test(int P, const C& c0, const C& c2)
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end())); CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size()); assert(c1.size() == c1_osize + c2.size());
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == j); assert(*i == j);
@@ -92,7 +92,7 @@ test(int P, const C& c0, const C& c2)
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end())); CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size()); assert(c1.size() == c1_osize + c2.size());
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == j); assert(*i == j);
@@ -173,7 +173,7 @@ testI(int P, C& c1, const C& c2)
CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end())); CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end()));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size()); assert(c1.size() == c1_osize + c2.size());
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == j); assert(*i == j);

View File

@@ -52,7 +52,7 @@ test(int P, C& c1, int x)
CI i = c1.insert(c1.begin() + P, MoveOnly(x)); CI i = c1.insert(c1.begin() + P, MoveOnly(x));
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + 1); assert(c1.size() == c1_osize + 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == MoveOnly(j)); assert(*i == MoveOnly(j));

View File

@@ -51,7 +51,7 @@ test(int P, C& c1, int size, int x)
CI i = c1.insert(c1.begin() + P, size, x); CI i = c1.insert(c1.begin() + P, size, x);
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + size); assert(c1.size() == c1_osize + size);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == j); assert(*i == j);
@@ -121,7 +121,7 @@ self_reference_test()
CI jt = c.cbegin() + j; CI jt = c.cbegin() + j;
c.insert(it, 5, *jt); c.insert(it, 5, *jt);
assert(c.size() == 25); assert(c.size() == 25);
assert(distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(distance(c.begin(), c.end())) == c.size());
it = c.cbegin(); it = c.cbegin();
for (int k = 0; k < i; ++k, ++it) for (int k = 0; k < i; ++k, ++it)
assert(*it == k); assert(*it == k);

View File

@@ -49,7 +49,7 @@ test(int P, C& c1, int x)
CI i = c1.insert(c1.begin() + P, x); CI i = c1.insert(c1.begin() + P, x);
assert(i == c1.begin() + P); assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + 1); assert(c1.size() == c1_osize + 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin(); i = c1.begin();
for (int j = 0; j < P; ++j, ++i) for (int j = 0; j < P; ++j, ++i)
assert(*i == j); assert(*i == j);
@@ -103,7 +103,7 @@ self_reference_test()
CI jt = c.cbegin() + j; CI jt = c.cbegin() + j;
c.insert(it, *jt); c.insert(it, *jt);
assert(c.size() == 21); assert(c.size() == 21);
assert(distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(distance(c.begin(), c.end())) == c.size());
it = c.cbegin(); it = c.cbegin();
for (int k = 0; k < i; ++k, ++it) for (int k = 0; k < i; ++k, ++it)
assert(*it == k); assert(*it == k);

View File

@@ -47,7 +47,7 @@ test(C& c1)
std::size_t c1_osize = c1.size(); std::size_t c1_osize = c1.size();
c1.pop_back(); c1.pop_back();
assert(c1.size() == c1_osize - 1); assert(c1.size() == c1_osize - 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin(); I i = c1.begin();
for (int j = 0; static_cast<std::size_t>(j) < c1.size(); ++j, ++i) for (int j = 0; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
assert(*i == j); assert(*i == j);

View File

@@ -47,7 +47,7 @@ test(C& c1)
std::size_t c1_osize = c1.size(); std::size_t c1_osize = c1.size();
c1.pop_front(); c1.pop_front();
assert(c1.size() == c1_osize - 1); assert(c1.size() == c1_osize - 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin(); I i = c1.begin();
for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i) for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
assert(*i == j); assert(*i == j);

View File

@@ -47,7 +47,7 @@ test(C& c1, int x)
std::size_t c1_osize = c1.size(); std::size_t c1_osize = c1.size();
c1.push_front(x); c1.push_front(x);
assert(c1.size() == c1_osize + 1); assert(c1.size() == c1_osize + 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin(); I i = c1.begin();
assert(*i == x); assert(*i == x);
++i; ++i;

View File

@@ -50,7 +50,7 @@ test(C& c1, int x)
std::size_t c1_osize = c1.size(); std::size_t c1_osize = c1.size();
c1.push_front(MoveOnly(x)); c1.push_front(MoveOnly(x));
assert(c1.size() == c1_osize + 1); assert(c1.size() == c1_osize + 1);
assert(distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin(); I i = c1.begin();
assert(*i == MoveOnly(x)); assert(*i == MoveOnly(x));
++i; ++i;

View File

@@ -14,6 +14,7 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -25,7 +26,7 @@ test(Iterator first, Iterator last)
{ {
C c(first, last); C c(first, last);
LIBCPP_ASSERT(c.__invariants()); LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last)); assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first); assert(*i == *first);
} }

View File

@@ -15,6 +15,7 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -26,7 +27,7 @@ test(Iterator first, Iterator last, const typename C::allocator_type& a)
{ {
C c(first, last, a); C c(first, last, a);
LIBCPP_ASSERT(c.__invariants()); LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last)); assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first); assert(*i == *first);
} }

View File

@@ -13,6 +13,7 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -26,7 +27,7 @@ test(Iterator first, Iterator last)
{ {
C c(first, last); C c(first, last);
LIBCPP_ASSERT(c.__invariants()); LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last)); assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first); assert(*i == *first);

View File

@@ -14,6 +14,7 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -27,7 +28,7 @@ test(Iterator first, Iterator last, const A& a)
{ {
C c(first, last, a); C c(first, last, a);
LIBCPP_ASSERT(c.__invariants()); LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last)); assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first); assert(*i == *first);

View File

@@ -23,6 +23,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -44,8 +45,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
} }
{ {
@@ -63,8 +64,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -84,8 +85,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
} }
{ {
@@ -104,8 +105,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#endif #endif

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "../../test_compare.h" #include "../../test_compare.h"
#include "../../test_hash.h" #include "../../test_hash.h"
@@ -42,8 +43,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -51,8 +52,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -90,8 +91,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -99,8 +100,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -128,8 +129,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -141,8 +142,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -189,8 +190,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -202,8 +203,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -222,8 +223,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -231,8 +232,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -270,8 +271,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -279,8 +280,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -308,8 +309,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -321,8 +322,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -369,8 +370,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -382,8 +383,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -402,8 +403,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -411,8 +412,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -450,8 +451,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -459,8 +460,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -488,8 +489,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -501,8 +502,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -549,8 +550,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -562,8 +563,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -68,8 +69,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4)); assert(c.get_allocator() == A(4));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -131,8 +132,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -177,8 +178,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "../../../test_compare.h" #include "../../../test_compare.h"
#include "../../../test_hash.h" #include "../../../test_hash.h"
@@ -54,8 +55,8 @@ int main()
assert(c.at(2) == "two"); assert(c.at(2) == "two");
assert(c.at(3) == "three"); assert(c.at(3) == "three");
assert(c.at(4) == "four"); assert(c.at(4) == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -87,8 +88,8 @@ int main()
assert(c.at(2) == "two"); assert(c.at(2) == "two");
assert(c.at(3) == "three"); assert(c.at(3) == "three");
assert(c.at(4) == "four"); assert(c.at(4) == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -69,8 +70,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4)); assert(c.get_allocator() == A(4));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -114,8 +115,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c0.size() == 0); assert(c0.size() == 0);
@@ -160,8 +161,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c0.size() == 0); assert(c0.size() == 0);
@@ -207,8 +208,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c0.size() == 0); assert(c0.size() == 0);

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -63,8 +64,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -103,8 +104,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(other_allocator<std::pair<const int, std::string> >(-2))); (other_allocator<std::pair<const int, std::string> >(-2)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -142,8 +143,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -63,8 +64,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(5))); (test_allocator<std::pair<const int, std::string> >(5)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -103,8 +104,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -142,8 +143,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A{}); assert(c.get_allocator() == A{});
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -55,8 +56,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -87,8 +88,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -119,8 +120,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -152,8 +153,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -58,8 +59,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -92,8 +93,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -59,8 +60,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -94,8 +95,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -61,8 +62,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -97,8 +98,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -62,8 +63,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -99,8 +100,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -135,8 +136,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A{}); assert(c.get_allocator() == A{});
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -50,8 +51,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(c.empty()); assert(c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -91,8 +92,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -117,8 +118,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(c.empty()); assert(c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -158,8 +159,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -64,8 +65,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(12)); assert(c.get_allocator() == A(12));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -105,8 +106,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -147,8 +148,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -188,8 +189,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A{}); assert(c.get_allocator() == A{});
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);

View File

@@ -20,6 +20,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -59,8 +60,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -93,8 +94,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -126,8 +127,8 @@ int main()
assert(c.key_eq() == Comp()); assert(c.key_eq() == Comp());
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -161,8 +162,8 @@ int main()
assert(c.key_eq() == Comp()); assert(c.key_eq() == Comp());
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -62,8 +63,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -98,8 +99,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -64,8 +65,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -101,8 +102,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -65,8 +66,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >())); (test_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -103,8 +104,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -23,6 +23,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -67,8 +68,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -106,8 +107,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -144,8 +145,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A{}); assert(c.get_allocator() == A{});
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "../../../test_compare.h" #include "../../../test_compare.h"
#include "../../../test_hash.h" #include "../../../test_hash.h"
@@ -42,8 +43,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -51,8 +52,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -90,8 +91,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -99,8 +100,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -128,8 +129,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -141,8 +142,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -189,8 +190,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -202,8 +203,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -222,8 +223,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -231,8 +232,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -270,8 +271,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -279,8 +280,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -308,8 +309,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -321,8 +322,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -369,8 +370,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -382,8 +383,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -402,8 +403,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -411,8 +412,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -450,8 +451,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -459,8 +460,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -488,8 +489,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -501,8 +502,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -549,8 +550,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -562,8 +563,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -23,6 +23,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -44,8 +45,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
i = c.begin(); i = c.begin();
i->second = "ONE"; i->second = "ONE";
@@ -66,8 +67,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -87,8 +88,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
i = c.begin(); i = c.begin();
i->second = "ONE"; i->second = "ONE";
@@ -110,8 +111,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#endif #endif

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -62,8 +63,8 @@ void test(const C& c)
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../test_compare.h" #include "../../test_compare.h"
@@ -44,8 +45,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -53,8 +54,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -92,8 +93,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -101,8 +102,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -130,8 +131,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -145,8 +146,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -193,8 +194,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -208,8 +209,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -229,8 +230,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -238,8 +239,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -277,8 +278,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -286,8 +287,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -315,8 +316,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -330,8 +331,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -378,8 +379,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -393,8 +394,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -414,8 +415,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -423,8 +424,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -462,8 +463,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -471,8 +472,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -500,8 +501,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -515,8 +516,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -563,8 +564,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -578,8 +579,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -82,8 +83,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4)); assert(c.get_allocator() == A(4));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -159,8 +160,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -219,8 +220,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "../../../test_compare.h" #include "../../../test_compare.h"
#include "../../../test_hash.h" #include "../../../test_hash.h"
@@ -79,8 +80,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -136,8 +137,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -89,8 +90,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -154,8 +155,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -219,8 +220,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -285,8 +286,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -77,8 +78,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -131,8 +132,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(other_allocator<std::pair<const int, std::string> >(-2))); (other_allocator<std::pair<const int, std::string> >(-2)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -184,8 +185,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -77,8 +78,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(5))); (test_allocator<std::pair<const int, std::string> >(5)));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -131,8 +132,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -184,8 +185,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A{}); assert(c.get_allocator() == A{});
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -74,8 +75,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());
@@ -128,8 +129,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());
@@ -183,8 +184,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == HF()); assert(c.hash_function() == HF());
@@ -239,8 +240,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == hf); assert(c.hash_function() == hf);

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -77,8 +78,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());
@@ -133,8 +134,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -78,8 +79,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -135,8 +136,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -80,8 +81,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -138,8 +139,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -81,8 +82,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -140,8 +141,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -199,8 +200,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -59,8 +60,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10))); (test_allocator<std::pair<const int, std::string> >(10)));
assert(c.empty()); assert(c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -119,8 +120,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -159,8 +160,8 @@ int main()
assert(c.get_allocator() == assert(c.get_allocator() ==
(min_allocator<std::pair<const int, std::string> >())); (min_allocator<std::pair<const int, std::string> >()));
assert(c.empty()); assert(c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -219,8 +220,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -86,8 +87,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -150,8 +151,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -215,8 +216,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -279,8 +280,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -20,6 +20,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -78,8 +79,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());
@@ -134,8 +135,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());
@@ -191,8 +192,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == HF()); assert(c.hash_function() == HF());
@@ -249,8 +250,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == hf); assert(c.hash_function() == hf);

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -81,8 +82,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());
@@ -139,8 +140,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.hash_function() == test_hash<std::hash<int> >());

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -83,8 +84,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -142,8 +143,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -84,8 +85,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -144,8 +145,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -23,6 +23,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -86,8 +87,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -147,8 +148,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -208,8 +209,8 @@ int main()
i = eq.first; i = eq.first;
assert(i->first == 4); assert(i->first == 4);
assert(i->second == "four"); assert(i->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8)); assert(c.hash_function() == test_hash<std::hash<int> >(8));

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "min_allocator.h" #include "min_allocator.h"
@@ -73,8 +74,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
@@ -119,8 +120,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#endif #endif
#if TEST_STD_VER >= 14 #if TEST_STD_VER >= 14

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "min_allocator.h" #include "min_allocator.h"
@@ -81,8 +82,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 2); assert(c.erase(2) == 2);
assert(c.size() == 4); assert(c.size() == 4);
@@ -104,8 +105,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 0); assert(c.erase(2) == 0);
assert(c.size() == 4); assert(c.size() == 4);
@@ -127,8 +128,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 1); assert(c.erase(4) == 1);
assert(c.size() == 3); assert(c.size() == 3);
@@ -145,8 +146,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 0); assert(c.erase(4) == 0);
assert(c.size() == 3); assert(c.size() == 3);
@@ -163,8 +164,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 2); assert(c.erase(1) == 2);
assert(c.size() == 1); assert(c.size() == 1);
@@ -173,8 +174,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 0); assert(c.erase(1) == 0);
assert(c.size() == 1); assert(c.size() == 1);
@@ -183,22 +184,22 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(3) == 1); assert(c.erase(3) == 1);
assert(c.size() == 0); assert(c.size() == 0);
eq = c.equal_range(3); eq = c.equal_range(3);
assert(std::distance(eq.first, eq.second) == 0); assert(std::distance(eq.first, eq.second) == 0);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(3) == 0); assert(c.erase(3) == 0);
assert(c.size() == 0); assert(c.size() == 0);
eq = c.equal_range(3); eq = c.equal_range(3);
assert(std::distance(eq.first, eq.second) == 0); assert(std::distance(eq.first, eq.second) == 0);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
@@ -244,8 +245,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 2); assert(c.erase(2) == 2);
assert(c.size() == 4); assert(c.size() == 4);
@@ -267,8 +268,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 0); assert(c.erase(2) == 0);
assert(c.size() == 4); assert(c.size() == 4);
@@ -290,8 +291,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 1); assert(c.erase(4) == 1);
assert(c.size() == 3); assert(c.size() == 3);
@@ -308,8 +309,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 0); assert(c.erase(4) == 0);
assert(c.size() == 3); assert(c.size() == 3);
@@ -326,8 +327,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 2); assert(c.erase(1) == 2);
assert(c.size() == 1); assert(c.size() == 1);
@@ -336,8 +337,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 0); assert(c.erase(1) == 0);
assert(c.size() == 1); assert(c.size() == 1);
@@ -346,22 +347,22 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 3); assert(k->first == 3);
assert(k->second == "three"); assert(k->second == "three");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(3) == 1); assert(c.erase(3) == 1);
assert(c.size() == 0); assert(c.size() == 0);
eq = c.equal_range(3); eq = c.equal_range(3);
assert(std::distance(eq.first, eq.second) == 0); assert(std::distance(eq.first, eq.second) == 0);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(3) == 0); assert(c.erase(3) == 0);
assert(c.size() == 0); assert(c.size() == 0);
eq = c.equal_range(3); eq = c.equal_range(3);
assert(std::distance(eq.first, eq.second) == 0); assert(std::distance(eq.first, eq.second) == 0);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
{ {
typedef std::unordered_multimap<int, int> C; typedef std::unordered_multimap<int, int> C;

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "min_allocator.h" #include "min_allocator.h"
@@ -68,8 +69,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(i, j); k = c.erase(i, j);
assert(c.size() == 4); assert(c.size() == 4);
@@ -91,8 +92,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(c.cbegin(), c.cend()); k = c.erase(c.cbegin(), c.cend());
assert(c.size() == 0); assert(c.size() == 0);
@@ -145,8 +146,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(i, j); k = c.erase(i, j);
assert(c.size() == 4); assert(c.size() == 4);
@@ -168,8 +169,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(c.cbegin(), c.cend()); k = c.erase(c.cbegin(), c.cend());
assert(c.size() == 0); assert(c.size() == 0);

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_iterators.h" #include "test_iterators.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -67,8 +68,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
@@ -114,8 +115,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#endif #endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS

View File

@@ -19,6 +19,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_iterators.h" #include "test_iterators.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -67,8 +68,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
@@ -114,8 +115,8 @@ int main()
k = eq.first; k = eq.first;
assert(k->first == 4); assert(k->first == 4);
assert(k->second == "four"); assert(k->second == "four");
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
} }
#endif #endif
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -43,8 +44,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -52,8 +53,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -91,8 +92,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -100,8 +101,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -129,8 +130,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -144,8 +145,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -192,8 +193,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -207,8 +208,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -228,8 +229,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -237,8 +238,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -276,8 +277,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -285,8 +286,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -314,8 +315,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -329,8 +330,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -377,8 +378,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -392,8 +393,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -413,8 +414,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -422,8 +423,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -461,8 +462,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -470,8 +471,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -499,8 +500,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -514,8 +515,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -562,8 +563,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -577,8 +578,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -22,6 +22,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -43,8 +44,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
} }
{ {
@@ -62,8 +63,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -83,8 +84,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
} }
{ {
@@ -103,8 +104,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7); assert(c.bucket_count() >= 7);
assert(c.size() == 6); assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#endif #endif

View File

@@ -17,6 +17,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../test_compare.h" #include "../../test_compare.h"
@@ -42,8 +43,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -51,8 +52,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -90,8 +91,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -99,8 +100,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -128,8 +129,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -141,8 +142,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -189,8 +190,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -202,8 +203,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -223,8 +224,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -232,8 +233,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -271,8 +272,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -280,8 +281,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -309,8 +310,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -322,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -370,8 +371,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -383,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -404,8 +405,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -413,8 +414,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -452,8 +453,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -461,8 +462,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -490,8 +491,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -503,8 +504,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -551,8 +552,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -564,8 +565,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -18,6 +18,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -75,8 +76,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4)); assert(c.get_allocator() == A(4));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -147,8 +148,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -201,8 +202,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "../../../test_compare.h" #include "../../../test_compare.h"
#include "../../../test_hash.h" #include "../../../test_hash.h"
@@ -54,8 +55,8 @@ int main()
assert(c.count(2) == 2); assert(c.count(2) == 2);
assert(c.count(3) == 1); assert(c.count(3) == 1);
assert(c.count(4) == 1); assert(c.count(4) == 1);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -87,8 +88,8 @@ int main()
assert(c.count(2) == 2); assert(c.count(2) == 2);
assert(c.count(3) == 1); assert(c.count(3) == 1);
assert(c.count(4) == 1); assert(c.count(4) == 1);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -76,8 +77,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4)); assert(c.get_allocator() == A(4));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -121,8 +122,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -166,8 +167,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -212,8 +213,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -257,8 +258,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -69,8 +70,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10)); assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -116,8 +117,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == other_allocator<int>(-2)); assert(c.get_allocator() == other_allocator<int>(-2));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -162,8 +163,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -69,8 +70,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(5)); assert(c.get_allocator() == test_allocator<int>(5));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -116,8 +117,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -53,8 +54,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -84,8 +85,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -118,8 +119,8 @@ int main()
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!(c.get_allocator() == A())); assert(!(c.get_allocator() == A()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -153,8 +154,8 @@ int main()
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!(c.get_allocator() == A())); assert(!(c.get_allocator() == A()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -56,8 +57,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -89,8 +90,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -58,8 +59,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -92,8 +93,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -59,8 +60,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -94,8 +95,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -60,8 +61,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10)); assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -96,8 +97,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -19,6 +19,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -57,8 +58,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10)); assert(c.get_allocator() == test_allocator<int>(10));
assert(c.empty()); assert(c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -97,8 +98,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10)); assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -133,8 +134,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(c.empty()); assert(c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -173,8 +174,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);

View File

@@ -19,6 +19,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -71,8 +72,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(12)); assert(c.get_allocator() == A(12));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -112,8 +113,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -154,8 +155,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
@@ -195,8 +196,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);

View File

@@ -19,6 +19,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -56,8 +57,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -89,8 +90,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -123,8 +124,8 @@ int main()
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!(c.get_allocator() == A())); assert(!(c.get_allocator() == A()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -158,8 +159,8 @@ int main()
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
assert(!(c.get_allocator() == A())); assert(!(c.get_allocator() == A()));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -59,8 +60,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -94,8 +95,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -61,8 +62,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -97,8 +98,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -62,8 +63,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>()); assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -99,8 +100,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
@@ -64,8 +65,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10)); assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -102,8 +103,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == min_allocator<int>()); assert(c.get_allocator() == min_allocator<int>());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -17,6 +17,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -42,8 +43,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -51,8 +52,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -90,8 +91,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -99,8 +100,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -128,8 +129,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -141,8 +142,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -189,8 +190,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -202,8 +203,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -223,8 +224,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -232,8 +233,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -271,8 +272,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -280,8 +281,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -309,8 +310,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -322,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -370,8 +371,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -383,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -404,8 +405,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -413,8 +414,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -452,8 +453,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -461,8 +462,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -490,8 +491,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -503,8 +504,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -551,8 +552,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 6); assert(c2.bucket_count() >= 6);
@@ -564,8 +565,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -22,6 +22,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
@@ -43,8 +44,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
} }
{ {
@@ -62,8 +63,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -83,8 +84,8 @@ int main()
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i; C::iterator i;
} }
{ {
@@ -103,8 +104,8 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0])); const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 5); assert(c.bucket_count() >= 5);
assert(c.size() == 4); assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i; C::const_iterator i;
} }
#endif #endif

View File

@@ -17,6 +17,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../test_compare.h" #include "../../test_compare.h"
@@ -42,8 +43,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -51,8 +52,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -90,8 +91,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -99,8 +100,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -128,8 +129,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -141,8 +142,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -189,8 +190,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(1)); assert(c1.get_allocator() == Alloc(1));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -202,8 +203,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(2)); assert(c2.get_allocator() == Alloc(2));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
@@ -223,8 +224,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -232,8 +233,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -271,8 +272,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -280,8 +281,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -309,8 +310,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -322,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -370,8 +371,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2)); assert(c1.get_allocator() == Alloc(2));
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -383,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1)); assert(c2.get_allocator() == Alloc(1));
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
@@ -404,8 +405,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -413,8 +414,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -452,8 +453,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
LIBCPP_ASSERT(c2.bucket_count() == 0); LIBCPP_ASSERT(c2.bucket_count() == 0);
@@ -461,8 +462,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -490,8 +491,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -503,8 +504,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
{ {
@@ -551,8 +552,8 @@ int main()
assert(c1.hash_function() == Hash(2)); assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2)); assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc()); assert(c1.get_allocator() == Alloc());
assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2); assert(c1.max_load_factor() == 2);
assert(c2.bucket_count() >= 4); assert(c2.bucket_count() >= 4);
@@ -564,8 +565,8 @@ int main()
assert(c2.hash_function() == Hash(1)); assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1)); assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc()); assert(c2.get_allocator() == Alloc());
assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#endif #endif

View File

@@ -18,6 +18,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "test_macros.h" #include "test_macros.h"
#include "../../../test_compare.h" #include "../../../test_compare.h"
@@ -67,8 +68,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4)); assert(c.get_allocator() == A(4));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -130,8 +131,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10)); assert(c.get_allocator() == A(10));
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -176,8 +177,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9)); assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A()); assert(c.get_allocator() == A());
assert(!c.empty()); assert(!c.empty());
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

View File

@@ -18,6 +18,7 @@
#include <unordered_set> #include <unordered_set>
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include <cstddef>
#include "../../../test_compare.h" #include "../../../test_compare.h"
#include "../../../test_hash.h" #include "../../../test_hash.h"
@@ -54,8 +55,8 @@ int main()
assert(c.count(2) == 1); assert(c.count(2) == 1);
assert(c.count(3) == 1); assert(c.count(3) == 1);
assert(c.count(4) == 1); assert(c.count(4) == 1);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
@@ -87,8 +88,8 @@ int main()
assert(c.count(2) == 1); assert(c.count(2) == 1);
assert(c.count(3) == 1); assert(c.count(3) == 1);
assert(c.count(4) == 1); assert(c.count(4) == 1);
assert(std::distance(c.begin(), c.end()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }

Some files were not shown because too many files have changed in this diff Show More