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 // bool empty() const noexcept;
13 
14 #include <string>
15 #include <cassert>
16 
17 #include "test_macros.h"
18 #include "min_allocator.h"
19 
20 template <class S>
21 void
test(const S & s)22 test(const S& s)
23 {
24     ASSERT_NOEXCEPT(s.empty());
25     assert(s.empty() == (s.size() == 0));
26 }
27 
main()28 int main()
29 {
30     {
31     typedef std::string S;
32     test(S());
33     test(S("123"));
34     test(S("12345678901234567890123456789012345678901234567890"));
35     }
36 #if TEST_STD_VER >= 11
37     {
38     typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
39     test(S());
40     test(S("123"));
41     test(S("12345678901234567890123456789012345678901234567890"));
42     }
43 #endif
44 }
45