forked from OSchip/llvm-project
[libcxx][test] Construct non-empty containers in iterator's debug mode tests
The debug mode tests for map/set's iterators construct empty containers, making the code after the first increment meaningless. It's never executed since the tests exit earlier. It doesn't seem to be intentional, so the patch makes the tests to construct containers that include at least one element. Reviewed By: curdeius, Quuxplusone Differential Revision: https://reviews.llvm.org/D100029
This commit is contained in:
parent
b0322a4ed2
commit
4a292eda25
|
@ -23,9 +23,13 @@
|
|||
|
||||
int main(int, char**) {
|
||||
typedef std::unordered_map<int, std::string> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c;
|
||||
c.insert(std::make_pair(42, std::string()));
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -27,9 +27,12 @@
|
|||
int main(int, char**) {
|
||||
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
|
||||
min_allocator<std::pair<const int, std::string>>> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c({{42, std::string()}});
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -23,9 +23,13 @@
|
|||
|
||||
int main(int, char**) {
|
||||
typedef std::unordered_multimap<int, std::string> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c;
|
||||
c.insert(std::make_pair(42, std::string()));
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -28,9 +28,13 @@
|
|||
int main(int, char**) {
|
||||
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
|
||||
min_allocator<std::pair<const int, std::string>>> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c({{1, std::string()}});
|
||||
c.insert(std::make_pair(42, std::string()));
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_multiset<T> C;
|
||||
C c(1);
|
||||
C c;
|
||||
c.insert(42);
|
||||
C::iterator i = c.begin();
|
||||
assert(i != c.end());
|
||||
++i;
|
||||
assert(i == c.end());
|
||||
++i;
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
|
||||
C c(1);
|
||||
C c({42});
|
||||
C::iterator i = c.begin();
|
||||
assert(i != c.end());
|
||||
++i;
|
||||
assert(i == c.end());
|
||||
++i;
|
||||
|
|
|
@ -23,9 +23,13 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_multiset<T> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c;
|
||||
c.insert(42);
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -26,9 +26,12 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c({42});
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_set<T> C;
|
||||
C c(1);
|
||||
C c;
|
||||
c.insert(42);
|
||||
C::iterator i = c.begin();
|
||||
assert(i != c.end());
|
||||
++i;
|
||||
assert(i == c.end());
|
||||
++i;
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
|
||||
C c(1);
|
||||
C c({42});
|
||||
C::iterator i = c.begin();
|
||||
assert(i != c.end());
|
||||
++i;
|
||||
assert(i == c.end());
|
||||
++i;
|
||||
|
|
|
@ -23,9 +23,13 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_set<T> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c;
|
||||
c.insert(42);
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
|
@ -26,9 +26,12 @@
|
|||
int main(int, char**) {
|
||||
typedef int T;
|
||||
typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
|
||||
C c(1);
|
||||
C::local_iterator i = c.begin(0);
|
||||
C c({42});
|
||||
C::size_type b = c.bucket(42);
|
||||
C::local_iterator i = c.begin(b);
|
||||
assert(i != c.end(b));
|
||||
++i;
|
||||
assert(i == c.end(b));
|
||||
++i;
|
||||
assert(false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue