mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-22 07:51:39 +08:00
[libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", part 9/12.
Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.) Also, include <cstddef> when it wasn't already being included. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288746 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_allocator.h"
|
||||
@@ -61,7 +62,7 @@ test(Tp n, Tp c)
|
||||
typedef typename S::allocator_type A;
|
||||
S s2(n, c);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s2.size() == n);
|
||||
assert(s2.size() == static_cast<std::size_t>(n));
|
||||
for (int i = 0; i < n; ++i)
|
||||
assert(s2[i] == c);
|
||||
assert(s2.get_allocator() == A());
|
||||
@@ -77,7 +78,7 @@ test(Tp n, Tp c, const A& a)
|
||||
typedef typename S::traits_type T;
|
||||
S s2(n, c, a);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s2.size() == n);
|
||||
assert(s2.size() == static_cast<std::size_t>(n));
|
||||
for (int i = 0; i < n; ++i)
|
||||
assert(s2[i] == c);
|
||||
assert(s2.get_allocator() == a);
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -29,8 +30,8 @@ test(S s)
|
||||
assert(e == s.begin());
|
||||
assert(ce == cs.begin());
|
||||
}
|
||||
assert(e - s.begin() == s.size());
|
||||
assert(ce - cs.begin() == cs.size());
|
||||
assert(static_cast<std::size_t>(e - s.begin()) == s.size());
|
||||
assert(static_cast<std::size_t>(ce - cs.begin()) == cs.size());
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -29,8 +30,8 @@ test(S s)
|
||||
assert(e == s.rbegin());
|
||||
assert(ce == cs.rbegin());
|
||||
}
|
||||
assert(e - s.rbegin() == s.size());
|
||||
assert(ce - cs.rbegin() == cs.size());
|
||||
assert(static_cast<std::size_t>(e - s.rbegin()) == s.size());
|
||||
assert(static_cast<std::size_t>(ce - cs.rbegin()) == cs.size());
|
||||
}
|
||||
|
||||
int main()
|
||||
|
Reference in New Issue
Block a user