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 // void pop_back(); 13 14 #include <string> 15 #include <cassert> 16 17 template <class S> 18 void 19 test(S s, S expected) 20 { 21 s.pop_back(); 22 assert(s.__invariants()); 23 assert(s == expected); 24 } 25 26 int main() 27 { 28 typedef std::string S; 29 test(S("abcde"), S("abcd")); 30 test(S("abcdefghij"), S("abcdefghi")); 31 test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); 32 } 33