From 977280900226660cdc234fe50c3619f424026f5a Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sun, 2 Feb 2020 23:21:36 -0500 Subject: [PATCH] Update tests --- test/constexpr_tests.hpp | 8 ++++---- test/static_string.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/test/constexpr_tests.hpp b/test/constexpr_tests.hpp index 7a1a0ca..51099df 100644 --- a/test/constexpr_tests.hpp +++ b/test/constexpr_tests.hpp @@ -11,7 +11,7 @@ #include // char_traits aren't constexpr until c++17 -#ifdef BOOST_STATIC_STRING_CPP14 +#ifdef BOOST_STATIC_STRING_STANDARD_VERSION <= 201703L struct cxper_char_traits { using char_type = char; @@ -192,7 +192,7 @@ testConstantEvaluation() a.replace(a.begin(), a.end(), a.begin(), a.end()); a.replace(a.begin(), a.end(), {'a'}); -#ifdef BOOST_STATIC_STRING_USE_IS_CONST_EVAL +#ifdef BOOST_STATIC_STRING_IS_CONST_EVAL a.replace(a.begin(), a.end(), "a"); a.replace(a.begin(), a.end(), "a", 1); #endif @@ -381,7 +381,7 @@ testConstantEvaluation() a.replace(a.begin(), a.end(), a.begin(), a.end()); a.replace(a.begin(), a.end(), {'a'}); -#ifdef BOOST_STATIC_STRING_USE_IS_CONST_EVAL +#ifdef BOOST_STATIC_STRING_IS_CONST_EVAL a.replace(a.begin(), a.end(), "a"); a.replace(a.begin(), a.end(), "a", 1); #endif @@ -556,7 +556,7 @@ testConstantEvaluation() a.replace(a.begin(), a.end(), a.begin(), a.end()); a.replace(a.begin(), a.end(), {'a'}); -#ifdef BOOST_STATIC_STRING_USE_IS_CONST_EVAL +#ifdef BOOST_STATIC_STRING_IS_CONST_EVAL a.replace(a.begin(), a.end(), "a"); a.replace(a.begin(), a.end(), "a", 1); #endif diff --git a/test/static_string.cpp b/test/static_string.cpp index e8edc2d..5d528c4 100644 --- a/test/static_string.cpp +++ b/test/static_string.cpp @@ -6911,6 +6911,15 @@ void testHash() BOOST_TEST(hasher(U("1234567890")) == hasher(U("1234567890"))); } +void testEmpty() +{ + using E = static_string<0>; + E a; + BOOST_TEST(a.size() == 0); + BOOST_TEST(a.data()); + BOOST_TEST(!a.capacity()); +} + int runTests() { @@ -6946,6 +6955,8 @@ runTests() testStartsEnds(); testHash(); + testEmpty(); + return report_errors(); }