Fix copy/paste errors introduced in r289358

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier 2016-12-11 04:00:26 +00:00
parent 11f64dcc58
commit 47dfc5940d
2 changed files with 16 additions and 16 deletions

View File

@ -121,17 +121,17 @@ int main()
V(11, 11),
V(12, 12)
};
M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
assert(m1.get_allocator() == A(1));
assert(m1.get_allocator().get_id() == 1);
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(2));
assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
@ -155,17 +155,17 @@ int main()
V(11, 11),
V(12, 12)
};
M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
assert(m1.get_allocator().get_id() == 1); // not swapped
assert(m1.get_allocator() == A(2));
assert(m2.key_comp() == C(1));
assert(m2.get_allocator().get_id() == 2);
assert(m2.get_allocator() == A(1));
}
#if TEST_STD_VER >= 11
{

View File

@ -35,8 +35,8 @@ int main()
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2));
C c1(0, Hash(1), Compare(1), Alloc(1, 1));
C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@ -75,8 +75,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
C c1(0, Hash(1), Compare(1), Alloc(1, 1));
C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@ -121,8 +121,8 @@ int main()
P(1, "four"),
P(2, "four"),
};
C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2));
C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@ -176,8 +176,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);