llvm-project/libcxx/test/strings/basic.string/string.capacity/max_size.pass.cpp

31 lines
668 B
C++
Raw Normal View History

2010-05-12 03:42:16 +08:00
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
2010-05-12 03:42:16 +08:00
//
2010-11-17 06:09:02 +08:00
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
2010-05-12 03:42:16 +08:00
//
//===----------------------------------------------------------------------===//
// <string>
// size_type max_size() const;
#include <string>
#include <cassert>
template <class S>
void
test(const S& s)
{
assert(s.max_size() >= s.size());
}
int main()
{
typedef std::string S;
test(S());
test(S("123"));
test(S("12345678901234567890123456789012345678901234567890"));
}