1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <deque> 11 12 // deque(size_type n, const value_type& v); 13 14 #include <deque> 15 #include <cassert> 16 17 #include "../../../stack_allocator.h" 18 #include "../../../min_allocator.h" 19 20 template <class T, class Allocator> 21 void 22 test(unsigned n, const T& x) 23 { 24 typedef std::deque<T, Allocator> C; 25 typedef typename C::const_iterator const_iterator; 26 C d(n, x); 27 assert(d.size() == n); 28 assert(distance(d.begin(), d.end()) == d.size()); 29 for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) 30 assert(*i == x); 31 } 32 33 int main() 34 { 35 test<int, std::allocator<int> >(0, 5); 36 test<int, std::allocator<int> >(1, 10); 37 test<int, std::allocator<int> >(10, 11); 38 test<int, std::allocator<int> >(1023, -11); 39 test<int, std::allocator<int> >(1024, 25); 40 test<int, std::allocator<int> >(1025, 0); 41 test<int, std::allocator<int> >(2047, 110); 42 test<int, std::allocator<int> >(2048, -500); 43 test<int, std::allocator<int> >(2049, 654); 44 test<int, std::allocator<int> >(4095, 78); 45 test<int, std::allocator<int> >(4096, 1165); 46 test<int, std::allocator<int> >(4097, 157); 47 test<int, stack_allocator<int, 4096> >(4095, 90); 48 #if __cplusplus >= 201103L 49 test<int, min_allocator<int> >(4095, 90); 50 #endif 51 } 52