blob: 6cca948ed834f77a0feab84ad84295ca24dbd58a [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <vector>
11// vector<bool>
12
13// vector(size_type n, const value_type& x, const allocator_type& a);
14
15#include <vector>
16#include <cassert>
17
Marshall Clow061d0cc2013-11-26 20:58:02 +000018#include "min_allocator.h"
Howard Hinnant2c39cbe2013-06-27 19:35:32 +000019
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000020template <class C>
21void
22test(typename C::size_type n, const typename C::value_type& x,
23 const typename C::allocator_type& a)
24{
25 C c(n, x, a);
Dan Albert1d4a1ed2016-05-25 22:36:09 -070026 assert(c.__invariants());
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000027 assert(a == c.get_allocator());
28 assert(c.size() == n);
29 for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
30 assert(*i == x);
31}
32
33int main()
34{
35 test<std::vector<bool> >(50, 3, std::allocator<bool>());
Dan Albert1d4a1ed2016-05-25 22:36:09 -070036#if __cplusplus >= 201103L
Howard Hinnant2c39cbe2013-06-27 19:35:32 +000037 test<std::vector<bool, min_allocator<bool>> >(50, 3, min_allocator<bool>());
38#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000039}