blob: b945b1beb1dac070fd5b01e0e2628bbf79109321 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
3// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
4//
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}