blob: 3806f36082b25051b7c1a824861b47a5a3c4f94a [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-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// basic_string<charT,traits,Allocator>& operator=(charT c);
13
14#include <string>
15#include <cassert>
16
17template <class S>
18void
19test(S s1, typename S::value_type s2)
20{
21 typedef typename S::traits_type T;
22 s1 = s2;
23 assert(s1.__invariants());
24 assert(s1.size() == 1);
25 assert(T::eq(s1[0], s2));
26 assert(s1.capacity() >= s1.size());
27}
28
29int main()
30{
31 typedef std::string S;
32 test(S(), 'a');
33 test(S("1"), 'a');
34 test(S("123456789"), 'a');
35 test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), 'a');
36}