| Index: test/compiled/String.cpp |
| diff --git a/test/compiled/String.cpp b/test/compiled/String.cpp |
| index e969ccde556eb61d9b3b67a6303fca1eddec8b9b..ffd54c91ecb0d8d86dc124e7cbfe91122cc2410d 100644 |
| --- a/test/compiled/String.cpp |
| +++ b/test/compiled/String.cpp |
| @@ -21,6 +21,41 @@ |
| ABP_NS_USING |
| +void checkConstexprTemplateCtor() |
| +{ |
| + static constexpr DependentString s(u"Test string"); |
| +} |
| + |
| +void checkConstexprInvalidCtor() |
| +{ |
| + static constexpr DependentString s; |
|
sergei
2018/03/16 13:43:27
What is the reason to have `static` variables?
René Jeschke
2018/03/16 17:00:47
It's an old habit. As I am using 'const' a lot, I
hub
2018/03/16 17:11:32
Yes, please.
|
| + static_assert(s.is_invalid(), "String should be invalid"); |
| +} |
| + |
| +void checkConstexprCtor() |
| +{ |
| + static const String::value_type chars[] = u"Test string"; |
| + static const String::size_type length = sizeof(chars) / sizeof(chars[0]) - 1; |
| + static constexpr DependentString s(chars, length); |
| +} |
| + |
| +void checkConstexprFuncsAndOps() |
| +{ |
| + static constexpr DependentString s = u"Test string"_str; |
| + static constexpr DependentString s2 = u"Test string"_str; |
| + |
| + static_assert(s.length() == s2.length(), "Length should be equal"); |
| + static_assert(s.equals(s2), "Strings should be equal"); |
| + static_assert(s == s2, "Strings should be equal"); |
| + |
| + static_assert(!s.empty(), "String should not be empty"); |
| + static_assert(!s.is_writable(), "String should not be writable"); |
| + static_assert(!s.is_deleted(), "String should not be deleted"); |
| + |
| + static_assert(s.data()[0] == 'T', "First character should be 'T'"); |
| + static_assert(s[1] == 'e', "Second character should be 'e'"); |
| +} |
| + |
| TEST(TestString, constructInvalidDependentString) |
| { |
| DependentString s; |