blob: ea4e21657d2416a69dd4864d99ff0908329ec8b3 [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//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <string>
11
12// explicit basic_string(const Allocator& a = Allocator());
13
14#include <string>
15#include <cassert>
16
17#include "../test_allocator.h"
18
19template <class S>
20void
21test()
22{
23 {
24 S s;
25 assert(s.__invariants());
26 assert(s.data());
27 assert(s.size() == 0);
28 assert(s.capacity() >= s.size());
29 assert(s.get_allocator() == typename S::allocator_type());
30 }
31 {
32 S s(typename S::allocator_type(5));
33 assert(s.__invariants());
34 assert(s.data());
35 assert(s.size() == 0);
36 assert(s.capacity() >= s.size());
37 assert(s.get_allocator() == typename S::allocator_type(5));
38 }
39}
40
41int main()
42{
43 test<std::basic_string<char, std::char_traits<char>, test_allocator<char> > >();
44}