[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / deque / deque.cons / size_value.pass.cpp
blob8730975f5b25553a1eab95dc27a9c95059b3ced3
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <deque>
11 // deque(size_type n, const value_type& v);
13 #include <deque>
14 #include <cassert>
15 #include <cstddef>
17 #include "test_macros.h"
18 #include "test_allocator.h"
19 #include "min_allocator.h"
21 template <class T, class Allocator>
22 void
23 test(unsigned n, const T& x)
25 typedef std::deque<T, Allocator> C;
26 typedef typename C::const_iterator const_iterator;
27 C d(n, x);
28 assert(d.size() == n);
29 assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
30 for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
31 assert(*i == x);
34 int main(int, char**)
36 test<int, std::allocator<int> >(0, 5);
37 test<int, std::allocator<int> >(1, 10);
38 test<int, std::allocator<int> >(10, 11);
39 test<int, std::allocator<int> >(1023, -11);
40 test<int, std::allocator<int> >(1024, 25);
41 test<int, std::allocator<int> >(1025, 0);
42 test<int, std::allocator<int> >(2047, 110);
43 test<int, std::allocator<int> >(2048, -500);
44 test<int, std::allocator<int> >(2049, 654);
45 test<int, std::allocator<int> >(4095, 78);
46 test<int, std::allocator<int> >(4096, 1165);
47 test<int, std::allocator<int> >(4097, 157);
48 LIBCPP_ONLY(test<int, limited_allocator<int, 4096> >(4095, 90));
49 #if TEST_STD_VER >= 11
50 test<int, min_allocator<int> >(4095, 90);
51 #endif
53 return 0;