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 // <string> 11 12 // explicit basic_string(const Allocator& a = Allocator()); 13 14 #include <string> 15 #include <cassert> 16 17 #include "../test_allocator.h" 18 19 template <class S> 20 void 21 test() 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 41 int main() 42 { 43 test<std::basic_string<char, std::char_traits<char>, test_allocator<char> > >(); 44 } 45