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, const allocator_type& a); 13 14 #include <deque> 15 #include <cassert> 16 #include <cstddef> 17 18 #include "min_allocator.h" 19 20 template <class T, class Allocator> 21 void 22 test(unsigned n, const T& x, const Allocator& a) 23 { 24 typedef std::deque<T, Allocator> C; 25 typedef typename C::const_iterator const_iterator; 26 C d(n, x, a); 27 assert(d.get_allocator() == a); 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); 32 } 33 34 int main() 35 { 36 { 37 std::allocator<int> a; 38 test(0, 5, a); 39 test(1, 10, a); 40 test(10, 11, a); 41 test(1023, -11, a); 42 test(1024, 25, a); 43 test(1025, 0, a); 44 test(2047, 110, a); 45 test(2048, -500, a); 46 test(2049, 654, a); 47 test(4095, 78, a); 48 test(4096, 1165, a); 49 test(4097, 157, a); 50 } 51 #if TEST_STD_VER >= 11 52 { 53 min_allocator<int> a; 54 test(0, 5, a); 55 test(1, 10, a); 56 test(10, 11, a); 57 test(1023, -11, a); 58 test(1024, 25, a); 59 test(1025, 0, a); 60 test(2047, 110, a); 61 test(2048, -500, a); 62 test(2049, 654, a); 63 test(4095, 78, a); 64 test(4096, 1165, a); 65 test(4097, 157, a); 66 } 67 #endif 68 } 69