From 2d17369ac69c16978779ea63e9810e290f91813c Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 19 Jul 2017 13:46:11 +0000 Subject: [PATCH 0001/1520] Bump docs version to 6.0 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308462 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 17fb401a8..bb231ac3e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,9 +47,9 @@ copyright = u'2011-2017, LLVM Project' # built documents. # # The short X.Y version. -version = '5.0' +version = '6.0' # The full version, including alpha/beta/rc tags. -release = '5.0' +release = '6.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 12ab65892124784916007836b115780d3eb8efcd Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 19 Jul 2017 13:57:10 +0000 Subject: [PATCH 0002/1520] Update _LIBCPP_VERSION and the version in CMakeLists to 6.0 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308468 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 2 +- include/__config | 2 +- include/__libcpp_version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f8b24d17..66db8626f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(libcxx CXX C) set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 5.0.0svn) + set(PACKAGE_VERSION 6.0.0svn) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") diff --git a/include/__config b/include/__config index f15d2d06e..b0d065eb1 100644 --- a/include/__config +++ b/include/__config @@ -33,7 +33,7 @@ #define _GNUC_VER_NEW 0 #endif -#define _LIBCPP_VERSION 5000 +#define _LIBCPP_VERSION 6000 #ifndef _LIBCPP_ABI_VERSION #define _LIBCPP_ABI_VERSION 1 diff --git a/include/__libcpp_version b/include/__libcpp_version index e9c02dad1..a77fd92cf 100644 --- a/include/__libcpp_version +++ b/include/__libcpp_version @@ -1 +1 @@ -5000 +6000 From fea8dc97214d969f9d842602aa5e1429a9f93bc0 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Wed, 19 Jul 2017 21:48:49 +0000 Subject: [PATCH 0003/1520] Rework libcxx strerror_r handling. The set of #ifdefs used to handle the two incompatible variants of strerror_r were not complete (they didn't handle newlib appropriately). Rather than attempting to make the ifdefs more complex, make them unnecessary by choosing which behavior to use dependent upon the return type. Reviewers: waltl Differential Revision: https://reviews.llvm.org/D34294 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308528 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/system_error.cpp | 72 ++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/src/system_error.cpp b/src/system_error.cpp index 17f2c9a5b..72623ea6b 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -73,39 +73,59 @@ string do_strerror_r(int ev) { std::snprintf(buffer, strerror_buff_size, "unknown error %d", ev); return string(buffer); } -#elif defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) && \ - (!defined(__ANDROID__) || __ANDROID_API__ >= 23) -// GNU Extended version -string do_strerror_r(int ev) { - char buffer[strerror_buff_size]; - char* ret = ::strerror_r(ev, buffer, strerror_buff_size); - return string(ret); -} #else -// POSIX version + +// Only one of the two following functions will be used, depending on +// the return type of strerror_r: + +// For the GNU variant, a char* return value: +__attribute__((unused)) const char * +handle_strerror_r_return(char *strerror_return, char *buffer) { + // GNU always returns a string pointer in its return value. The + // string might point to either the input buffer, or a static + // buffer, but we don't care which. + return strerror_return; +} + +// For the POSIX variant: an int return value. +__attribute__((unused)) const char * +handle_strerror_r_return(int strerror_return, char *buffer) { + // The POSIX variant either: + // - fills in the provided buffer and returns 0 + // - returns a positive error value, or + // - returns -1 and fills in errno with an error value. + if (strerror_return == 0) + return buffer; + + // Only handle EINVAL. Other errors abort. + int new_errno = strerror_return == -1 ? errno : strerror_return; + if (new_errno == EINVAL) + return ""; + + _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerror_r"); + // FIXME maybe? 'strerror_buff_size' is likely to exceed the + // maximum error size so ERANGE shouldn't be returned. + std::abort(); +} + +// This function handles both GNU and POSIX variants, dispatching to +// one of the two above functions. string do_strerror_r(int ev) { char buffer[strerror_buff_size]; + // Preserve errno around the call. (The C++ standard requires that + // system_error functions not modify errno). const int old_errno = errno; - int ret; - if ((ret = ::strerror_r(ev, buffer, strerror_buff_size)) != 0) { - // If `ret == -1` then the error is specified using `errno`, otherwise - // `ret` represents the error. - const int new_errno = ret == -1 ? errno : ret; - errno = old_errno; - if (new_errno == EINVAL) { - std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev); - return string(buffer); - } else { - _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerr_r"); - // FIXME maybe? 'strerror_buff_size' is likely to exceed the - // maximum error size so ERANGE shouldn't be returned. - std::abort(); - } + const char *error_message = handle_strerror_r_return( + ::strerror_r(ev, buffer, strerror_buff_size), buffer); + // If we didn't get any message, print one now. + if (!error_message[0]) { + std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev); + error_message = buffer; } - return string(buffer); + errno = old_errno; + return string(error_message); } #endif - } // end namespace #endif From ffc9965e5871d3641f6dd75c1188fe2fd0177c2e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 19 Jul 2017 22:02:22 +0000 Subject: [PATCH 0004/1520] [libcxx] [test] Fix MSVC warning C4242 "conversion from 'int' to 'const char', possible loss of data". Fixes D34534. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308532 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../input.output/iostream.format/ext.manip/put_money.pass.cpp | 2 +- .../istream.formatted/istream_extractors/streambuf.pass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp index a00cf139b..66be9f0f7 100644 --- a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp +++ b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp @@ -40,7 +40,7 @@ protected: if (__c != base::traits_type::eof()) { int n = str_.size(); - str_.push_back(__c); + str_.push_back(static_cast(__c)); str_.resize(str_.capacity()); base::setp(const_cast(str_.data()), const_cast(str_.data() + str_.size())); diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp index 29ed68e97..a599d4d3d 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp @@ -46,7 +46,7 @@ protected: if (__c != base::traits_type::eof()) { int n = str_.size(); - str_.push_back(__c); + str_.push_back(static_cast(__c)); str_.resize(str_.capacity()); base::setp(const_cast(str_.data()), const_cast(str_.data() + str_.size())); From 321617c33dbaa93248e6b01ce3d2dfe35cb5cfa2 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 19 Jul 2017 22:02:25 +0000 Subject: [PATCH 0005/1520] [libcxx] [test] Fix MSVC warning C4067 "unexpected tokens following preprocessor directive - expected a newline". Also fixes Clang/LLVM 4.0 (for Windows) error "function-like macro 'TEST_GLIBC_PREREQ' is not defined". Fixes D34535. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308533 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../locale.moneypunct.byname/curr_symbol.pass.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp index 8490b708b..3a9adc4bb 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp @@ -117,7 +117,13 @@ int main() // GLIBC <= 2.23 uses currency_symbol="" // GLIBC >= 2.24 uses currency_symbol="" // See also: http://www.fileformat.info/info/unicode/char/20bd/index.htm -#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24) +#if defined(TEST_GLIBC_PREREQ) + #if TEST_GLIBC_PREREQ(2, 24) + #define TEST_GLIBC_2_24_CURRENCY_SYMBOL + #endif +#endif + +#if defined(TEST_GLIBC_2_24_CURRENCY_SYMBOL) assert(f.curr_symbol() == " \u20BD"); #else assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1"); @@ -129,7 +135,7 @@ int main() } { Fwf f(LOCALE_ru_RU_UTF_8, 1); -#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24) +#if defined(TEST_GLIBC_2_24_CURRENCY_SYMBOL) assert(f.curr_symbol() == L" \u20BD"); #else assert(f.curr_symbol() == L" \x440\x443\x431"); From 3c00cff59959d55d0040faf7a6498cb7eb2dcce7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 19 Jul 2017 22:02:29 +0000 Subject: [PATCH 0006/1520] [libcxx] [test] Fix Clang -Wunused-local-typedef warnings. Fix D34536. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308534 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../complex.number/complex.transcendentals/acos.pass.cpp | 1 - .../complex.number/complex.transcendentals/acosh.pass.cpp | 1 - .../complex.number/complex.transcendentals/asin.pass.cpp | 1 - .../complex.number/complex.transcendentals/asinh.pass.cpp | 1 - .../complex.number/complex.transcendentals/atanh.pass.cpp | 1 - .../complex.number/complex.transcendentals/cos.pass.cpp | 1 - .../complex.number/complex.transcendentals/cosh.pass.cpp | 1 - .../complex.number/complex.transcendentals/sin.pass.cpp | 1 - .../complex.number/complex.transcendentals/sinh.pass.cpp | 1 - .../complex.number/complex.transcendentals/tanh.pass.cpp | 1 - .../rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp | 5 ----- .../rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp | 3 --- .../rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp | 4 ---- .../rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp | 3 --- .../rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp | 6 ------ .../thread.threads/thread.thread.this/sleep_until.pass.cpp | 1 - 16 files changed, 32 deletions(-) diff --git a/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp index 1b0cca0d5..837734fcd 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const double pi = std::atan2(+0., -0.); const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) diff --git a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp index f1aece20e..deb056d67 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const double pi = std::atan2(+0., -0.); const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) diff --git a/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp index 2b213094d..8d7462141 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const double pi = std::atan2(+0., -0.); const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) diff --git a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp index 011f9d6b4..3da56c32f 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const double pi = std::atan2(+0., -0.); const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) diff --git a/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp index 6dc6034ca..37e00c392 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const double pi = std::atan2(+0., -0.); const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) diff --git a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp index 03ed727ca..be9d505b9 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp index a2c55390f..dad5bd190 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp index 7ae59980b..0ab8ac275 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp index 491f3fac5..e310f26dc 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp index 8fa419c21..1028836f9 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp index cfaddb73f..82e8ffc77 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp @@ -33,7 +33,6 @@ void test1() { typedef std::lognormal_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(-1./8192, 0.015625); @@ -78,7 +77,6 @@ void test2() { typedef std::lognormal_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(-1./32, 0.25); @@ -123,7 +121,6 @@ void test3() { typedef std::lognormal_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(-1./8, 0.5); @@ -168,7 +165,6 @@ void test4() { typedef std::lognormal_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d; @@ -213,7 +209,6 @@ void test5() { typedef std::lognormal_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(-0.78125, 1.25); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp index b207eece6..6ae230180 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp @@ -33,7 +33,6 @@ int main() { { typedef std::student_t_distribution<> D; - typedef D::param_type P; typedef std::minstd_rand G; G g; D d(5.5); @@ -69,7 +68,6 @@ int main() } { typedef std::student_t_distribution<> D; - typedef D::param_type P; typedef std::minstd_rand G; G g; D d(10); @@ -105,7 +103,6 @@ int main() } { typedef std::student_t_distribution<> D; - typedef D::param_type P; typedef std::minstd_rand G; G g; D d(100); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp index 3999cbecc..ecc663c6c 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp @@ -33,7 +33,6 @@ void test1() { typedef std::extreme_value_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(0.5, 2); @@ -75,7 +74,6 @@ void test2() { typedef std::extreme_value_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(1, 2); @@ -117,7 +115,6 @@ void test3() { typedef std::extreme_value_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(1.5, 3); @@ -159,7 +156,6 @@ void test4() { typedef std::extreme_value_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(3, 4); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp index d0ac16298..15d3a289b 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp @@ -33,7 +33,6 @@ int main() { { typedef std::gamma_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(0.5, 2); @@ -73,7 +72,6 @@ int main() } { typedef std::gamma_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(1, .5); @@ -113,7 +111,6 @@ int main() } { typedef std::gamma_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(2, 3); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp index 7da4b9bfb..d97898e5f 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp @@ -44,7 +44,6 @@ void test1() { typedef std::piecewise_linear_distribution<> D; - typedef D::param_type P; typedef std::mt19937_64 G; G g; double b[] = {10, 14, 16, 17}; @@ -97,7 +96,6 @@ void test2() { typedef std::piecewise_linear_distribution<> D; - typedef D::param_type P; typedef std::mt19937_64 G; G g; double b[] = {10, 14, 16, 17}; @@ -150,7 +148,6 @@ void test3() { typedef std::piecewise_linear_distribution<> D; - typedef D::param_type P; typedef std::mt19937_64 G; G g; double b[] = {10, 14, 16, 17}; @@ -203,7 +200,6 @@ void test4() { typedef std::piecewise_linear_distribution<> D; - typedef D::param_type P; typedef std::mt19937_64 G; G g; double b[] = {10, 14, 16}; @@ -257,7 +253,6 @@ void test5() { typedef std::piecewise_linear_distribution<> D; - typedef D::param_type P; typedef std::mt19937_64 G; G g; double b[] = {10, 14}; @@ -312,7 +307,6 @@ void test6() { typedef std::piecewise_linear_distribution<> D; - typedef D::param_type P; typedef std::mt19937_64 G; G g; double b[] = {10, 14, 16, 17}; diff --git a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp index 9f3941b93..6b6220293 100644 --- a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp @@ -22,7 +22,6 @@ int main() { typedef std::chrono::system_clock Clock; typedef Clock::time_point time_point; - typedef Clock::duration duration; std::chrono::milliseconds ms(500); time_point t0 = Clock::now(); std::this_thread::sleep_until(t0 + ms); From d08ba82b09f62a34c5f0b22a4acdba607df8313e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 19 Jul 2017 22:02:33 +0000 Subject: [PATCH 0007/1520] [libcxx] [test] Update msvc_stdlib_force_include.hpp. MSVC's STL is replacing _HAS_FUNCTION_ASSIGN with _HAS_FUNCTION_ALLOCATOR_SUPPORT, and is adding _HAS_UNEXPECTED. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308535 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/support/msvc_stdlib_force_include.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/support/msvc_stdlib_force_include.hpp b/test/support/msvc_stdlib_force_include.hpp index 954cf513e..cd321cdb9 100644 --- a/test/support/msvc_stdlib_force_include.hpp +++ b/test/support/msvc_stdlib_force_include.hpp @@ -70,9 +70,10 @@ const AssertionDialogAvoider assertion_dialog_avoider{}; #define _ENABLE_ATOMIC_ALIGNMENT_FIX // Enable features that /std:c++latest removes by default. - #define _HAS_AUTO_PTR_ETC 1 - #define _HAS_FUNCTION_ASSIGN 1 - #define _HAS_OLD_IOSTREAMS_MEMBERS 1 + #define _HAS_AUTO_PTR_ETC 1 + #define _HAS_FUNCTION_ALLOCATOR_SUPPORT 1 + #define _HAS_OLD_IOSTREAMS_MEMBERS 1 + #define _HAS_UNEXPECTED 1 // Silence warnings about raw pointers and other unchecked iterators. #define _SCL_SECURE_NO_WARNINGS From bfa81b089ca50776e0b503e3e3edac8f0cfc55d6 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sat, 22 Jul 2017 15:16:42 +0000 Subject: [PATCH 0008/1520] Fix grammar-o in comment. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308827 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/__config b/include/__config index b0d065eb1..8d0eeb2c9 100644 --- a/include/__config +++ b/include/__config @@ -55,11 +55,11 @@ #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE -// Fix undefined behavior in how std::list stores it's linked nodes. +// Fix undefined behavior in how std::list stores its linked nodes. #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. #define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB -// Fix undefined behavior in how __hash_table stores it's pointer types +// Fix undefined behavior in how __hash_table stores its pointer types. #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE From 33e24e157eccb1a7ea09a7320a85b96380a25b88 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 24 Jul 2017 14:05:10 +0000 Subject: [PATCH 0009/1520] make sure that we don't call basic_streambuf::gbump with a value bigger than INT_MAX, since it only takes an int. Related to, but not quite the same as PR33725 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308880 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/streambuf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/streambuf b/include/streambuf index a10ce1bf5..f6182d64f 100644 --- a/include/streambuf +++ b/include/streambuf @@ -404,7 +404,8 @@ basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n) { if (__ninp_ < __einp_) { - const streamsize __len = _VSTD::min(__einp_ - __ninp_, __n - __i); + const streamsize __len = _VSTD::min(static_cast(INT_MAX), + _VSTD::min(__einp_ - __ninp_, __n - __i)); traits_type::copy(__s, __ninp_, __len); __s += __len; __i += __len; From 24047fd4a7e8231b2220abc1d20b16bc5de3ee87 Mon Sep 17 00:00:00 2001 From: Rachel Craik Date: Mon, 24 Jul 2017 22:17:05 +0000 Subject: [PATCH 0010/1520] Remove addtional parameters in function std::next() and std::prev() Creating a function pointer with proper parameters pointing to std::next() or std::prev() should work. This change moves the invented paramater for enable_if over to the return type to resolve this QoI issue. Patch by Jason Liu. Differential Revision: https://reviews.llvm.org/D34649 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308932 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/iterator | 22 ++++++++++++------- .../iterator.operations/next.pass.cpp | 3 +++ .../iterator.operations/prev.pass.cpp | 3 +++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/iterator b/include/iterator index d163ab1b0..9e1da937d 100644 --- a/include/iterator +++ b/include/iterator @@ -604,21 +604,27 @@ distance(_InputIter __first, _InputIter __last) template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 -_InputIter +typename enable_if +< + __is_input_iterator<_InputIter>::value, + _InputIter +>::type next(_InputIter __x, - typename iterator_traits<_InputIter>::difference_type __n = 1, - typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0) + typename iterator_traits<_InputIter>::difference_type __n = 1) { _VSTD::advance(__x, __n); return __x; } -template +template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 -_BidiretionalIter -prev(_BidiretionalIter __x, - typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, - typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0) +typename enable_if +< + __is_bidirectional_iterator<_BidirectionalIter>::value, + _BidirectionalIter +>::type +prev(_BidirectionalIter __x, + typename iterator_traits<_BidirectionalIter>::difference_type __n = 1) { _VSTD::advance(__x, -__n); return __x; diff --git a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp index e257b3eaa..1743349a5 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -24,6 +24,9 @@ void test(It i, typename std::iterator_traits::difference_type n, It x) { assert(std::next(i, n) == x); + + It (*next)(It, typename std::iterator_traits::difference_type) = std::next; + assert(next(i, n) == x); } template diff --git a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp index 1eb91881f..554445c18 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -22,6 +22,9 @@ void test(It i, typename std::iterator_traits::difference_type n, It x) { assert(std::prev(i, n) == x); + + It (*prev)(It, typename std::iterator_traits::difference_type) = std::prev; + assert(prev(i, n) == x); } template From f226a28d61c47fb1b0b665f0246848f3be2f99f8 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 27 Jul 2017 17:44:03 +0000 Subject: [PATCH 0011/1520] Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309296 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/mutex | 6 +++--- .../thread.lock/thread.lock.scoped/adopt_lock.pass.cpp | 8 ++++---- .../variant/variant.variant/variant.ctor/copy.pass.cpp | 5 +++++ www/cxx1z_status.html | 6 ++++-- www/cxx2a_status.html | 2 ++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/mutex b/include/mutex index 1557ed877..fbcc0989f 100644 --- a/include/mutex +++ b/include/mutex @@ -116,7 +116,7 @@ public: using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex explicit scoped_lock(MutexTypes&... m); - scoped_lock(MutexTypes&... m, adopt_lock_t); + scoped_lock(adopt_lock_t, MutexTypes&... m); ~scoped_lock(); scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; @@ -500,7 +500,7 @@ public: ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} _LIBCPP_INLINE_VISIBILITY - explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) + explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} scoped_lock(scoped_lock const&) = delete; @@ -522,7 +522,7 @@ public: } _LIBCPP_INLINE_VISIBILITY - scoped_lock(_MArgs&... __margs, adopt_lock_t) + scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) { } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp index 78165383a..d49ba8d11 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp @@ -14,7 +14,7 @@ // template class scoped_lock; -// scoped_lock(Mutex&..., adopt_lock_t); +// scoped_lock(adopt_lock_t, Mutex&...); #include #include @@ -43,7 +43,7 @@ int main() using LG = std::scoped_lock; m1.lock(); { - LG lg(m1, std::adopt_lock); + LG lg(std::adopt_lock, m1); assert(m1.locked); } assert(!m1.locked); @@ -53,7 +53,7 @@ int main() using LG = std::scoped_lock; m1.lock(); m2.lock(); { - LG lg(m1, m2, std::adopt_lock); + LG lg(std::adopt_lock, m1, m2); assert(m1.locked && m2.locked); } assert(!m1.locked && !m2.locked); @@ -63,7 +63,7 @@ int main() using LG = std::scoped_lock; m1.lock(); m2.lock(); m3.lock(); { - LG lg(m1, m2, m3, std::adopt_lock); + LG lg(std::adopt_lock, m1, m2, m3); assert(m1.locked && m2.locked && m3.locked); } assert(!m1.locked && !m2.locked && !m3.locked); diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp index f3113435f..676c8bc26 100644 --- a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp +++ b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp @@ -261,4 +261,9 @@ int main() { test_copy_ctor_valueless_by_exception(); test_copy_ctor_sfinae(); test_constexpr_copy_ctor_extension(); +{ // This is the motivating example from P0739R0 + std::variant v1(3); + std::variant v2 = v1; + (void) v2; +} } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index d9c44fc29..601c6e7d2 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -39,6 +39,8 @@

In February 2017, the C++ standard committee approved this draft, and sent it to ISO for approval as C++17

This page shows the status of libc++; the status of clang's support of the language features is here.

+

Reminder: Features in unreleased drafts of the standard are subject to change.

+

The groups that have contributed papers:

  • LWG - Library working group
  • @@ -163,7 +165,7 @@ P0623R0LWGFinal C++17 Parallel Algorithms FixesKona P0682R1LWGRepairing elementary string conversionsToronto - P0739R0LWGSome improvements to class template argument deduction integration into the standard libraryToronto + P0739R0LWGSome improvements to class template argument deduction integration into the standard libraryTorontoComplete5.0 @@ -497,7 +499,7 @@ -

    Last Updated: 25-May-2017

    +

    Last Updated: 27-Jul-2017

    diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 2c9f878b6..7a17b784a 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -38,6 +38,8 @@

    In July 2017, the C++ standard committee created a draft for the next version of the C++ standard, known here as "C++2a" (probably to be C++20).

    This page shows the status of libc++; the status of clang's support of the language features is here.

    +

    Reminder: Features in unreleased drafts of the standard are subject to change.

    +

    The groups that have contributed papers:

    Last Updated: 29-Jan-2018

    From 37e4c9b159b436605961d2df0a810772128333aa Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 31 Jan 2018 21:42:39 +0000 Subject: [PATCH 0317/1520] Implement LWG2870: Default value of parameter theta of polar should be dependent git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323918 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/complex | 4 ++-- .../numerics/complex.number/complex.value.ops/polar.pass.cpp | 2 +- www/cxx2a_status.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/complex b/include/complex index 41a47cfba..c7c1cdedf 100644 --- a/include/complex +++ b/include/complex @@ -203,7 +203,7 @@ template complex proj(const complex&); template complex proj(T); complex proj(float); -template complex polar(const T&, const T& = 0); +template complex polar(const T&, const T& = T()); // 26.3.8 transcendentals: template complex acos(const complex&); @@ -991,7 +991,7 @@ proj(_Tp __re) template complex<_Tp> -polar(const _Tp& __rho, const _Tp& __theta = _Tp(0)) +polar(const _Tp& __rho, const _Tp& __theta = _Tp()) { if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho)) return complex<_Tp>(_Tp(NAN), _Tp(NAN)); diff --git a/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp b/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp index 5e6cb0d52..69463ded2 100644 --- a/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp +++ b/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp @@ -11,7 +11,7 @@ // template // complex -// polar(const T& rho, const T& theta = 0); +// polar(const T& rho, const T& theta = T()); // changed from '0' by LWG#2870 #include #include diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 68206cb7f..684ed7da2 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -106,7 +106,7 @@ 2779[networking.ts] Relax requirements on buffer sequence iteratorsAlbuquerque - 2870Default value of parameter theta of polar should be dependentAlbuquerque + 2870Default value of parameter theta of polar should be dependentAlbuquerqueComplete 2935What should create_directories do when p already exists but is not a directory?Albuquerque 2941[thread.req.timing] wording should apply to both member and namespace-level functionsAlbuquerqueNothing to do 2944LWG 2905 accidentally removed requirement that construction of the deleter doesn't throw an exceptionAlbuquerqueNothing to do @@ -135,7 +135,7 @@ -

    Last Updated: 24-Jan-2018

    +

    Last Updated: 31-Jan-2018

    From 75075c6be00e97137fd099299efc47496d0ea2b4 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Feb 2018 03:55:27 +0000 Subject: [PATCH 0318/1520] Add static_asserts to basic_ios and basic_stream_buf to ensure that that the traits match the character type. This is a requirement on the user - now we get consistent failures at compile time instead of incomprehensible error messages or runtime failures. This is also LWG#2994 - not yet adopted. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323945 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ios | 3 ++ include/streambuf | 3 ++ .../fstreams/filebuf/traits_mismatch.fail.cpp | 24 +++++++++++++++ .../fstreams/traits_mismatch.fail.cpp | 25 ++++++++++++++++ .../input.streams/traits_mismatch.fail.cpp | 29 +++++++++++++++++++ .../output.streams/traits_mismatch.fail.cpp | 29 +++++++++++++++++++ .../string.streams/traits_mismatch.fail.cpp | 26 +++++++++++++++++ 7 files changed, 139 insertions(+) create mode 100644 test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp create mode 100644 test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp create mode 100644 test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp create mode 100644 test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp create mode 100644 test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp diff --git a/include/ios b/include/ios index 61d00b90e..0bffa571e 100644 --- a/include/ios +++ b/include/ios @@ -592,6 +592,9 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + static_assert((is_same<_CharT, typename traits_type::char_type>::value), + "traits_type::char_type must be the same type as CharT"); + // __true_value will generate undefined references when linking unless // we give it internal linkage. diff --git a/include/streambuf b/include/streambuf index ea64f5780..e409d2106 100644 --- a/include/streambuf +++ b/include/streambuf @@ -132,6 +132,9 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + static_assert((is_same<_CharT, typename traits_type::char_type>::value), + "traits_type::char_type must be the same type as CharT"); + virtual ~basic_streambuf(); // 27.6.2.2.1 locales: diff --git a/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp b/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp new file mode 100644 index 000000000..84045cf3c --- /dev/null +++ b/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template> +// class basic_filebuf; +// +// The char type of the stream and the char_type of the traits have to match + +#include + +int main() +{ + std::basic_filebuf > f; +// expected-error-re@streambuf:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +} + diff --git a/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp b/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp new file mode 100644 index 000000000..dcb7b1f64 --- /dev/null +++ b/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_fstream + +// The char type of the stream and the char_type of the traits have to match + +#include + +int main() +{ + std::basic_fstream > f; +// expected-error-re@ios:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +// expected-error-re@streambuf:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +} + diff --git a/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp b/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp new file mode 100644 index 000000000..a459ec4fb --- /dev/null +++ b/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_istream; + +// The char type of the stream and the char_type of the traits have to match + +#include +#include +#include + +struct test_istream + : public std::basic_istream > {}; + + +int main() +{ +// expected-error-re@ios:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +} + diff --git a/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp b/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp new file mode 100644 index 000000000..fab0dd436 --- /dev/null +++ b/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_ostream; + +// The char type of the stream and the char_type of the traits have to match + +#include +#include +#include + +struct test_ostream + : public std::basic_ostream > {}; + + +int main() +{ +// expected-error-re@ios:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +} + diff --git a/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp b/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp new file mode 100644 index 000000000..f048cae0c --- /dev/null +++ b/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template, +// class Allocator = allocator> +// class basic_stringbuf; +// +// The char type of the stream and the char_type of the traits have to match + +#include + +int main() +{ + std::basic_stringbuf > sb; +// expected-error-re@streambuf:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +// expected-error-re@string:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} +} + From 95db3d2871d5678054d1ba3271f81baf60977c69 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Feb 2018 14:54:25 +0000 Subject: [PATCH 0319/1520] Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323971 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/optional | 913 +----------------- include/module.modulemap | 4 - src/optional.cpp | 6 - test/libcxx/double_include.sh.cpp | 1 - .../experimental/optional/version.pass.cpp | 20 - test/libcxx/min_max_macros.sh.cpp | 2 - .../default.pass.cpp | 29 - .../derive.pass.cpp | 31 - .../optional.comp_with_t/equal.pass.cpp | 53 - .../optional.comp_with_t/greater.pass.cpp | 55 -- .../greater_equal.pass.cpp | 55 -- .../optional.comp_with_t/less_equal.pass.cpp | 55 -- .../optional.comp_with_t/less_than.pass.cpp | 55 -- .../optional.comp_with_t/not_equal.pass.cpp | 53 - .../optional.defs/tested_elsewhere.pass.cpp | 12 - .../optional.general/nothing_to_do.pass.cpp | 12 - .../optional/optional.hash/hash.pass.cpp | 46 - .../optional.inplace/in_place_t.pass.cpp | 36 - .../optional/optional.nullops/equal.pass.cpp | 39 - .../optional.nullops/greater.pass.cpp | 39 - .../optional.nullops/greater_equal.pass.cpp | 39 - .../optional.nullops/less_equal.pass.cpp | 43 - .../optional.nullops/less_than.pass.cpp | 39 - .../optional.nullops/not_equal.pass.cpp | 39 - .../optional.nullopt/nullopt_t.pass.cpp | 38 - .../assign_value.pass.cpp | 80 -- .../optional.object.assign/copy.pass.cpp | 101 -- .../optional.object.assign/emplace.pass.cpp | 153 --- .../emplace_initializer_list.pass.cpp | 126 --- .../optional.object.assign/move.pass.cpp | 114 --- .../optional.object.assign/nullopt_t.pass.cpp | 62 -- .../optional.object.ctor/const_T.pass.cpp | 116 --- .../optional.object.ctor/copy.pass.cpp | 139 --- .../optional.object.ctor/default.pass.cpp | 62 -- .../optional.object.ctor/in_place_t.pass.cpp | 144 --- .../initializer_list.pass.cpp | 118 --- .../optional.object.ctor/move.pass.cpp | 149 --- .../optional.object.ctor/nullopt_t.pass.cpp | 63 -- .../optional.object.ctor/rvalue_T.pass.cpp | 110 --- .../optional.object.dtor/dtor.pass.cpp | 54 -- .../optional.object.observe/bool.pass.cpp | 31 - .../dereference.pass.cpp | 44 - .../dereference_const.pass.cpp | 52 - .../optional.object.observe/op_arrow.pass.cpp | 43 - .../op_arrow_const.pass.cpp | 65 -- .../optional.object.observe/value.pass.cpp | 59 -- .../value_const.fail.cpp | 33 - .../value_const.pass.cpp | 64 -- .../optional.object.observe/value_or.pass.cpp | 66 -- .../value_or_const.pass.cpp | 77 -- .../optional.object.swap/swap.pass.cpp | 313 ------ .../optional_const_void.fail.cpp | 22 - .../optional_not_destructible.fail.cpp | 28 - ...ptional_not_noexcept_destructible.fail.cpp | 27 - .../optional.object/optional_void.fail.cpp | 22 - .../optional/optional.object/types.pass.cpp | 38 - .../optional/optional.relops/equal.pass.cpp | 74 -- .../optional.relops/greater_equal.pass.cpp | 70 -- .../optional.relops/greater_than.pass.cpp | 70 -- .../optional.relops/less_equal.pass.cpp | 70 -- .../optional.relops/less_than.pass.cpp | 70 -- .../optional.relops/not_equal.pass.cpp | 74 -- .../optional.specalg/make_optional.pass.cpp | 51 - .../optional/optional.specalg/swap.pass.cpp | 303 ------ .../optional_const_in_place_t.fail.cpp | 25 - .../optional_const_lvalue_ref.fail.cpp | 23 - .../optional_const_nullopt_t.fail.cpp | 25 - .../optional.syn/optional_in_place_t.fail.cpp | 25 - ...ptional_includes_initializer_list.pass.cpp | 23 - .../optional.syn/optional_lvalue_ref.fail.cpp | 23 - .../optional.syn/optional_nullopt_t.fail.cpp | 25 - .../optional.syn/optional_rvalue_ref.fail.cpp | 23 - 72 files changed, 1 insertion(+), 5262 deletions(-) delete mode 100644 test/libcxx/experimental/optional/version.pass.cpp delete mode 100644 test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp delete mode 100644 test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp delete mode 100644 test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp delete mode 100644 test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp delete mode 100644 test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.defs/tested_elsewhere.pass.cpp delete mode 100644 test/std/experimental/optional/optional.general/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/optional/optional.hash/hash.pass.cpp delete mode 100644 test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullops/equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullops/greater.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullops/less_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullops/less_than.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullops/not_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional_const_void.fail.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp delete mode 100644 test/std/experimental/optional/optional.object/optional_void.fail.cpp delete mode 100644 test/std/experimental/optional/optional.object/types.pass.cpp delete mode 100644 test/std/experimental/optional/optional.relops/equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.relops/greater_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.relops/greater_than.pass.cpp delete mode 100644 test/std/experimental/optional/optional.relops/less_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.relops/less_than.pass.cpp delete mode 100644 test/std/experimental/optional/optional.relops/not_equal.pass.cpp delete mode 100644 test/std/experimental/optional/optional.specalg/make_optional.pass.cpp delete mode 100644 test/std/experimental/optional/optional.specalg/swap.pass.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp delete mode 100644 test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp diff --git a/include/experimental/optional b/include/experimental/optional index b251748fb..d68cefdf6 100644 --- a/include/experimental/optional +++ b/include/experimental/optional @@ -8,915 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL -#define _LIBCPP_EXPERIMENTAL_OPTIONAL - -/* - optional synopsis - -// C++1y - -namespace std { namespace experimental { inline namespace fundamentals_v1 { - - // 5.3, optional for object types - template class optional; - - // 5.4, In-place construction - struct in_place_t{}; - constexpr in_place_t in_place{}; - - // 5.5, No-value state indicator - struct nullopt_t{see below}; - constexpr nullopt_t nullopt(unspecified); - - // 5.6, Class bad_optional_access - class bad_optional_access; - - // 5.7, Relational operators - template - constexpr bool operator==(const optional&, const optional&); - template - constexpr bool operator!=(const optional&, const optional&); - template - constexpr bool operator<(const optional&, const optional&); - template - constexpr bool operator>(const optional&, const optional&); - template - constexpr bool operator<=(const optional&, const optional&); - template - constexpr bool operator>=(const optional&, const optional&); - - // 5.8, Comparison with nullopt - template constexpr bool operator==(const optional&, nullopt_t) noexcept; - template constexpr bool operator==(nullopt_t, const optional&) noexcept; - template constexpr bool operator!=(const optional&, nullopt_t) noexcept; - template constexpr bool operator!=(nullopt_t, const optional&) noexcept; - template constexpr bool operator<(const optional&, nullopt_t) noexcept; - template constexpr bool operator<(nullopt_t, const optional&) noexcept; - template constexpr bool operator<=(const optional&, nullopt_t) noexcept; - template constexpr bool operator<=(nullopt_t, const optional&) noexcept; - template constexpr bool operator>(const optional&, nullopt_t) noexcept; - template constexpr bool operator>(nullopt_t, const optional&) noexcept; - template constexpr bool operator>=(const optional&, nullopt_t) noexcept; - template constexpr bool operator>=(nullopt_t, const optional&) noexcept; - - // 5.9, Comparison with T - template constexpr bool operator==(const optional&, const T&); - template constexpr bool operator==(const T&, const optional&); - template constexpr bool operator!=(const optional&, const T&); - template constexpr bool operator!=(const T&, const optional&); - template constexpr bool operator<(const optional&, const T&); - template constexpr bool operator<(const T&, const optional&); - template constexpr bool operator<=(const optional&, const T&); - template constexpr bool operator<=(const T&, const optional&); - template constexpr bool operator>(const optional&, const T&); - template constexpr bool operator>(const T&, const optional&); - template constexpr bool operator>=(const optional&, const T&); - template constexpr bool operator>=(const T&, const optional&); - - // 5.10, Specialized algorithms - template void swap(optional&, optional&) noexcept(see below); - template constexpr optional make_optional(T&&); - - template - class optional - { - public: - typedef T value_type; - - // 5.3.1, Constructors - constexpr optional() noexcept; - constexpr optional(nullopt_t) noexcept; - optional(const optional&); - optional(optional&&) noexcept(see below); - constexpr optional(const T&); - constexpr optional(T&&); - template constexpr explicit optional(in_place_t, Args&&...); - template - constexpr explicit optional(in_place_t, initializer_list, Args&&...); - - // 5.3.2, Destructor - ~optional(); - - // 5.3.3, Assignment - optional& operator=(nullopt_t) noexcept; - optional& operator=(const optional&); - optional& operator=(optional&&) noexcept(see below); - template optional& operator=(U&&); - template void emplace(Args&&...); - template - void emplace(initializer_list, Args&&...); - - // 5.3.4, Swap - void swap(optional&) noexcept(see below); - - // 5.3.5, Observers - constexpr T const* operator ->() const; - constexpr T* operator ->(); - constexpr T const& operator *() const &; - constexpr T& operator *() &; - constexpr T&& operator *() &&; - constexpr const T&& operator *() const &&; - constexpr explicit operator bool() const noexcept; - constexpr T const& value() const &; - constexpr T& value() &; - constexpr T&& value() &&; - constexpr const T&& value() const &&; - template constexpr T value_or(U&&) const &; - template constexpr T value_or(U&&) &&; - - private: - T* val; // exposition only - }; - - } // namespace fundamentals_v1 - } // namespace experimental - - // 5.11, Hash support - template struct hash; - template struct hash>; - -} // namespace std - -*/ - -#include -#include -#include -#if _LIBCPP_STD_VER > 11 -#include -#include -#include -#include <__functional_base> -#include <__debug> -#endif - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access - : public std::logic_error -{ -public: - bad_optional_access() : std::logic_error("Bad optional Access") {} - -// Get the key function ~bad_optional_access() into the dylib - virtual ~bad_optional_access() _NOEXCEPT; -}; - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL - - -#if _LIBCPP_STD_VER > 11 - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -struct in_place_t {}; -constexpr in_place_t in_place{}; - -struct nullopt_t -{ - explicit constexpr nullopt_t(int) noexcept {} -}; - -constexpr nullopt_t nullopt{0}; - -template ::value> -class __optional_storage -{ -protected: - typedef _Tp value_type; - union - { - char __null_state_; - value_type __val_; - }; - bool __engaged_ = false; - - _LIBCPP_INLINE_VISIBILITY - ~__optional_storage() - { - if (__engaged_) - __val_.~value_type(); - } - - _LIBCPP_INLINE_VISIBILITY - constexpr __optional_storage() noexcept - : __null_state_('\0') {} - - _LIBCPP_INLINE_VISIBILITY - __optional_storage(const __optional_storage& __x) - : __engaged_(__x.__engaged_) - { - if (__engaged_) - ::new((void*)_VSTD::addressof(__val_)) value_type(__x.__val_); - } - - _LIBCPP_INLINE_VISIBILITY - __optional_storage(__optional_storage&& __x) - noexcept(is_nothrow_move_constructible::value) - : __engaged_(__x.__engaged_) - { - if (__engaged_) - ::new((void*)_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_)); - } - - _LIBCPP_INLINE_VISIBILITY - constexpr __optional_storage(const value_type& __v) - : __val_(__v), - __engaged_(true) {} - - _LIBCPP_INLINE_VISIBILITY - constexpr __optional_storage(value_type&& __v) - : __val_(_VSTD::move(__v)), - __engaged_(true) {} - - template - _LIBCPP_INLINE_VISIBILITY - constexpr - explicit __optional_storage(in_place_t, _Args&&... __args) - : __val_(_VSTD::forward<_Args>(__args)...), - __engaged_(true) {} -}; - -template -class __optional_storage<_Tp, true> -{ -protected: - typedef _Tp value_type; - union - { - char __null_state_; - value_type __val_; - }; - bool __engaged_ = false; - - _LIBCPP_INLINE_VISIBILITY - constexpr __optional_storage() noexcept - : __null_state_('\0') {} - - _LIBCPP_INLINE_VISIBILITY - __optional_storage(const __optional_storage& __x) - : __engaged_(__x.__engaged_) - { - if (__engaged_) - ::new((void*)_VSTD::addressof(__val_)) value_type(__x.__val_); - } - - _LIBCPP_INLINE_VISIBILITY - __optional_storage(__optional_storage&& __x) - noexcept(is_nothrow_move_constructible::value) - : __engaged_(__x.__engaged_) - { - if (__engaged_) - ::new((void*)_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_)); - } - - _LIBCPP_INLINE_VISIBILITY - constexpr __optional_storage(const value_type& __v) - : __val_(__v), - __engaged_(true) {} - - _LIBCPP_INLINE_VISIBILITY - constexpr __optional_storage(value_type&& __v) - : __val_(_VSTD::move(__v)), - __engaged_(true) {} - - template - _LIBCPP_INLINE_VISIBILITY - constexpr - explicit __optional_storage(in_place_t, _Args&&... __args) - : __val_(_VSTD::forward<_Args>(__args)...), - __engaged_(true) {} -}; - -template -class optional - : private __optional_storage<_Tp> -{ - typedef __optional_storage<_Tp> __base; -public: - typedef _Tp value_type; - - static_assert(!is_reference::value, - "Instantiation of optional with a reference type is ill-formed."); - static_assert(!is_same::type, in_place_t>::value, - "Instantiation of optional with a in_place_t type is ill-formed."); - static_assert(!is_same::type, nullopt_t>::value, - "Instantiation of optional with a nullopt_t type is ill-formed."); - static_assert(is_object::value, - "Instantiation of optional with a non-object type is undefined behavior."); - static_assert(is_nothrow_destructible::value, - "Instantiation of optional with an object type that is not noexcept destructible is undefined behavior."); - - _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {} - _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default; - _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default; - _LIBCPP_INLINE_VISIBILITY ~optional() = default; - _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {} - _LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v) - : __base(__v) {} - _LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v) - : __base(_VSTD::move(__v)) {} - - template ::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - constexpr - explicit optional(in_place_t, _Args&&... __args) - : __base(in_place, _VSTD::forward<_Args>(__args)...) {} - - template &, _Args...>::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - constexpr - explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args) - : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {} - - _LIBCPP_INLINE_VISIBILITY - optional& operator=(nullopt_t) noexcept - { - if (this->__engaged_) - { - this->__val_.~value_type(); - this->__engaged_ = false; - } - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - optional& - operator=(const optional& __opt) - { - if (this->__engaged_ == __opt.__engaged_) - { - if (this->__engaged_) - this->__val_ = __opt.__val_; - } - else - { - if (this->__engaged_) - this->__val_.~value_type(); - else - ::new((void*)_VSTD::addressof(this->__val_)) value_type(__opt.__val_); - this->__engaged_ = __opt.__engaged_; - } - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - optional& - operator=(optional&& __opt) - noexcept(is_nothrow_move_assignable::value && - is_nothrow_move_constructible::value) - { - if (this->__engaged_ == __opt.__engaged_) - { - if (this->__engaged_) - this->__val_ = _VSTD::move(__opt.__val_); - } - else - { - if (this->__engaged_) - this->__val_.~value_type(); - else - ::new((void*)_VSTD::addressof(this->__val_)) - value_type(_VSTD::move(__opt.__val_)); - this->__engaged_ = __opt.__engaged_; - } - return *this; - } - - template ::type, value_type>::value && - is_constructible::value && - is_assignable::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - optional& - operator=(_Up&& __v) - { - if (this->__engaged_) - this->__val_ = _VSTD::forward<_Up>(__v); - else - { - ::new((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v)); - this->__engaged_ = true; - } - return *this; - } - - template ::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - void - emplace(_Args&&... __args) - { - *this = nullopt; - ::new((void*)_VSTD::addressof(this->__val_)) - value_type(_VSTD::forward<_Args>(__args)...); - this->__engaged_ = true; - } - - template &, _Args...>::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - void - emplace(initializer_list<_Up> __il, _Args&&... __args) - { - *this = nullopt; - ::new((void*)_VSTD::addressof(this->__val_)) - value_type(__il, _VSTD::forward<_Args>(__args)...); - this->__engaged_ = true; - } - - _LIBCPP_INLINE_VISIBILITY - void - swap(optional& __opt) - noexcept(is_nothrow_move_constructible::value && - __is_nothrow_swappable::value) - { - using _VSTD::swap; - if (this->__engaged_ == __opt.__engaged_) - { - if (this->__engaged_) - swap(this->__val_, __opt.__val_); - } - else - { - if (this->__engaged_) - { - ::new((void*)_VSTD::addressof(__opt.__val_)) - value_type(_VSTD::move(this->__val_)); - this->__val_.~value_type(); - } - else - { - ::new((void*)_VSTD::addressof(this->__val_)) - value_type(_VSTD::move(__opt.__val_)); - __opt.__val_.~value_type(); - } - swap(this->__engaged_, __opt.__engaged_); - } - } - - _LIBCPP_INLINE_VISIBILITY - constexpr - value_type const* - operator->() const - { - _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value"); -#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF - return __builtin_addressof(this->__val_); -#else - return __operator_arrow(__has_operator_addressof{}); -#endif - } - - _LIBCPP_INLINE_VISIBILITY - value_type* - operator->() - { - _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value"); - return _VSTD::addressof(this->__val_); - } - - _LIBCPP_INLINE_VISIBILITY - constexpr - const value_type& - operator*() const - { - _LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value"); - return this->__val_; - } - - _LIBCPP_INLINE_VISIBILITY - value_type& - operator*() - { - _LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value"); - return this->__val_; - } - - _LIBCPP_INLINE_VISIBILITY - constexpr explicit operator bool() const noexcept {return this->__engaged_;} - - _LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_NO_EXCEPTIONS -_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS -#endif - constexpr void __throw_bad_optional_access() const - { -#ifndef _LIBCPP_NO_EXCEPTIONS - throw bad_optional_access(); -#else - _VSTD::abort(); -#endif - } - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS - constexpr value_type const& value() const - { - if (!this->__engaged_) - __throw_bad_optional_access(); - return this->__val_; - } - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS - value_type& value() - { - if (!this->__engaged_) - __throw_bad_optional_access(); - return this->__val_; - } - - template - _LIBCPP_INLINE_VISIBILITY - constexpr value_type value_or(_Up&& __v) const& - { - static_assert(is_copy_constructible::value, - "optional::value_or: T must be copy constructible"); - static_assert(is_convertible<_Up, value_type>::value, - "optional::value_or: U must be convertible to T"); - return this->__engaged_ ? this->__val_ : - static_cast(_VSTD::forward<_Up>(__v)); - } - - template - _LIBCPP_INLINE_VISIBILITY - value_type value_or(_Up&& __v) && - { - static_assert(is_move_constructible::value, - "optional::value_or: T must be move constructible"); - static_assert(is_convertible<_Up, value_type>::value, - "optional::value_or: U must be convertible to T"); - return this->__engaged_ ? _VSTD::move(this->__val_) : - static_cast(_VSTD::forward<_Up>(__v)); - } - -private: - _LIBCPP_INLINE_VISIBILITY - value_type const* - __operator_arrow(true_type) const - { - return _VSTD::addressof(this->__val_); - } - - _LIBCPP_INLINE_VISIBILITY - constexpr - value_type const* - __operator_arrow(false_type) const - { - return &this->__val_; - } -}; - -// Comparisons between optionals -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator==(const optional<_Tp>& __x, const optional<_Tp>& __y) -{ - if (static_cast(__x) != static_cast(__y)) - return false; - if (!static_cast(__x)) - return true; - return *__x == *__y; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y) -{ - return !(__x == __y); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<(const optional<_Tp>& __x, const optional<_Tp>& __y) -{ - if (!static_cast(__y)) - return false; - if (!static_cast(__x)) - return true; - return *__x < *__y; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>(const optional<_Tp>& __x, const optional<_Tp>& __y) -{ - return __y < __x; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y) -{ - return !(__y < __x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y) -{ - return !(__x < __y); -} - - -// Comparisons with nullopt -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator==(const optional<_Tp>& __x, nullopt_t) noexcept -{ - return !static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator==(nullopt_t, const optional<_Tp>& __x) noexcept -{ - return !static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator!=(const optional<_Tp>& __x, nullopt_t) noexcept -{ - return static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator!=(nullopt_t, const optional<_Tp>& __x) noexcept -{ - return static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<(const optional<_Tp>&, nullopt_t) noexcept -{ - return false; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<(nullopt_t, const optional<_Tp>& __x) noexcept -{ - return static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<=(const optional<_Tp>& __x, nullopt_t) noexcept -{ - return !static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<=(nullopt_t, const optional<_Tp>&) noexcept -{ - return true; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>(const optional<_Tp>& __x, nullopt_t) noexcept -{ - return static_cast(__x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>(nullopt_t, const optional<_Tp>&) noexcept -{ - return false; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>=(const optional<_Tp>&, nullopt_t) noexcept -{ - return true; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>=(nullopt_t, const optional<_Tp>& __x) noexcept -{ - return !static_cast(__x); -} - -// Comparisons with T -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator==(const optional<_Tp>& __x, const _Tp& __v) -{ - return static_cast(__x) ? *__x == __v : false; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator==(const _Tp& __v, const optional<_Tp>& __x) -{ - return static_cast(__x) ? *__x == __v : false; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator!=(const optional<_Tp>& __x, const _Tp& __v) -{ - return static_cast(__x) ? !(*__x == __v) : true; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator!=(const _Tp& __v, const optional<_Tp>& __x) -{ - return static_cast(__x) ? !(*__x == __v) : true; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<(const optional<_Tp>& __x, const _Tp& __v) -{ - return static_cast(__x) ? less<_Tp>{}(*__x, __v) : true; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<(const _Tp& __v, const optional<_Tp>& __x) -{ - return static_cast(__x) ? less<_Tp>{}(__v, *__x) : false; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<=(const optional<_Tp>& __x, const _Tp& __v) -{ - return !(__x > __v); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator<=(const _Tp& __v, const optional<_Tp>& __x) -{ - return !(__v > __x); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>(const optional<_Tp>& __x, const _Tp& __v) -{ - return static_cast(__x) ? __v < __x : false; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>(const _Tp& __v, const optional<_Tp>& __x) -{ - return static_cast(__x) ? __x < __v : true; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>=(const optional<_Tp>& __x, const _Tp& __v) -{ - return !(__x < __v); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -bool -operator>=(const _Tp& __v, const optional<_Tp>& __x) -{ - return !(__v < __x); -} - - -template -inline _LIBCPP_INLINE_VISIBILITY -void -swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) -{ - __x.swap(__y); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr -optional::type> -make_optional(_Tp&& __v) -{ - return optional::type>(_VSTD::forward<_Tp>(__v)); -} - -_LIBCPP_END_NAMESPACE_LFTS - -_LIBCPP_BEGIN_NAMESPACE_STD - -template -struct _LIBCPP_TEMPLATE_VIS hash > -{ - typedef std::experimental::optional<_Tp> argument_type; - typedef size_t result_type; - - _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type& __opt) const _NOEXCEPT - { - return static_cast(__opt) ? hash<_Tp>()(*__opt) : 0; - } -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_STD_VER > 11 - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL +#error " has been removed. Use instead." diff --git a/include/module.modulemap b/include/module.modulemap index 3194b5c9f..de1d507bf 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -546,10 +546,6 @@ module std [system] { header "experimental/numeric" export * } - module optional { - header "experimental/optional" - export * - } module propagate_const { header "experimental/propagate_const" export * diff --git a/src/optional.cpp b/src/optional.cpp index 2877d175b..6444987bf 100644 --- a/src/optional.cpp +++ b/src/optional.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "optional" -#include "experimental/optional" namespace std { @@ -21,8 +20,3 @@ const char* bad_optional_access::what() const _NOEXCEPT { } // std -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL - -bad_optional_access::~bad_optional_access() _NOEXCEPT = default; - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index 0a9e9fcfa..fe728f778 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -150,7 +150,6 @@ #include #include #include -#include #include #include #include diff --git a/test/libcxx/experimental/optional/version.pass.cpp b/test/libcxx/experimental/optional/version.pass.cpp deleted file mode 100644 index 585b7a24e..000000000 --- a/test/libcxx/experimental/optional/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp index bae4175b1..978ff9080 100644 --- a/test/libcxx/min_max_macros.sh.cpp +++ b/test/libcxx/min_max_macros.sh.cpp @@ -261,8 +261,6 @@ TEST_MACROS(); TEST_MACROS(); #include TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include diff --git a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp deleted file mode 100644 index f26914982..000000000 --- a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - -// - -// class bad_optional_access is default constructible - -#include -#include - -int main() -{ - using std::experimental::bad_optional_access; - bad_optional_access ex; -} diff --git a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp deleted file mode 100644 index a4af713a3..000000000 --- a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability_markup=macosx10.12 -// XFAIL: availability_markup=macosx10.11 -// XFAIL: availability_markup=macosx10.10 -// XFAIL: availability_markup=macosx10.9 -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 - -// - -// class bad_optional_access : public logic_error - -#include -#include - -int main() -{ - using std::experimental::bad_optional_access; - - static_assert(std::is_base_of::value, ""); - static_assert(std::is_convertible::value, ""); -} diff --git a/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp deleted file mode 100644 index 749fa7dcf..000000000 --- a/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator==(const optional& x, const T& v); -// template constexpr bool operator==(const T& v, const optional& x); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator == ( const X &lhs, const X &rhs ) - { return lhs.i_ == rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged - - static_assert ( !(o1 == T(1)), "" ); - static_assert ( (o2 == T(1)), "" ); - static_assert ( !(o3 == T(1)), "" ); - static_assert ( (o3 == T(2)), "" ); - static_assert ( (o3 == val), "" ); - - static_assert ( !(T(1) == o1), "" ); - static_assert ( (T(1) == o2), "" ); - static_assert ( !(T(1) == o3), "" ); - static_assert ( (T(2) == o3), "" ); - static_assert ( (val == o3), "" ); - } -} diff --git a/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp deleted file mode 100644 index c4d95a1c8..000000000 --- a/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator>(const optional& x, const T& v); -// template constexpr bool operator>(const T& v, const optional& x); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged - - static_assert ( !(o1 > T(1)), "" ); - static_assert ( !(o2 > T(1)), "" ); // equal - static_assert ( (o3 > T(1)), "" ); - static_assert ( !(o2 > val), "" ); - static_assert ( !(o3 > val), "" ); // equal - static_assert ( !(o3 > T(3)), "" ); - - static_assert ( (T(1) > o1), "" ); - static_assert ( !(T(1) > o2), "" ); // equal - static_assert ( !(T(1) > o3), "" ); - static_assert ( (val > o2), "" ); - static_assert ( !(val > o3), "" ); // equal - static_assert ( (T(3) > o3), "" ); - } -} diff --git a/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp deleted file mode 100644 index ce1cd9f98..000000000 --- a/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator>=(const optional& x, const T& v); -// template constexpr bool operator>=(const T& v, const optional& x); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged - - static_assert ( !(o1 >= T(1)), "" ); - static_assert ( (o2 >= T(1)), "" ); // equal - static_assert ( (o3 >= T(1)), "" ); - static_assert ( !(o2 >= val), "" ); - static_assert ( (o3 >= val), "" ); // equal - static_assert ( !(o3 >= T(3)), "" ); - - static_assert ( (T(1) >= o1), "" ); - static_assert ( (T(1) >= o2), "" ); // equal - static_assert ( !(T(1) >= o3), "" ); - static_assert ( (val >= o2), "" ); - static_assert ( (val >= o3), "" ); // equal - static_assert ( (T(3) >= o3), "" ); - } -} diff --git a/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp deleted file mode 100644 index c519bde1e..000000000 --- a/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator<=(const optional& x, const T& v); -// template constexpr bool operator<=(const T& v, const optional& x); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged - - static_assert ( (o1 <= T(1)), "" ); - static_assert ( (o2 <= T(1)), "" ); // equal - static_assert ( !(o3 <= T(1)), "" ); - static_assert ( (o2 <= val), "" ); - static_assert ( (o3 <= val), "" ); // equal - static_assert ( (o3 <= T(3)), "" ); - - static_assert ( !(T(1) <= o1), "" ); - static_assert ( (T(1) <= o2), "" ); // equal - static_assert ( (T(1) <= o3), "" ); - static_assert ( !(val <= o2), "" ); - static_assert ( (val <= o3), "" ); // equal - static_assert ( !(T(3) <= o3), "" ); - } -} diff --git a/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp deleted file mode 100644 index ee1e98f2b..000000000 --- a/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator<(const optional& x, const T& v); -// template constexpr bool operator<(const T& v, const optional& x); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged - - static_assert ( (o1 < T(1)), "" ); - static_assert ( !(o2 < T(1)), "" ); // equal - static_assert ( !(o3 < T(1)), "" ); - static_assert ( (o2 < val), "" ); - static_assert ( !(o3 < val), "" ); // equal - static_assert ( (o3 < T(3)), "" ); - - static_assert ( !(T(1) < o1), "" ); - static_assert ( !(T(1) < o2), "" ); // equal - static_assert ( (T(1) < o3), "" ); - static_assert ( !(val < o2), "" ); - static_assert ( !(val < o3), "" ); // equal - static_assert ( !(T(3) < o3), "" ); - } -} diff --git a/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp deleted file mode 100644 index a3daa02d5..000000000 --- a/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator!=(const optional& x, const T& v); -// template constexpr bool operator!=(const T& v, const optional& x); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator == ( const X &lhs, const X &rhs ) - { return lhs.i_ == rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged - - static_assert ( (o1 != T(1)), "" ); - static_assert ( !(o2 != T(1)), "" ); - static_assert ( (o3 != T(1)), "" ); - static_assert ( !(o3 != T(2)), "" ); - static_assert ( !(o3 != val), "" ); - - static_assert ( (T(1) != o1), "" ); - static_assert ( !(T(1) != o2), "" ); - static_assert ( (T(1) != o3), "" ); - static_assert ( !(T(2) != o3), "" ); - static_assert ( !(val != o3), "" ); - } -} diff --git a/test/std/experimental/optional/optional.defs/tested_elsewhere.pass.cpp b/test/std/experimental/optional/optional.defs/tested_elsewhere.pass.cpp deleted file mode 100644 index b58f5c55b..000000000 --- a/test/std/experimental/optional/optional.defs/tested_elsewhere.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/std/experimental/optional/optional.general/nothing_to_do.pass.cpp b/test/std/experimental/optional/optional.general/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b..000000000 --- a/test/std/experimental/optional/optional.general/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/std/experimental/optional/optional.hash/hash.pass.cpp b/test/std/experimental/optional/optional.hash/hash.pass.cpp deleted file mode 100644 index 21126740b..000000000 --- a/test/std/experimental/optional/optional.hash/hash.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template struct hash>; - -#include -#include -#include -#include - - -int main() -{ - using std::experimental::optional; - - { - typedef int T; - optional opt; - assert(std::hash>{}(opt) == 0); - opt = 2; - assert(std::hash>{}(opt) == std::hash{}(*opt)); - } - { - typedef std::string T; - optional opt; - assert(std::hash>{}(opt) == 0); - opt = std::string("123"); - assert(std::hash>{}(opt) == std::hash{}(*opt)); - } - { - typedef std::unique_ptr T; - optional opt; - assert(std::hash>{}(opt) == 0); - opt = std::unique_ptr(new int(3)); - assert(std::hash>{}(opt) == std::hash{}(*opt)); - } -} diff --git a/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp b/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp deleted file mode 100644 index b63977bb6..000000000 --- a/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// struct in_place_t{}; -// constexpr in_place_t in_place{}; - -#include -#include - -using std::experimental::optional; -using std::experimental::in_place_t; -using std::experimental::in_place; - -constexpr -int -test(const in_place_t&) -{ - return 3; -} - -int main() -{ - static_assert((std::is_class::value), ""); - static_assert((std::is_empty::value), ""); - - static_assert(test(in_place) == 3, ""); -} diff --git a/test/std/experimental/optional/optional.nullops/equal.pass.cpp b/test/std/experimental/optional/optional.nullops/equal.pass.cpp deleted file mode 100644 index 79a5a7e06..000000000 --- a/test/std/experimental/optional/optional.nullops/equal.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator==(const optional& x, nullopt_t) noexcept; -// template constexpr bool operator==(nullopt_t, const optional& x) noexcept; - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - { - typedef int T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - - static_assert ( (nullopt == o1), "" ); - static_assert ( !(nullopt == o2), "" ); - static_assert ( (o1 == nullopt), "" ); - static_assert ( !(o2 == nullopt), "" ); - - static_assert (noexcept(nullopt == o1), ""); - static_assert (noexcept(o1 == nullopt), ""); - } -} diff --git a/test/std/experimental/optional/optional.nullops/greater.pass.cpp b/test/std/experimental/optional/optional.nullops/greater.pass.cpp deleted file mode 100644 index 15b22005b..000000000 --- a/test/std/experimental/optional/optional.nullops/greater.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator>(const optional& x, nullopt_t) noexcept; -// template constexpr bool operator>(nullopt_t, const optional& x) noexcept; - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - { - typedef int T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - - static_assert ( !(nullopt > o1), "" ); - static_assert ( !(nullopt > o2), "" ); - static_assert ( !(o1 > nullopt), "" ); - static_assert ( (o2 > nullopt), "" ); - - static_assert (noexcept(nullopt > o1), ""); - static_assert (noexcept(o1 > nullopt), ""); - } -} diff --git a/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp deleted file mode 100644 index 313770ff4..000000000 --- a/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator>=(const optional& x, nullopt_t) noexcept; -// template constexpr bool operator>=(nullopt_t, const optional& x) noexcept; - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - { - typedef int T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - - static_assert ( (nullopt >= o1), "" ); - static_assert ( !(nullopt >= o2), "" ); - static_assert ( (o1 >= nullopt), "" ); - static_assert ( (o2 >= nullopt), "" ); - - static_assert (noexcept(nullopt >= o1), ""); - static_assert (noexcept(o1 >= nullopt), ""); - } -} diff --git a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp deleted file mode 100644 index ac7be156c..000000000 --- a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// template constexpr bool operator<=(const optional& x, nullopt_t) noexcept; -// template constexpr bool operator<=(nullopt_t, const optional& x) noexcept; - -#include - -#include "test_macros.h" - -int main() -{ -#if TEST_STD_VER > 11 - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - { - typedef int T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - - static_assert ( (nullopt <= o1), "" ); - static_assert ( (nullopt <= o2), "" ); - static_assert ( (o1 <= nullopt), "" ); - static_assert ( !(o2 <= nullopt), "" ); - - static_assert (noexcept(nullopt <= o1), ""); - static_assert (noexcept(o1 <= nullopt), ""); - } -#endif -} diff --git a/test/std/experimental/optional/optional.nullops/less_than.pass.cpp b/test/std/experimental/optional/optional.nullops/less_than.pass.cpp deleted file mode 100644 index fdb400700..000000000 --- a/test/std/experimental/optional/optional.nullops/less_than.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator<(const optional& x, nullopt_t) noexcept; -// template constexpr bool operator<(nullopt_t, const optional& x) noexcept; - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - { - typedef int T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - - static_assert ( !(nullopt < o1), "" ); - static_assert ( (nullopt < o2), "" ); - static_assert ( !(o1 < nullopt), "" ); - static_assert ( !(o2 < nullopt), "" ); - - static_assert (noexcept(nullopt < o1), ""); - static_assert (noexcept(o1 < nullopt), ""); - } -} diff --git a/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp deleted file mode 100644 index 70ae0f1d8..000000000 --- a/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator!=(const optional& x, nullopt_t) noexcept; -// template constexpr bool operator!=(nullopt_t, const optional& x) noexcept; - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - { - typedef int T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - - static_assert ( !(nullopt != o1), "" ); - static_assert ( (nullopt != o2), "" ); - static_assert ( !(o1 != nullopt), "" ); - static_assert ( (o2 != nullopt), "" ); - - static_assert (noexcept(nullopt != o1), ""); - static_assert (noexcept(o1 != nullopt), ""); - } -} diff --git a/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp deleted file mode 100644 index 8ad49c748..000000000 --- a/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// struct nullopt_t{see below}; -// constexpr nullopt_t nullopt(unspecified); - -#include -#include - -using std::experimental::optional; -using std::experimental::nullopt_t; -using std::experimental::nullopt; - -constexpr -int -test(const nullopt_t&) -{ - return 3; -} - -int main() -{ - static_assert((std::is_class::value), ""); - static_assert((std::is_empty::value), ""); - static_assert((std::is_literal_type::value), ""); - static_assert((!std::is_default_constructible::value), ""); - - static_assert(test(nullopt) == 3, ""); -} diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp deleted file mode 100644 index 0215417ce..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template optional& operator=(U&& v); - -#include -#include -#include -#include - -using std::experimental::optional; - -struct AllowConstAssign { - AllowConstAssign() {} - AllowConstAssign(AllowConstAssign const&) {} - AllowConstAssign const& operator=(AllowConstAssign const&) const { - return *this; - } -}; - -struct X -{ -}; - -int main() -{ - static_assert(std::is_assignable, int>::value, ""); - static_assert(std::is_assignable, int&>::value, ""); - static_assert(std::is_assignable&, int>::value, ""); - static_assert(std::is_assignable&, int&>::value, ""); - static_assert(std::is_assignable&, const int&>::value, ""); - static_assert(!std::is_assignable&, const int&>::value, ""); - static_assert(!std::is_assignable, X>::value, ""); - { - optional opt; - opt = 1; - assert(static_cast(opt) == true); - assert(*opt == 1); - } - { - optional opt; - const int i = 2; - opt = i; - assert(static_cast(opt) == true); - assert(*opt == i); - } - { - optional opt(3); - const int i = 2; - opt = i; - assert(static_cast(opt) == true); - assert(*opt == i); - } - { - optional opt; - const AllowConstAssign other; - opt = other; - } - { - optional> opt; - opt = std::unique_ptr(new int(3)); - assert(static_cast(opt) == true); - assert(**opt == 3); - } - { - optional> opt(std::unique_ptr(new int(2))); - opt = std::unique_ptr(new int(3)); - assert(static_cast(opt) == true); - assert(**opt == 3); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp deleted file mode 100644 index 17ee97545..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// optional& operator=(const optional& rhs); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -struct AllowConstAssign { - AllowConstAssign(AllowConstAssign const&) {} - AllowConstAssign const& operator=(AllowConstAssign const&) const { - return *this; - } -}; - -struct X -{ - static bool throw_now; - - X() = default; - X(const X&) - { - if (throw_now) - TEST_THROW(6); - } -}; - -bool X::throw_now = false; - -int main() -{ - { - optional opt; - constexpr optional opt2; - opt = opt2; - static_assert(static_cast(opt2) == false, ""); - assert(static_cast(opt) == static_cast(opt2)); - } - { - optional opt; - optional opt2; - opt = opt2; - } - { - optional opt; - constexpr optional opt2(2); - opt = opt2; - static_assert(static_cast(opt2) == true, ""); - static_assert(*opt2 == 2, ""); - assert(static_cast(opt) == static_cast(opt2)); - assert(*opt == *opt2); - } - { - optional opt(3); - constexpr optional opt2; - opt = opt2; - static_assert(static_cast(opt2) == false, ""); - assert(static_cast(opt) == static_cast(opt2)); - } - { - optional opt(3); - constexpr optional opt2(2); - opt = opt2; - static_assert(static_cast(opt2) == true, ""); - static_assert(*opt2 == 2, ""); - assert(static_cast(opt) == static_cast(opt2)); - assert(*opt == *opt2); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - optional opt; - optional opt2(X{}); - assert(static_cast(opt2) == true); - try - { - X::throw_now = true; - opt = opt2; - assert(false); - } - catch (int i) - { - assert(i == 6); - assert(static_cast(opt) == false); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp deleted file mode 100644 index 256396094..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ /dev/null @@ -1,153 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template void optional::emplace(Args&&... args); - -#include -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -class X -{ - int i_; - int j_ = 0; -public: - X() : i_(0) {} - X(int i) : i_(i) {} - X(int i, int j) : i_(i), j_(j) {} - - friend bool operator==(const X& x, const X& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -class Y -{ -public: - static bool dtor_called; - Y() = default; - ~Y() {dtor_called = true;} -}; - -bool Y::dtor_called = false; - -class Z -{ -public: - static bool dtor_called; - Z() = default; - Z(int) {TEST_THROW(6);} - ~Z() {dtor_called = true;} -}; - -bool Z::dtor_called = false; - -int main() -{ - { - optional opt; - opt.emplace(); - assert(static_cast(opt) == true); - assert(*opt == 0); - } - { - optional opt; - opt.emplace(1); - assert(static_cast(opt) == true); - assert(*opt == 1); - } - { - optional opt(2); - opt.emplace(); - assert(static_cast(opt) == true); - assert(*opt == 0); - } - { - optional opt(2); - opt.emplace(1); - assert(static_cast(opt) == true); - assert(*opt == 1); - } - { - optional opt(2); - opt.emplace(1); - assert(static_cast(opt) == true); - assert(*opt == 1); - } - { - optional opt; - opt.emplace(); - assert(static_cast(opt) == true); - assert(*opt == X()); - } - { - optional opt; - opt.emplace(1); - assert(static_cast(opt) == true); - assert(*opt == X(1)); - } - { - optional opt; - opt.emplace(1, 2); - assert(static_cast(opt) == true); - assert(*opt == X(1, 2)); - } - { - optional opt(X{3}); - opt.emplace(); - assert(static_cast(opt) == true); - assert(*opt == X()); - } - { - optional opt(X{3}); - opt.emplace(1); - assert(static_cast(opt) == true); - assert(*opt == X(1)); - } - { - optional opt(X{3}); - opt.emplace(1, 2); - assert(static_cast(opt) == true); - assert(*opt == X(1, 2)); - } - { - Y y; - { - optional opt(y); - assert(Y::dtor_called == false); - opt.emplace(); - assert(Y::dtor_called == true); - } - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - Z z; - optional opt(z); - try - { - assert(static_cast(opt) == true); - assert(Z::dtor_called == false); - opt.emplace(1); - } - catch (int i) - { - assert(i == 6); - assert(static_cast(opt) == false); - assert(Z::dtor_called == true); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp deleted file mode 100644 index 8a265808a..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// void optional::emplace(initializer_list il, Args&&... args); - -#include -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -class X -{ - int i_; - int j_ = 0; -public: - static bool dtor_called; - constexpr X() : i_(0) {} - constexpr X(int i) : i_(i) {} - constexpr X(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) {} - ~X() {dtor_called = true;} - - friend constexpr bool operator==(const X& x, const X& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -bool X::dtor_called = false; - -class Y -{ - int i_; - int j_ = 0; -public: - constexpr Y() : i_(0) {} - constexpr Y(int i) : i_(i) {} - constexpr Y(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) {} - - friend constexpr bool operator==(const Y& x, const Y& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -class Z -{ - int i_; - int j_ = 0; -public: - static bool dtor_called; - constexpr Z() : i_(0) {} - constexpr Z(int i) : i_(i) {} - Z(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) - {TEST_THROW(6);} - ~Z() {dtor_called = true;} - - friend constexpr bool operator==(const Z& x, const Z& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -bool Z::dtor_called = false; - -int main() -{ - { - X x; - { - optional opt(x); - assert(X::dtor_called == false); - opt.emplace({1, 2}); - assert(X::dtor_called == true); - assert(*opt == X({1, 2})); - } - } - X::dtor_called = false; - { - X x; - { - optional opt(x); - assert(X::dtor_called == false); - opt.emplace({1, 2}); - assert(X::dtor_called == true); - assert(*opt == X({1, 2})); - } - } - { - optional> opt; - opt.emplace({1, 2, 3}, std::allocator()); - assert(static_cast(opt) == true); - assert(*opt == std::vector({1, 2, 3})); - } - { - optional opt; - opt.emplace({1, 2}); - assert(static_cast(opt) == true); - assert(*opt == Y({1, 2})); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - Z z; - optional opt(z); - try - { - assert(static_cast(opt) == true); - assert(Z::dtor_called == false); - opt.emplace({1, 2}); - } - catch (int i) - { - assert(i == 6); - assert(static_cast(opt) == false); - assert(Z::dtor_called == true); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp deleted file mode 100644 index 4e2aca978..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// optional& operator=(optional&& rhs) -// noexcept(is_nothrow_move_assignable::value && -// is_nothrow_move_constructible::value); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -struct AllowConstAssign { - AllowConstAssign(AllowConstAssign const&) {} - AllowConstAssign const& operator=(AllowConstAssign const&) const { - return *this; - } -}; - -struct X -{ - static bool throw_now; - - X() = default; - X(X&&) - { - if (throw_now) - TEST_THROW(6); - } - X& operator=(X&&) noexcept - { - return *this; - } -}; - -bool X::throw_now = false; - -struct Y {}; - -int main() -{ - { - static_assert(std::is_nothrow_move_assignable>::value, ""); - optional opt; - constexpr optional opt2; - opt = std::move(opt2); - static_assert(static_cast(opt2) == false, ""); - assert(static_cast(opt) == static_cast(opt2)); - } - { - optional opt; - constexpr optional opt2(2); - opt = std::move(opt2); - static_assert(static_cast(opt2) == true, ""); - static_assert(*opt2 == 2, ""); - assert(static_cast(opt) == static_cast(opt2)); - assert(*opt == *opt2); - } - { - optional opt(3); - constexpr optional opt2; - opt = std::move(opt2); - static_assert(static_cast(opt2) == false, ""); - assert(static_cast(opt) == static_cast(opt2)); - } - { - optional opt(3); - constexpr optional opt2(2); - opt = std::move(opt2); - static_assert(static_cast(opt2) == true, ""); - static_assert(*opt2 == 2, ""); - assert(static_cast(opt) == static_cast(opt2)); - assert(*opt == *opt2); - } - { - optional opt; - optional opt2; - opt = std::move(opt2); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - static_assert(!std::is_nothrow_move_assignable>::value, ""); - optional opt; - optional opt2(X{}); - assert(static_cast(opt2) == true); - try - { - X::throw_now = true; - opt = std::move(opt2); - assert(false); - } - catch (int i) - { - assert(i == 6); - assert(static_cast(opt) == false); - } - } -#endif - { - static_assert(std::is_nothrow_move_assignable>::value, ""); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp deleted file mode 100644 index b1d851b32..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// optional& operator=(nullopt_t) noexcept; - -#include -#include -#include - -using std::experimental::optional; -using std::experimental::nullopt_t; -using std::experimental::nullopt; - -struct X -{ - static bool dtor_called; - ~X() {dtor_called = true;} -}; - -bool X::dtor_called = false; - -int main() -{ - { - optional opt; - static_assert(noexcept(opt = nullopt) == true, ""); - opt = nullopt; - assert(static_cast(opt) == false); - } - { - optional opt(3); - opt = nullopt; - assert(static_cast(opt) == false); - } - { - optional opt; - static_assert(noexcept(opt = nullopt) == true, ""); - assert(X::dtor_called == false); - opt = nullopt; - assert(X::dtor_called == false); - assert(static_cast(opt) == false); - } - { - X x; - { - optional opt(x); - assert(X::dtor_called == false); - opt = nullopt; - assert(X::dtor_called == true); - assert(static_cast(opt) == false); - } - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp deleted file mode 100644 index 6371dcb4e..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp +++ /dev/null @@ -1,116 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// constexpr optional(const T& v); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -class X -{ - int i_; -public: - X(int i) : i_(i) {} - - friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} -}; - -class Y -{ - int i_; -public: - constexpr Y(int i) : i_(i) {} - - friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;} -}; - -class Z -{ -public: - Z(int) {} - Z(const Z&) {TEST_THROW(6);} -}; - - -int main() -{ - { - typedef int T; - constexpr T t(5); - constexpr optional opt(t); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 5, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(const T&) {} - }; - - } - { - typedef double T; - constexpr T t(3); - constexpr optional opt(t); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 3, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(const T&) {} - }; - - } - { - typedef X T; - const T t(3); - optional opt(t); - assert(static_cast(opt) == true); - assert(*opt == 3); - } - { - typedef Y T; - constexpr T t(3); - constexpr optional opt(t); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 3, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(const T&) {} - }; - - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - typedef Z T; - try - { - const T t(3); - optional opt(t); - assert(false); - } - catch (int i) - { - assert(i == 6); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp deleted file mode 100644 index 4b66fe80b..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp +++ /dev/null @@ -1,139 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// optional(const optional& rhs); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -template -void -test(const optional& rhs, bool is_going_to_throw = false) -{ - bool rhs_engaged = static_cast(rhs); -#ifdef TEST_HAS_NO_EXCEPTIONS - if (is_going_to_throw) - return; -#else - try -#endif - { - optional lhs = rhs; - assert(is_going_to_throw == false); - assert(static_cast(lhs) == rhs_engaged); - if (rhs_engaged) - assert(*lhs == *rhs); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - catch (int i) - { - assert(i == 6); - assert(is_going_to_throw); - } -#endif -} - -class X -{ - int i_; -public: - X(int i) : i_(i) {} - X(const X& x) : i_(x.i_) {} - ~X() {i_ = 0;} - friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} -}; - -class Y -{ - int i_; -public: - Y(int i) : i_(i) {} - Y(const Y& x) : i_(x.i_) {} - - friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;} -}; - -int count = 0; - -class Z -{ - int i_; -public: - Z(int i) : i_(i) {} - Z(const Z&) - { - if (++count == 2) - TEST_THROW(6); - } - - friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} -}; - - -int main() -{ - { - typedef int T; - optional rhs; - test(rhs); - } - { - typedef int T; - optional rhs(3); - test(rhs); - } - { - typedef const int T; - optional rhs(3); - test(rhs); - } - { - typedef X T; - optional rhs; - test(rhs); - } - { - typedef X T; - optional rhs(X(3)); - test(rhs); - } - { - typedef const X T; - optional rhs(X(3)); - test(rhs); - } - { - typedef Y T; - optional rhs; - test(rhs); - } - { - typedef Y T; - optional rhs(Y(3)); - test(rhs); - } - { - typedef Z T; - optional rhs; - test(rhs); - } - { - typedef Z T; - optional rhs(Z(3)); - test(rhs, true); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp deleted file mode 100644 index d24a1ac69..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr optional() noexcept; - -#include -#include -#include - -using std::experimental::optional; - -template -void -test_constexpr() -{ - static_assert(std::is_nothrow_default_constructible::value, ""); - constexpr Opt opt; - static_assert(static_cast(opt) == false, ""); - - struct test_constexpr_ctor - : public Opt - { - constexpr test_constexpr_ctor() {} - }; - -} - -template -void -test() -{ - static_assert(std::is_nothrow_default_constructible::value, ""); - Opt opt; - assert(static_cast(opt) == false); - - struct test_constexpr_ctor - : public Opt - { - constexpr test_constexpr_ctor() {} - }; -} - -struct X -{ - X(); -}; - -int main() -{ - test_constexpr>(); - test_constexpr>(); - test>(); -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp deleted file mode 100644 index c46407896..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp +++ /dev/null @@ -1,144 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// constexpr explicit optional(in_place_t, Args&&... args); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; -using std::experimental::in_place_t; -using std::experimental::in_place; - -class X -{ - int i_; - int j_ = 0; -public: - X() : i_(0) {} - X(int i) : i_(i) {} - X(int i, int j) : i_(i), j_(j) {} - - ~X() {} - - friend bool operator==(const X& x, const X& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -class Y -{ - int i_; - int j_ = 0; -public: - constexpr Y() : i_(0) {} - constexpr Y(int i) : i_(i) {} - constexpr Y(int i, int j) : i_(i), j_(j) {} - - friend constexpr bool operator==(const Y& x, const Y& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -class Z -{ -public: - Z(int) {TEST_THROW(6);} -}; - - -int main() -{ - { - constexpr optional opt(in_place, 5); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 5, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(in_place_t, int i) - : optional(in_place, i) {} - }; - - } - { - const optional opt(in_place); - assert(static_cast(opt) == true); - assert(*opt == X()); - } - { - const optional opt(in_place, 5); - assert(static_cast(opt) == true); - assert(*opt == X(5)); - } - { - const optional opt(in_place, 5, 4); - assert(static_cast(opt) == true); - assert(*opt == X(5, 4)); - } - { - constexpr optional opt(in_place); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == Y(), ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(in_place_t) - : optional(in_place) {} - }; - - } - { - constexpr optional opt(in_place, 5); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == Y(5), ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(in_place_t, int i) - : optional(in_place, i) {} - }; - - } - { - constexpr optional opt(in_place, 5, 4); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == Y(5, 4), ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(in_place_t, int i, int j) - : optional(in_place, i, j) {} - }; - - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - try - { - const optional opt(in_place, 1); - assert(false); - } - catch (int i) - { - assert(i == 6); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp deleted file mode 100644 index b75c147df..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr -// explicit optional(in_place_t, initializer_list il, Args&&... args); - -#include -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; -using std::experimental::in_place_t; -using std::experimental::in_place; - -class X -{ - int i_; - int j_ = 0; -public: - X() : i_(0) {} - X(int i) : i_(i) {} - X(int i, int j) : i_(i), j_(j) {} - - ~X() {} - - friend bool operator==(const X& x, const X& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -class Y -{ - int i_; - int j_ = 0; -public: - constexpr Y() : i_(0) {} - constexpr Y(int i) : i_(i) {} - constexpr Y(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) {} - - friend constexpr bool operator==(const Y& x, const Y& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -class Z -{ - int i_; - int j_ = 0; -public: - constexpr Z() : i_(0) {} - constexpr Z(int i) : i_(i) {} - Z(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) - {TEST_THROW(6);} - - friend constexpr bool operator==(const Z& x, const Z& y) - {return x.i_ == y.i_ && x.j_ == y.j_;} -}; - -int main() -{ - { - static_assert(!std::is_constructible&>::value, ""); - static_assert(!std::is_constructible, std::initializer_list&>::value, ""); - } - { - optional> opt(in_place, {3, 1}); - assert(static_cast(opt) == true); - assert((*opt == std::vector{3, 1})); - assert(opt->size() == 2); - } - { - optional> opt(in_place, {3, 1}, std::allocator()); - assert(static_cast(opt) == true); - assert((*opt == std::vector{3, 1})); - assert(opt->size() == 2); - } - { - static_assert(std::is_constructible, std::initializer_list&>::value, ""); - constexpr optional opt(in_place, {3, 1}); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == Y{3, 1}, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(in_place_t, std::initializer_list i) - : optional(in_place, i) {} - }; - - constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1}); - static_assert(*dopt == Y{42, 101, -1}, ""); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - static_assert(std::is_constructible, std::initializer_list&>::value, ""); - try - { - optional opt(in_place, {3, 1}); - assert(false); - } - catch (int i) - { - assert(i == 6); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp deleted file mode 100644 index a8bb6e9c2..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp +++ /dev/null @@ -1,149 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// optional(optional&& rhs) noexcept(is_nothrow_move_constructible::value); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -template -void -test(optional& rhs, bool is_going_to_throw = false) -{ - static_assert(std::is_nothrow_move_constructible>::value == - std::is_nothrow_move_constructible::value, ""); - bool rhs_engaged = static_cast(rhs); -#ifdef TEST_HAS_NO_EXCEPTIONS - if (is_going_to_throw) - return; -#else - try -#endif - { - optional lhs = std::move(rhs); - assert(is_going_to_throw == false); - assert(static_cast(lhs) == rhs_engaged); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - catch (int i) - { - assert(i == 6); - assert(is_going_to_throw); - } -#endif -} - -class X -{ - int i_; -public: - X(int i) : i_(i) {} - X(X&& x) : i_(x.i_) {x.i_ = 0;} - ~X() {i_ = 0;} - friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} -}; - -class Y -{ - int i_; -public: - Y(int i) : i_(i) {} - Y(Y&& x) noexcept : i_(x.i_) {x.i_ = 0;} - - friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;} -}; - -int count = 0; - -class Z -{ - int i_; -public: - Z(int i) : i_(i) {} - Z(Z&&) - { - if (++count == 2) - TEST_THROW(6); - } - - friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} -}; - - -class ConstMovable -{ - int i_; -public: - ConstMovable(int i) : i_(i) {} - ConstMovable(const ConstMovable&& x) : i_(x.i_) {} - ~ConstMovable() {i_ = 0;} - friend bool operator==(const ConstMovable& x, const ConstMovable& y) {return x.i_ == y.i_;} -}; - -int main() -{ - { - typedef int T; - optional rhs; - test(rhs); - } - { - typedef int T; - optional rhs(3); - test(rhs); - } - { - typedef const int T; - optional rhs(3); - test(rhs); - } - { - typedef X T; - optional rhs; - test(rhs); - } - { - typedef X T; - optional rhs(X(3)); - test(rhs); - } - { - typedef const ConstMovable T; - optional rhs(ConstMovable(3)); - test(rhs); - } - { - typedef Y T; - optional rhs; - test(rhs); - } - { - typedef Y T; - optional rhs(Y(3)); - test(rhs); - } - { - typedef Z T; - optional rhs; - test(rhs); - } - { - typedef Z T; - optional rhs(Z(3)); - test(rhs, true); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp deleted file mode 100644 index 40c96581e..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr optional(nullopt_t) noexcept; - -#include -#include -#include - -using std::experimental::optional; -using std::experimental::nullopt_t; -using std::experimental::nullopt; - -template -void -test_constexpr() -{ - static_assert(noexcept(Opt(nullopt)), ""); - constexpr Opt opt(nullopt); - static_assert(static_cast(opt) == false, ""); - - struct test_constexpr_ctor - : public Opt - { - constexpr test_constexpr_ctor() {} - }; -} - -template -void -test() -{ - static_assert(noexcept(Opt(nullopt)), ""); - Opt opt(nullopt); - assert(static_cast(opt) == false); - - struct test_constexpr_ctor - : public Opt - { - constexpr test_constexpr_ctor() {} - }; -} - -struct X -{ - X(); -}; - -int main() -{ - test_constexpr>(); - test_constexpr>(); - test>(); -} diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp deleted file mode 100644 index 1941546a5..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp +++ /dev/null @@ -1,110 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// constexpr optional(T&& v); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -class X -{ - int i_; -public: - X(int i) : i_(i) {} - X(X&& x) : i_(x.i_) {} - - friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} -}; - -class Y -{ - int i_; -public: - constexpr Y(int i) : i_(i) {} - constexpr Y(Y&& x) : i_(x.i_) {} - - friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;} -}; - -class Z -{ -public: - Z(int) {} - Z(Z&&) {TEST_THROW(6);} -}; - - -int main() -{ - { - typedef int T; - constexpr optional opt(T(5)); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 5, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(T&&) {} - }; - } - { - typedef double T; - constexpr optional opt(T(3)); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 3, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(T&&) {} - }; - } - { - typedef X T; - optional opt(T(3)); - assert(static_cast(opt) == true); - assert(*opt == 3); - } - { - typedef Y T; - constexpr optional opt(T(3)); - static_assert(static_cast(opt) == true, ""); - static_assert(*opt == 3, ""); - - struct test_constexpr_ctor - : public optional - { - constexpr test_constexpr_ctor(T&&) {} - }; - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - typedef Z T; - try - { - optional opt(T(3)); - assert(false); - } - catch (int i) - { - assert(i == 6); - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp deleted file mode 100644 index 2bec19e6b..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// ~optional(); - -#include -#include -#include - -using std::experimental::optional; - -class X -{ -public: - static bool dtor_called; - X() = default; - ~X() {dtor_called = true;} -}; - -bool X::dtor_called = false; - -int main() -{ - { - typedef int T; - static_assert(std::is_trivially_destructible::value, ""); - static_assert(std::is_trivially_destructible>::value, ""); - } - { - typedef double T; - static_assert(std::is_trivially_destructible::value, ""); - static_assert(std::is_trivially_destructible>::value, ""); - } - { - typedef X T; - static_assert(!std::is_trivially_destructible::value, ""); - static_assert(!std::is_trivially_destructible>::value, ""); - { - X x; - optional opt{x}; - assert(X::dtor_called == false); - } - assert(X::dtor_called == true); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp deleted file mode 100644 index a5bfae240..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr explicit optional::operator bool() const noexcept; - -#include -#include -#include - -int main() -{ - using std::experimental::optional; - - { - constexpr optional opt; - static_assert(!opt, ""); - } - { - constexpr optional opt(0); - static_assert(opt, ""); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp deleted file mode 100644 index faba8d256..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// T& optional::operator*(); - -#ifdef _LIBCPP_DEBUG -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - constexpr int test() const {return 3;} - int test() {return 4;} -}; - -int main() -{ - { - optional opt(X{}); - assert((*opt).test() == 4); - } -#ifdef _LIBCPP_DEBUG - { - optional opt; - assert((*opt).test() == 3); - assert(false); - } -#endif // _LIBCPP_DEBUG -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp deleted file mode 100644 index f1bdc3642..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr const T& optional::operator*() const; - -#ifdef _LIBCPP_DEBUG -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - constexpr int test() const {return 3;} -}; - -struct Y -{ - int test() const {return 2;} -}; - -int main() -{ - { - constexpr optional opt(X{}); - static_assert((*opt).test() == 3, ""); - } - { - constexpr optional opt(Y{}); - assert((*opt).test() == 2); - } -#ifdef _LIBCPP_DEBUG - { - const optional opt; - assert((*opt).test() == 3); - assert(false); - } -#endif // _LIBCPP_DEBUG -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp deleted file mode 100644 index 954ccd71f..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr T* optional::operator->(); - -#ifdef _LIBCPP_DEBUG -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - constexpr int test() const {return 3;} -}; - -int main() -{ - { - constexpr optional opt(X{}); - static_assert(opt->test() == 3, ""); - } -#ifdef _LIBCPP_DEBUG - { - optional opt; - assert(opt->test() == 3); - assert(false); - } -#endif // _LIBCPP_DEBUG -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp deleted file mode 100644 index 46586c65a..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr const T* optional::operator->() const; - -#ifdef _LIBCPP_DEBUG -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - constexpr int test() const {return 3;} -}; - -struct Y -{ - int test() const {return 2;} -}; - -struct Z -{ - const Z* operator&() const {return this;} - constexpr int test() const {return 1;} -}; - -int main() -{ - { - constexpr optional opt(X{}); - static_assert(opt->test() == 3, ""); - } - { - constexpr optional opt(Y{}); - assert(opt->test() == 2); - } - { - constexpr optional opt(Z{}); - assert(opt->test() == 1); -#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF - static_assert(opt->test() == 1, ""); -#endif - } -#ifdef _LIBCPP_DEBUG - { - const optional opt; - assert(opt->test() == 3); - assert(false); - } -#endif // _LIBCPP_DEBUG -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp deleted file mode 100644 index 72d779059..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - -// - -// T& optional::value(); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; -using std::experimental::bad_optional_access; - -struct X -{ - X() = default; - X(const X&) = delete; - constexpr int test() const {return 3;} - int test() {return 4;} -}; - -int main() -{ - { - optional opt; - opt.emplace(); - assert(opt.value().test() == 4); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - optional opt; - try - { - opt.value(); - assert(false); - } - catch (const bad_optional_access&) - { - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp deleted file mode 100644 index baad3b47f..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// constexpr const T& optional::value() const; - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - constexpr int test() const {return 3;} - int test() {return 4;} -}; - -int main() -{ - { - constexpr optional opt; - static_assert(opt.value().test() == 3, ""); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp deleted file mode 100644 index b3d6dfda4..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - -// - -// constexpr const T& optional::value() const; - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; -using std::experimental::in_place_t; -using std::experimental::in_place; -using std::experimental::bad_optional_access; - -struct X -{ - X() = default; - X(const X&) = delete; - constexpr int test() const {return 3;} - int test() {return 4;} -}; - -int main() -{ - { - constexpr optional opt(in_place); - static_assert(opt.value().test() == 3, ""); - } - { - const optional opt(in_place); - assert(opt.value().test() == 3); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - const optional opt; - try - { - opt.value(); - assert(false); - } - catch (const bad_optional_access&) - { - } - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp deleted file mode 100644 index 6fca8c82c..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template T optional::value_or(U&& v) &&; - -#include -#include -#include - -using std::experimental::optional; -using std::experimental::in_place_t; -using std::experimental::in_place; - -struct Y -{ - int i_; - - Y(int i) : i_(i) {} -}; - -struct X -{ - int i_; - - X(int i) : i_(i) {} - X(X&& x) : i_(x.i_) {x.i_ = 0;} - X(const Y& y) : i_(y.i_) {} - X(Y&& y) : i_(y.i_+1) {} - friend constexpr bool operator==(const X& x, const X& y) - {return x.i_ == y.i_;} -}; - -int main() -{ - { - optional opt(in_place, 2); - Y y(3); - assert(std::move(opt).value_or(y) == 2); - assert(*opt == 0); - } - { - optional opt(in_place, 2); - assert(std::move(opt).value_or(Y(3)) == 2); - assert(*opt == 0); - } - { - optional opt; - Y y(3); - assert(std::move(opt).value_or(y) == 3); - assert(!opt); - } - { - optional opt; - assert(std::move(opt).value_or(Y(3)) == 4); - assert(!opt); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp deleted file mode 100644 index 4a008dce2..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr T optional::value_or(U&& v) const&; - -#include -#include -#include - -using std::experimental::optional; - -struct Y -{ - int i_; - - constexpr Y(int i) : i_(i) {} -}; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} - constexpr X(const Y& y) : i_(y.i_) {} - constexpr X(Y&& y) : i_(y.i_+1) {} - friend constexpr bool operator==(const X& x, const X& y) - {return x.i_ == y.i_;} -}; - -int main() -{ - { - constexpr optional opt(2); - constexpr Y y(3); - static_assert(opt.value_or(y) == 2, ""); - } - { - constexpr optional opt(2); - static_assert(opt.value_or(Y(3)) == 2, ""); - } - { - constexpr optional opt; - constexpr Y y(3); - static_assert(opt.value_or(y) == 3, ""); - } - { - constexpr optional opt; - static_assert(opt.value_or(Y(3)) == 4, ""); - } - { - const optional opt(2); - const Y y(3); - assert(opt.value_or(y) == 2); - } - { - const optional opt(2); - assert(opt.value_or(Y(3)) == 2); - } - { - const optional opt; - const Y y(3); - assert(opt.value_or(y) == 3); - } - { - const optional opt; - assert(opt.value_or(Y(3)) == 4); - } -} diff --git a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp deleted file mode 100644 index f2d373c29..000000000 --- a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp +++ /dev/null @@ -1,313 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// void swap(optional&) -// noexcept(is_nothrow_move_constructible::value && -// noexcept(swap(declval(), declval()))); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -class X -{ - int i_; -public: - static unsigned dtor_called; - X(int i) : i_(i) {} - X(X&& x) = default; - X& operator=(X&&) = default; - ~X() {++dtor_called;} - - friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} -}; - -unsigned X::dtor_called = 0; - -class Y -{ - int i_; -public: - static unsigned dtor_called; - Y(int i) : i_(i) {} - Y(Y&&) = default; - ~Y() {++dtor_called;} - - friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;} - friend void swap(Y& x, Y& y) {std::swap(x.i_, y.i_);} -}; - -unsigned Y::dtor_called = 0; - -class Z -{ - int i_; -public: - Z(int i) : i_(i) {} - Z(Z&&) {TEST_THROW(7);} - - friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} - friend void swap(Z&, Z&) {TEST_THROW(6);} -}; - -struct ConstSwappable { -}; -void swap(ConstSwappable const&, ConstSwappable const&) {} - -int main() -{ - { - optional opt1; - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - opt1.swap(opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - opt1.swap(opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2(2); - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - opt1.swap(opt2); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2(2); - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - opt1.swap(opt2); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt; - optional opt2; - opt.swap(opt2); - } - { - optional opt1; - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - opt1.swap(opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - assert(X::dtor_called == 0); - } - { - optional opt1(1); - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - X::dtor_called = 0; - opt1.swap(opt2); - assert(X::dtor_called == 1); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2(2); - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - X::dtor_called = 0; - opt1.swap(opt2); - assert(X::dtor_called == 1); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2(2); - static_assert(noexcept(opt1.swap(opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - X::dtor_called = 0; - opt1.swap(opt2); - assert(X::dtor_called == 1); // from inside std::swap - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - opt1.swap(opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - assert(Y::dtor_called == 0); - } - { - optional opt1(1); - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - Y::dtor_called = 0; - opt1.swap(opt2); - assert(Y::dtor_called == 1); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2(2); - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - Y::dtor_called = 0; - opt1.swap(opt2); - assert(Y::dtor_called == 1); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2(2); - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - Y::dtor_called = 0; - opt1.swap(opt2); - assert(Y::dtor_called == 0); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - optional opt1; - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - opt1.swap(opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - } - { - optional opt1; - opt1.emplace(1); - optional opt2; - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - try - { - opt1.swap(opt2); - assert(false); - } - catch (int i) - { - assert(i == 7); - } - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - } - { - optional opt1; - optional opt2; - opt2.emplace(2); - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - try - { - opt1.swap(opt2); - assert(false); - } - catch (int i) - { - assert(i == 7); - } - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - } - { - optional opt1; - opt1.emplace(1); - optional opt2; - opt2.emplace(2); - static_assert(noexcept(opt1.swap(opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - try - { - opt1.swap(opt2); - assert(false); - } - catch (int i) - { - assert(i == 6); - } - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - } -#endif -} diff --git a/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp b/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp deleted file mode 100644 index 02c0a3a63..000000000 --- a/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// T shall be an object type and shall satisfy the requirements of Destructible - -#include - -int main() -{ - using std::experimental::optional; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp b/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp deleted file mode 100644 index da8bd05f2..000000000 --- a/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// T shall be an object type and shall satisfy the requirements of Destructible - -#include - -using std::experimental::optional; - -struct X -{ -private: - ~X() {} -}; - -int main() -{ - optional opt; -} diff --git a/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp b/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp deleted file mode 100644 index 7aa179afe..000000000 --- a/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// T shall be an object type and shall satisfy the requirements of Destructible - -#include - -using std::experimental::optional; - -struct X -{ - ~X() noexcept(false) {} -}; - -int main() -{ - optional opt; -} diff --git a/test/std/experimental/optional/optional.object/optional_void.fail.cpp b/test/std/experimental/optional/optional.object/optional_void.fail.cpp deleted file mode 100644 index 73f689c56..000000000 --- a/test/std/experimental/optional/optional.object/optional_void.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// T shall be an object type and shall satisfy the requirements of Destructible - -#include - -int main() -{ - using std::experimental::optional; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.object/types.pass.cpp b/test/std/experimental/optional/optional.object/types.pass.cpp deleted file mode 100644 index af8da2df8..000000000 --- a/test/std/experimental/optional/optional.object/types.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// class optional -// { -// public: -// typedef T value_type; -// ... - -#include -#include - -using std::experimental::optional; - -template -void -test() -{ - static_assert(std::is_same::value, ""); -} - -int main() -{ - test, int>(); - test, const int>(); - test, double>(); - test, const double>(); -} diff --git a/test/std/experimental/optional/optional.relops/equal.pass.cpp b/test/std/experimental/optional/optional.relops/equal.pass.cpp deleted file mode 100644 index 413e7c8b3..000000000 --- a/test/std/experimental/optional/optional.relops/equal.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator==(const optional& x, const optional& y); - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator == ( const X &lhs, const X &rhs ) - { return lhs.i_ == rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged - - static_assert ( o1 == o1 , "" ); - static_assert ( o1 == o2 , "" ); - static_assert ( !(o1 == o3), "" ); - static_assert ( !(o1 == o4), "" ); - static_assert ( !(o1 == o5), "" ); - - static_assert ( o2 == o1 , "" ); - static_assert ( o2 == o2 , "" ); - static_assert ( !(o2 == o3), "" ); - static_assert ( !(o2 == o4), "" ); - static_assert ( !(o2 == o5), "" ); - - static_assert ( !(o3 == o1), "" ); - static_assert ( !(o3 == o2), "" ); - static_assert ( o3 == o3 , "" ); - static_assert ( !(o3 == o4), "" ); - static_assert ( o3 == o5 , "" ); - - static_assert ( !(o4 == o1), "" ); - static_assert ( !(o4 == o2), "" ); - static_assert ( !(o4 == o3), "" ); - static_assert ( o4 == o4 , "" ); - static_assert ( !(o4 == o5), "" ); - - static_assert ( !(o5 == o1), "" ); - static_assert ( !(o5 == o2), "" ); - static_assert ( o5 == o3 , "" ); - static_assert ( !(o5 == o4), "" ); - static_assert ( o5 == o5 , "" ); - - } -} diff --git a/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp b/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp deleted file mode 100644 index c0739dda6..000000000 --- a/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator>= (const optional& x, const optional& y); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged - - static_assert ( (o1 >= o1), "" ); - static_assert ( (o1 >= o2), "" ); - static_assert ( !(o1 >= o3), "" ); - static_assert ( !(o1 >= o4), "" ); - static_assert ( !(o1 >= o5), "" ); - - static_assert ( (o2 >= o1), "" ); - static_assert ( (o2 >= o2), "" ); - static_assert ( !(o2 >= o3), "" ); - static_assert ( !(o2 >= o4), "" ); - static_assert ( !(o2 >= o5), "" ); - - static_assert ( (o3 >= o1), "" ); - static_assert ( (o3 >= o2), "" ); - static_assert ( (o3 >= o3), "" ); - static_assert ( !(o3 >= o4), "" ); - static_assert ( (o3 >= o5), "" ); - - static_assert ( (o4 >= o1), "" ); - static_assert ( (o4 >= o2), "" ); - static_assert ( (o4 >= o3), "" ); - static_assert ( (o4 >= o4), "" ); - static_assert ( (o4 >= o5), "" ); - - static_assert ( (o5 >= o1), "" ); - static_assert ( (o5 >= o2), "" ); - static_assert ( (o5 >= o3), "" ); - static_assert ( !(o5 >= o4), "" ); - static_assert ( (o5 >= o5), "" ); - } -} diff --git a/test/std/experimental/optional/optional.relops/greater_than.pass.cpp b/test/std/experimental/optional/optional.relops/greater_than.pass.cpp deleted file mode 100644 index df7dbb647..000000000 --- a/test/std/experimental/optional/optional.relops/greater_than.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator> (const optional& x, const optional& y); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged - - static_assert ( !(o1 > o1), "" ); - static_assert ( !(o1 > o2), "" ); - static_assert ( !(o1 > o3), "" ); - static_assert ( !(o1 > o4), "" ); - static_assert ( !(o1 > o5), "" ); - - static_assert ( !(o2 > o1), "" ); - static_assert ( !(o2 > o2), "" ); - static_assert ( !(o2 > o3), "" ); - static_assert ( !(o2 > o4), "" ); - static_assert ( !(o2 > o5), "" ); - - static_assert ( (o3 > o1), "" ); - static_assert ( (o3 > o2), "" ); - static_assert ( !(o3 > o3), "" ); - static_assert ( !(o3 > o4), "" ); - static_assert ( !(o3 > o5), "" ); - - static_assert ( (o4 > o1), "" ); - static_assert ( (o4 > o2), "" ); - static_assert ( (o4 > o3), "" ); - static_assert ( !(o4 > o4), "" ); - static_assert ( (o4 > o5), "" ); - - static_assert ( (o5 > o1), "" ); - static_assert ( (o5 > o2), "" ); - static_assert ( !(o5 > o3), "" ); - static_assert ( !(o5 > o4), "" ); - static_assert ( !(o5 > o5), "" ); - } -} diff --git a/test/std/experimental/optional/optional.relops/less_equal.pass.cpp b/test/std/experimental/optional/optional.relops/less_equal.pass.cpp deleted file mode 100644 index d4874d17b..000000000 --- a/test/std/experimental/optional/optional.relops/less_equal.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator<= (const optional& x, const optional& y); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged - - static_assert ( (o1 <= o1), "" ); - static_assert ( (o1 <= o2), "" ); - static_assert ( (o1 <= o3), "" ); - static_assert ( (o1 <= o4), "" ); - static_assert ( (o1 <= o5), "" ); - - static_assert ( (o2 <= o1), "" ); - static_assert ( (o2 <= o2), "" ); - static_assert ( (o2 <= o3), "" ); - static_assert ( (o2 <= o4), "" ); - static_assert ( (o2 <= o5), "" ); - - static_assert ( !(o3 <= o1), "" ); - static_assert ( !(o3 <= o2), "" ); - static_assert ( (o3 <= o3), "" ); - static_assert ( (o3 <= o4), "" ); - static_assert ( (o3 <= o5), "" ); - - static_assert ( !(o4 <= o1), "" ); - static_assert ( !(o4 <= o2), "" ); - static_assert ( !(o4 <= o3), "" ); - static_assert ( (o4 <= o4), "" ); - static_assert ( !(o4 <= o5), "" ); - - static_assert ( !(o5 <= o1), "" ); - static_assert ( !(o5 <= o2), "" ); - static_assert ( (o5 <= o3), "" ); - static_assert ( (o5 <= o4), "" ); - static_assert ( (o5 <= o5), "" ); - } -} diff --git a/test/std/experimental/optional/optional.relops/less_than.pass.cpp b/test/std/experimental/optional/optional.relops/less_than.pass.cpp deleted file mode 100644 index 411340826..000000000 --- a/test/std/experimental/optional/optional.relops/less_than.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator< (const optional& x, const optional& y); - -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } - -int main() -{ - { - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged - - static_assert ( !(o1 < o1), "" ); - static_assert ( !(o1 < o2), "" ); - static_assert ( (o1 < o3), "" ); - static_assert ( (o1 < o4), "" ); - static_assert ( (o1 < o5), "" ); - - static_assert ( !(o2 < o1), "" ); - static_assert ( !(o2 < o2), "" ); - static_assert ( (o2 < o3), "" ); - static_assert ( (o2 < o4), "" ); - static_assert ( (o2 < o5), "" ); - - static_assert ( !(o3 < o1), "" ); - static_assert ( !(o3 < o2), "" ); - static_assert ( !(o3 < o3), "" ); - static_assert ( (o3 < o4), "" ); - static_assert ( !(o3 < o5), "" ); - - static_assert ( !(o4 < o1), "" ); - static_assert ( !(o4 < o2), "" ); - static_assert ( !(o4 < o3), "" ); - static_assert ( !(o4 < o4), "" ); - static_assert ( !(o4 < o5), "" ); - - static_assert ( !(o5 < o1), "" ); - static_assert ( !(o5 < o2), "" ); - static_assert ( !(o5 < o3), "" ); - static_assert ( (o5 < o4), "" ); - static_assert ( !(o5 < o5), "" ); - } -} diff --git a/test/std/experimental/optional/optional.relops/not_equal.pass.cpp b/test/std/experimental/optional/optional.relops/not_equal.pass.cpp deleted file mode 100644 index 19a196317..000000000 --- a/test/std/experimental/optional/optional.relops/not_equal.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template constexpr bool operator!=(const optional& x, const optional& y); - -#include -#include -#include - -using std::experimental::optional; - -struct X -{ - int i_; - - constexpr X(int i) : i_(i) {} -}; - -constexpr bool operator == ( const X &lhs, const X &rhs ) - { return lhs.i_ == rhs.i_ ; } - -int main() -{ - { - typedef X T; - typedef optional O; - - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged - - static_assert ( !(o1 != o1), "" ); - static_assert ( !(o1 != o2), "" ); - static_assert ( (o1 != o3), "" ); - static_assert ( (o1 != o4), "" ); - static_assert ( (o1 != o5), "" ); - - static_assert ( !(o2 != o1), "" ); - static_assert ( !(o2 != o2), "" ); - static_assert ( (o2 != o3), "" ); - static_assert ( (o2 != o4), "" ); - static_assert ( (o2 != o5), "" ); - - static_assert ( (o3 != o1), "" ); - static_assert ( (o3 != o2), "" ); - static_assert ( !(o3 != o3), "" ); - static_assert ( (o3 != o4), "" ); - static_assert ( !(o3 != o5), "" ); - - static_assert ( (o4 != o1), "" ); - static_assert ( (o4 != o2), "" ); - static_assert ( (o4 != o3), "" ); - static_assert ( !(o4 != o4), "" ); - static_assert ( (o4 != o5), "" ); - - static_assert ( (o5 != o1), "" ); - static_assert ( (o5 != o2), "" ); - static_assert ( !(o5 != o3), "" ); - static_assert ( (o5 != o4), "" ); - static_assert ( !(o5 != o5), "" ); - - } -} diff --git a/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp b/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp deleted file mode 100644 index 9abd87bd4..000000000 --- a/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr -// optional::type> -// make_optional(T&& v); - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using std::experimental::optional; - using std::experimental::make_optional; - - { - optional opt = make_optional(2); - assert(*opt == 2); - } - { - std::string s("123"); - optional opt = make_optional(s); - assert(*opt == s); - } - { - std::string s("123"); - optional opt = make_optional(std::move(s)); - assert(*opt == "123"); - LIBCPP_ASSERT(s.empty()); - } - { - std::unique_ptr s(new int(3)); - optional> opt = make_optional(std::move(s)); - assert(**opt == 3); - assert(s == nullptr); - } -} diff --git a/test/std/experimental/optional/optional.specalg/swap.pass.cpp b/test/std/experimental/optional/optional.specalg/swap.pass.cpp deleted file mode 100644 index 4d643cb44..000000000 --- a/test/std/experimental/optional/optional.specalg/swap.pass.cpp +++ /dev/null @@ -1,303 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template void swap(optional& x, optional& y) -// noexcept(noexcept(x.swap(y))); - -#include -#include -#include - -#include "test_macros.h" - -using std::experimental::optional; - -class X -{ - int i_; -public: - static unsigned dtor_called; - X(int i) : i_(i) {} - X(X&& x) = default; - X& operator=(X&&) = default; - ~X() {++dtor_called;} - - friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} -}; - -unsigned X::dtor_called = 0; - -class Y -{ - int i_; -public: - static unsigned dtor_called; - Y(int i) : i_(i) {} - Y(Y&&) = default; - ~Y() {++dtor_called;} - - friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;} - friend void swap(Y& x, Y& y) {std::swap(x.i_, y.i_);} -}; - -unsigned Y::dtor_called = 0; - -class Z -{ - int i_; -public: - Z(int i) : i_(i) {} - Z(Z&&) {TEST_THROW(7);} - - friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} - friend void swap(Z&, Z&) {TEST_THROW(6);} -}; - -int main() -{ - { - optional opt1; - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - swap(opt1, opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - swap(opt1, opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2(2); - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - swap(opt1, opt2); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2(2); - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - swap(opt1, opt2); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - swap(opt1, opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - assert(X::dtor_called == 0); - } - { - optional opt1(1); - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - X::dtor_called = 0; - swap(opt1, opt2); - assert(X::dtor_called == 1); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2(2); - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - X::dtor_called = 0; - swap(opt1, opt2); - assert(X::dtor_called == 1); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2(2); - static_assert(noexcept(swap(opt1, opt2)) == true, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - X::dtor_called = 0; - swap(opt1, opt2); - assert(X::dtor_called == 1); // from inside std::swap - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - swap(opt1, opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - assert(Y::dtor_called == 0); - } - { - optional opt1(1); - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - Y::dtor_called = 0; - swap(opt1, opt2); - assert(Y::dtor_called == 1); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2(2); - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - Y::dtor_called = 0; - swap(opt1, opt2); - assert(Y::dtor_called == 1); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == false); - } - { - optional opt1(1); - optional opt2(2); - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - Y::dtor_called = 0; - swap(opt1, opt2); - assert(Y::dtor_called == 0); - assert(static_cast(opt1) == true); - assert(*opt1 == 2); - assert(static_cast(opt2) == true); - assert(*opt2 == 1); - } - { - optional opt1; - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - swap(opt1, opt2); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == false); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - optional opt1; - opt1.emplace(1); - optional opt2; - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - try - { - swap(opt1, opt2); - assert(false); - } - catch (int i) - { - assert(i == 7); - } - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == false); - } - { - optional opt1; - optional opt2; - opt2.emplace(2); - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - try - { - swap(opt1, opt2); - assert(false); - } - catch (int i) - { - assert(i == 7); - } - assert(static_cast(opt1) == false); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - } - { - optional opt1; - opt1.emplace(1); - optional opt2; - opt2.emplace(2); - static_assert(noexcept(swap(opt1, opt2)) == false, ""); - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - try - { - swap(opt1, opt2); - assert(false); - } - catch (int i) - { - assert(i == 6); - } - assert(static_cast(opt1) == true); - assert(*opt1 == 1); - assert(static_cast(opt2) == true); - assert(*opt2 == 2); - } -#endif // TEST_HAS_NO_EXCEPTIONS -} diff --git a/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp deleted file mode 100644 index bdf01eba4..000000000 --- a/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for -// (possibly cv-qualified) in_place_t is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::in_place_t; - using std::experimental::in_place; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp b/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp deleted file mode 100644 index 61393c105..000000000 --- a/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for a -// reference type is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp deleted file mode 100644 index 89c207306..000000000 --- a/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for -// (possibly cv-qualified) nullopt_t is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp deleted file mode 100644 index 47c2be7da..000000000 --- a/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for -// (possibly cv-qualified) in_place_t is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::in_place_t; - using std::experimental::in_place; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp b/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp deleted file mode 100644 index b8fba47f7..000000000 --- a/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// #include - -#include - -int main() -{ - using std::experimental::optional; - - std::initializer_list list; - (void)list; -} diff --git a/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp b/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp deleted file mode 100644 index de2f18991..000000000 --- a/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for a -// reference type is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp deleted file mode 100644 index 3d276d642..000000000 --- a/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for -// (possibly cv-qualified) nullopt_t is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - using std::experimental::nullopt_t; - using std::experimental::nullopt; - - optional opt; -} diff --git a/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp b/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp deleted file mode 100644 index fd6da18e8..000000000 --- a/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// A program that necessitates the instantiation of template optional for a -// reference type is ill-formed. - -#include - -int main() -{ - using std::experimental::optional; - - optional opt; -} From f8d223fe6348fc304d32a121364712e4de2cb5a5 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Feb 2018 15:21:14 +0000 Subject: [PATCH 0320/1520] Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323972 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/any | 583 +----------------- include/module.modulemap | 4 - src/any.cpp | 7 - test/libcxx/double_include.sh.cpp | 1 - .../any/size_and_alignment.pass.cpp | 23 - .../experimental/any/small_type.pass.cpp | 114 ---- test/libcxx/experimental/any/version.pass.cpp | 20 - test/libcxx/min_max_macros.sh.cpp | 2 - .../any/any.class/any.assign/copy.pass.cpp | 199 ------ .../any/any.class/any.assign/move.pass.cpp | 104 ---- .../any/any.class/any.assign/value.pass.cpp | 179 ------ .../value_non_copyable_assign.fail.cpp | 38 -- .../any/any.class/any.cons/copy.pass.cpp | 102 --- .../any/any.class/any.cons/default.pass.cpp | 38 -- .../any/any.class/any.cons/move.pass.cpp | 104 ---- .../any.cons/non_copyable_value.fail.cpp | 36 -- .../any/any.class/any.cons/value.pass.cpp | 118 ---- .../any.class/any.modifiers/clear.pass.cpp | 65 -- .../any/any.class/any.modifiers/swap.pass.cpp | 103 ---- .../any.class/any.observers/empty.pass.cpp | 64 -- .../any/any.class/any.observers/type.pass.cpp | 41 -- .../any/any.class/nothing_to_do.pass.cpp | 12 - .../any.cast/any_cast_pointer.pass.cpp | 146 ----- .../any.cast/any_cast_reference.pass.cpp | 312 ---------- .../any.cast/const_correctness.fail.cpp | 38 -- .../any.cast/not_copy_constructible.fail.cpp | 45 -- .../any.cast/reference_types.fail.cpp | 37 -- .../any/any.nonmembers/swap.pass.cpp | 41 -- 28 files changed, 1 insertion(+), 2575 deletions(-) delete mode 100644 test/libcxx/experimental/any/size_and_alignment.pass.cpp delete mode 100644 test/libcxx/experimental/any/small_type.pass.cpp delete mode 100644 test/libcxx/experimental/any/version.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.assign/copy.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.assign/move.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.assign/value.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp delete mode 100644 test/std/experimental/any/any.class/any.cons/copy.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.cons/default.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.cons/move.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp delete mode 100644 test/std/experimental/any/any.class/any.cons/value.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.observers/empty.pass.cpp delete mode 100644 test/std/experimental/any/any.class/any.observers/type.pass.cpp delete mode 100644 test/std/experimental/any/any.class/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp delete mode 100644 test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp delete mode 100644 test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp delete mode 100644 test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp delete mode 100644 test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp delete mode 100644 test/std/experimental/any/any.nonmembers/swap.pass.cpp diff --git a/include/experimental/any b/include/experimental/any index 083a29090..1dcdd0f25 100644 --- a/include/experimental/any +++ b/include/experimental/any @@ -8,585 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_ANY -#define _LIBCPP_EXPERIMENTAL_ANY - -/* - experimental/any synopsis - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - - class bad_any_cast : public bad_cast - { - public: - virtual const char* what() const noexcept; - }; - - class any - { - public: - - // 6.3.1 any construct/destruct - any() noexcept; - - any(const any& other); - any(any&& other) noexcept; - - template - any(ValueType&& value); - - ~any(); - - // 6.3.2 any assignments - any& operator=(const any& rhs); - any& operator=(any&& rhs) noexcept; - - template - any& operator=(ValueType&& rhs); - - // 6.3.3 any modifiers - void clear() noexcept; - void swap(any& rhs) noexcept; - - // 6.3.4 any observers - bool empty() const noexcept; - const type_info& type() const noexcept; - }; - - // 6.4 Non-member functions - void swap(any& x, any& y) noexcept; - - template - ValueType any_cast(const any& operand); - template - ValueType any_cast(any& operand); - template - ValueType any_cast(any&& operand); - - template - const ValueType* any_cast(const any* operand) noexcept; - template - ValueType* any_cast(any* operand) noexcept; - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -*/ - -#include -#include -#include -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast -{ -public: - virtual const char* what() const _NOEXCEPT; -}; - -#if _LIBCPP_STD_VER > 11 // C++ > 11 - -_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE -_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -void __throw_bad_any_cast() -{ -#ifndef _LIBCPP_NO_EXCEPTIONS - throw bad_any_cast(); -#else - _VSTD::abort(); -#endif -} - -// Forward declarations -class any; - -template -typename add_pointer::type>::type -_LIBCPP_INLINE_VISIBILITY -any_cast(any const *) _NOEXCEPT; - -template -typename add_pointer<_ValueType>::type -_LIBCPP_INLINE_VISIBILITY -any_cast(any *) _NOEXCEPT; - -namespace __any_imp -{ - typedef typename aligned_storage<3*sizeof(void*), alignment_of::value>::type - _Buffer; - - template - struct _IsSmallObject - : public integral_constant::value - % alignment_of<_Tp>::value == 0 - && is_nothrow_move_constructible<_Tp>::value - > - {}; - - enum class _Action - { - _Destroy, - _Copy, - _Move, - _Get, - _TypeInfo - }; - - template - struct _SmallHandler; - - template - struct _LargeHandler; - - template - using _Handler = typename conditional<_IsSmallObject<_Tp>::value - , _SmallHandler<_Tp> - , _LargeHandler<_Tp> - >::type; - template - using _EnableIfNotAny = typename - enable_if< - !is_same::type, any>::value - >::type; - -} // namespace __any_imp - -class any -{ -public: - // 6.3.1 any construct/destruct - _LIBCPP_INLINE_VISIBILITY - any() _NOEXCEPT : __h(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - any(any const & __other) : __h(nullptr) - { - if (__other.__h) __other.__call(_Action::_Copy, this); - } - - _LIBCPP_INLINE_VISIBILITY - any(any && __other) _NOEXCEPT : __h(nullptr) - { - if (__other.__h) __other.__call(_Action::_Move, this); - } - - template < - class _ValueType - , class = __any_imp::_EnableIfNotAny<_ValueType> - > - _LIBCPP_INLINE_VISIBILITY - any(_ValueType && __value); - - _LIBCPP_INLINE_VISIBILITY - ~any() - { - this->clear(); - } - - // 6.3.2 any assignments - _LIBCPP_INLINE_VISIBILITY - any & operator=(any const & __rhs) - { - any(__rhs).swap(*this); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - any & operator=(any && __rhs) _NOEXCEPT - { - any(_VSTD::move(__rhs)).swap(*this); - return *this; - } - - template < - class _ValueType - , class = __any_imp::_EnableIfNotAny<_ValueType> - > - _LIBCPP_INLINE_VISIBILITY - any & operator=(_ValueType && __rhs); - - // 6.3.3 any modifiers - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - if (__h) this->__call(_Action::_Destroy); - } - - _LIBCPP_INLINE_VISIBILITY - void swap(any & __rhs) _NOEXCEPT; - - // 6.3.4 any observers - _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT - { - return __h == nullptr; - } - -#if !defined(_LIBCPP_NO_RTTI) - _LIBCPP_INLINE_VISIBILITY - const type_info & type() const _NOEXCEPT - { - if (__h) { - return *static_cast(this->__call(_Action::_TypeInfo)); - } else { - return typeid(void); - } - } -#endif - -private: - typedef __any_imp::_Action _Action; - - typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *); - - union _Storage - { - void * __ptr; - __any_imp::_Buffer __buf; - }; - - _LIBCPP_ALWAYS_INLINE - void * __call(_Action __a, any * __other = nullptr, - type_info const * __info = nullptr) const - { - return __h(__a, this, __other, __info); - } - - _LIBCPP_ALWAYS_INLINE - void * __call(_Action __a, any * __other = nullptr, - type_info const * __info = nullptr) - { - return __h(__a, this, __other, __info); - } - - template - friend struct __any_imp::_SmallHandler; - template - friend struct __any_imp::_LargeHandler; - - template - friend typename add_pointer::type>::type - any_cast(any const *) _NOEXCEPT; - - template - friend typename add_pointer<_ValueType>::type - any_cast(any *) _NOEXCEPT; - - _HandleFuncPtr __h; - _Storage __s; -}; - -namespace __any_imp -{ - - template - struct _LIBCPP_TEMPLATE_VIS _SmallHandler - { - _LIBCPP_INLINE_VISIBILITY - static void* __handle(_Action __act, any const * __this, any * __other, - type_info const * __info) - { - switch (__act) - { - case _Action::_Destroy: - __destroy(const_cast(*__this)); - return nullptr; - case _Action::_Copy: - __copy(*__this, *__other); - return nullptr; - case _Action::_Move: - __move(const_cast(*__this), *__other); - return nullptr; - case _Action::_Get: - return __get(const_cast(*__this), __info); - case _Action::_TypeInfo: - return __type_info(); - } - } - - template - _LIBCPP_INLINE_VISIBILITY - static void __create(any & __dest, _Up && __v) - { - ::new (static_cast(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v)); - __dest.__h = &_SmallHandler::__handle; - } - - private: - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void __destroy(any & __this) - { - _Tp & __value = *static_cast<_Tp *>(static_cast(&__this.__s.__buf)); - __value.~_Tp(); - __this.__h = nullptr; - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void __copy(any const & __this, any & __dest) - { - _SmallHandler::__create(__dest, *static_cast<_Tp const *>( - static_cast(&__this.__s.__buf))); - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void __move(any & __this, any & __dest) - { - _SmallHandler::__create(__dest, _VSTD::move( - *static_cast<_Tp*>(static_cast(&__this.__s.__buf)))); - __destroy(__this); - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void* __get(any & __this, type_info const * __info) - { -#if !defined(_LIBCPP_NO_RTTI) - if (typeid(_Tp) == *__info) { - return static_cast(&__this.__s.__buf); - } - return nullptr; -#else - return static_cast(&__this.__s.__buf); -#endif - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void* __type_info() - { -#if !defined(_LIBCPP_NO_RTTI) - return const_cast(static_cast(&typeid(_Tp))); -#else - return nullptr; -#endif - } - }; - - template - struct _LIBCPP_TEMPLATE_VIS _LargeHandler - { - _LIBCPP_INLINE_VISIBILITY - static void* __handle(_Action __act, any const * __this, any * __other, - type_info const * __info) - { - switch (__act) - { - case _Action::_Destroy: - __destroy(const_cast(*__this)); - return nullptr; - case _Action::_Copy: - __copy(*__this, *__other); - return nullptr; - case _Action::_Move: - __move(const_cast(*__this), *__other); - return nullptr; - case _Action::_Get: - return __get(const_cast(*__this), __info); - case _Action::_TypeInfo: - return __type_info(); - } - } - - template - _LIBCPP_INLINE_VISIBILITY - static void __create(any & __dest, _Up && __v) - { - typedef allocator<_Tp> _Alloc; - typedef __allocator_destructor<_Alloc> _Dp; - _Alloc __a; - unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Up>(__v)); - __dest.__s.__ptr = __hold.release(); - __dest.__h = &_LargeHandler::__handle; - } - - private: - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void __destroy(any & __this) - { - delete static_cast<_Tp*>(__this.__s.__ptr); - __this.__h = nullptr; - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void __copy(any const & __this, any & __dest) - { - _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr)); - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void __move(any & __this, any & __dest) - { - __dest.__s.__ptr = __this.__s.__ptr; - __dest.__h = &_LargeHandler::__handle; - __this.__h = nullptr; - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void* __get(any & __this, type_info const * __info) - { -#if !defined(_LIBCPP_NO_RTTI) - if (typeid(_Tp) == *__info) { - return static_cast(__this.__s.__ptr); - } - return nullptr; -#else - return static_cast(__this.__s.__ptr); -#endif - } - - _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY - static void* __type_info() - { -#if !defined(_LIBCPP_NO_RTTI) - return const_cast(static_cast(&typeid(_Tp))); -#else - return nullptr; -#endif - } - }; - -} // namespace __any_imp - - -template -any::any(_ValueType && __v) : __h(nullptr) -{ - typedef typename decay<_ValueType>::type _Tp; - static_assert(is_copy_constructible<_Tp>::value, - "_ValueType must be CopyConstructible."); - typedef __any_imp::_Handler<_Tp> _HandlerType; - _HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v)); -} - -template -any & any::operator=(_ValueType && __v) -{ - typedef typename decay<_ValueType>::type _Tp; - static_assert(is_copy_constructible<_Tp>::value, - "_ValueType must be CopyConstructible."); - any(_VSTD::forward<_ValueType>(__v)).swap(*this); - return *this; -} - -inline -void any::swap(any & __rhs) _NOEXCEPT -{ - if (__h && __rhs.__h) { - any __tmp; - __rhs.__call(_Action::_Move, &__tmp); - this->__call(_Action::_Move, &__rhs); - __tmp.__call(_Action::_Move, this); - } - else if (__h) { - this->__call(_Action::_Move, &__rhs); - } - else if (__rhs.__h) { - __rhs.__call(_Action::_Move, this); - } -} - -// 6.4 Non-member functions - -inline _LIBCPP_INLINE_VISIBILITY -void swap(any & __lhs, any & __rhs) _NOEXCEPT -{ - __lhs.swap(__rhs); -} - -template -_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -_ValueType any_cast(any const & __v) -{ - static_assert( - is_reference<_ValueType>::value - || is_copy_constructible<_ValueType>::value, - "_ValueType is required to be a reference or a CopyConstructible type."); - typedef typename add_const::type>::type - _Tp; - _Tp * __tmp = any_cast<_Tp>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return *__tmp; -} - -template -_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -_ValueType any_cast(any & __v) -{ - static_assert( - is_reference<_ValueType>::value - || is_copy_constructible<_ValueType>::value, - "_ValueType is required to be a reference or a CopyConstructible type."); - typedef typename remove_reference<_ValueType>::type _Tp; - _Tp * __tmp = any_cast<_Tp>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return *__tmp; -} - -template -_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -_ValueType any_cast(any && __v) -{ - static_assert( - is_reference<_ValueType>::value - || is_copy_constructible<_ValueType>::value, - "_ValueType is required to be a reference or a CopyConstructible type."); - typedef typename remove_reference<_ValueType>::type _Tp; - _Tp * __tmp = any_cast<_Tp>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return *__tmp; -} - -template -inline -typename add_pointer::type>::type -any_cast(any const * __any) _NOEXCEPT -{ - static_assert(!is_reference<_ValueType>::value, - "_ValueType may not be a reference."); - return any_cast<_ValueType>(const_cast(__any)); -} - -template -typename add_pointer<_ValueType>::type -any_cast(any * __any) _NOEXCEPT -{ - using __any_imp::_Action; - static_assert(!is_reference<_ValueType>::value, - "_ValueType may not be a reference."); - typedef typename add_pointer<_ValueType>::type _ReturnType; - if (__any && __any->__h) { - - return static_cast<_ReturnType>( - __any->__call(_Action::_Get, nullptr, -#if !defined(_LIBCPP_NO_RTTI) - &typeid(_ValueType) -#else - nullptr -#endif - )); - - } - return nullptr; -} - -#endif // _LIBCPP_STD_VER > 11 - -_LIBCPP_END_NAMESPACE_LFTS - -#endif // _LIBCPP_EXPERIMENTAL_ANY +#error " has been removed. Use instead." diff --git a/include/module.modulemap b/include/module.modulemap index de1d507bf..d25e61907 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -493,10 +493,6 @@ module std [system] { header "experimental/algorithm" export * } - module any { - header "experimental/any" - export * - } module chrono { header "experimental/chrono" export * diff --git a/src/any.cpp b/src/any.cpp index 45b2337eb..968552029 100644 --- a/src/any.cpp +++ b/src/any.cpp @@ -8,16 +8,9 @@ //===----------------------------------------------------------------------===// #include "any" -#include "experimental/any" namespace std { const char* bad_any_cast::what() const _NOEXCEPT { return "bad any cast"; } } - -_LIBCPP_BEGIN_NAMESPACE_LFTS -const char* bad_any_cast::what() const _NOEXCEPT { - return "bad any cast"; -} -_LIBCPP_END_NAMESPACE_LFTS diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index fe728f778..60a574a82 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -135,7 +135,6 @@ // experimental headers #if __cplusplus >= 201103L #include -#include #include #if defined(__cpp_coroutines) #include diff --git a/test/libcxx/experimental/any/size_and_alignment.pass.cpp b/test/libcxx/experimental/any/size_and_alignment.pass.cpp deleted file mode 100644 index b7db54020..000000000 --- a/test/libcxx/experimental/any/size_and_alignment.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// Check that the size and alignment of any are what we expect. - -#include - -int main() -{ - using std::experimental::any; - static_assert(sizeof(any) == sizeof(void*)*4, ""); - static_assert(alignof(any) == alignof(void*), ""); -} diff --git a/test/libcxx/experimental/any/small_type.pass.cpp b/test/libcxx/experimental/any/small_type.pass.cpp deleted file mode 100644 index 96754126c..000000000 --- a/test/libcxx/experimental/any/small_type.pass.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// Check that the size and alignment of any are what we expect. - -#include -#include "experimental_any_helpers.h" - -constexpr std::size_t BufferSize = (sizeof(void*) * 3); -constexpr std::size_t BufferAlignment = alignof(void*); -// Clang doesn't like "alignof(BufferAlignment * 2)" due to PR13986. -// So we create "DoubleBufferAlignment" instead. -constexpr std::size_t DoubleBufferAlignment = BufferAlignment * 2; - -class SmallThrowsDtor -{ -public: - SmallThrowsDtor() {} - SmallThrowsDtor(SmallThrowsDtor const &) noexcept {} - SmallThrowsDtor(SmallThrowsDtor &&) noexcept {} - ~SmallThrowsDtor() noexcept(false) {} -}; - - -struct alignas(1) MaxSizeType { - char buff[BufferSize]; -}; - -struct alignas(BufferAlignment) MaxAlignType { -}; - -struct alignas(BufferAlignment) MaxSizeAndAlignType { - char buff[BufferSize]; -}; - - -struct alignas(1) OverSizeType { - char buff[BufferSize + 1]; -}; - -struct alignas(DoubleBufferAlignment) OverAlignedType { -}; - -struct alignas(DoubleBufferAlignment) OverSizeAndAlignedType { - char buff[BufferSize + 1]; -}; - -int main() -{ - using std::experimental::any; - using std::experimental::__any_imp::_IsSmallObject; - static_assert(_IsSmallObject::value, ""); - static_assert(_IsSmallObject::value, ""); - static_assert(!_IsSmallObject::value, ""); - static_assert(!_IsSmallObject::value, ""); - { - // Check a type that meets the size requirement *exactly* and has - // a lesser alignment requirement is considered small. - typedef MaxSizeType T; - static_assert(sizeof(T) == BufferSize, ""); - static_assert(alignof(T) < BufferAlignment, ""); - static_assert(_IsSmallObject::value, ""); - } - { - // Check a type that meets the alignment requirement *exactly* and has - // a lesser size is considered small. - typedef MaxAlignType T; - static_assert(sizeof(T) < BufferSize, ""); - static_assert(alignof(T) == BufferAlignment, ""); - static_assert(_IsSmallObject::value, ""); - } - { - // Check a type that meets the size and alignment requirements *exactly* - // is considered small. - typedef MaxSizeAndAlignType T; - static_assert(sizeof(T) == BufferSize, ""); - static_assert(alignof(T) == BufferAlignment, ""); - static_assert(_IsSmallObject::value, ""); - } - { - // Check a type that meets the alignment requirements but is over-sized - // is not considered small. - typedef OverSizeType T; - static_assert(sizeof(T) > BufferSize, ""); - static_assert(alignof(T) < BufferAlignment, ""); - static_assert(!_IsSmallObject::value, ""); - } - { - // Check a type that meets the size requirements but is over-aligned - // is not considered small. - typedef OverAlignedType T; - static_assert(sizeof(T) < BufferSize, ""); - static_assert(alignof(T) > BufferAlignment, ""); - static_assert(!_IsSmallObject::value, ""); - } - { - // Check a type that exceeds both the size an alignment requirements - // is not considered small. - typedef OverSizeAndAlignedType T; - static_assert(sizeof(T) > BufferSize, ""); - static_assert(alignof(T) > BufferAlignment, ""); - static_assert(!_IsSmallObject::value, ""); - } -} diff --git a/test/libcxx/experimental/any/version.pass.cpp b/test/libcxx/experimental/any/version.pass.cpp deleted file mode 100644 index 611d65027..000000000 --- a/test/libcxx/experimental/any/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp index 978ff9080..7411ca2b3 100644 --- a/test/libcxx/min_max_macros.sh.cpp +++ b/test/libcxx/min_max_macros.sh.cpp @@ -237,8 +237,6 @@ TEST_MACROS(); #if __cplusplus >= 201103L #include TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include diff --git a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp deleted file mode 100644 index 0b9d71e5f..000000000 --- a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp +++ /dev/null @@ -1,199 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any& operator=(any const &); - -// Test copy assignment - -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; - -template -void test_copy_assign() { - assert(LHS::count == 0); - assert(RHS::count == 0); - LHS::reset(); - RHS::reset(); - { - any lhs(LHS(1)); - any const rhs(RHS(2)); - - assert(LHS::count == 1); - assert(RHS::count == 1); - assert(RHS::copied == 0); - - lhs = rhs; - - assert(RHS::copied == 1); - assert(LHS::count == 0); - assert(RHS::count == 2); - - assertContains(lhs, 2); - assertContains(rhs, 2); - } - assert(LHS::count == 0); - assert(RHS::count == 0); -} - -template -void test_copy_assign_empty() { - assert(LHS::count == 0); - LHS::reset(); - { - any lhs; - any const rhs(LHS(42)); - - assert(LHS::count == 1); - assert(LHS::copied == 0); - - lhs = rhs; - - assert(LHS::copied == 1); - assert(LHS::count == 2); - - assertContains(lhs, 42); - assertContains(rhs, 42); - } - assert(LHS::count == 0); - LHS::reset(); - { - any lhs(LHS(1)); - any const rhs; - - assert(LHS::count == 1); - assert(LHS::copied == 0); - - lhs = rhs; - - assert(LHS::copied == 0); - assert(LHS::count == 0); - - assertEmpty(lhs); - assertEmpty(rhs); - } - assert(LHS::count == 0); -} - -void test_copy_assign_self() { - // empty - { - any a; - a = a; - assertEmpty(a); - assert(globalMemCounter.checkOutstandingNewEq(0)); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - // small - { - any a((small(1))); - assert(small::count == 1); - - a = a; - - assert(small::count == 1); - assertContains(a, 1); - assert(globalMemCounter.checkOutstandingNewEq(0)); - } - assert(small::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); - // large - { - any a(large(1)); - assert(large::count == 1); - - a = a; - - assert(large::count == 1); - assertContains(a, 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - } - assert(large::count == 0); - assert(globalMemCounter.checkOutstandingNewEq(0)); -} - -template -void test_copy_assign_throws() -{ -#if !defined(TEST_HAS_NO_EXCEPTIONS) - auto try_throw = - [](any& lhs, any const& rhs) { - try { - lhs = rhs; - assert(false); - } catch (my_any_exception const &) { - // do nothing - } catch (...) { - assert(false); - } - }; - // const lvalue to empty - { - any lhs; - any const rhs((Tp(1))); - assert(Tp::count == 1); - - try_throw(lhs, rhs); - - assert(Tp::count == 1); - assertEmpty(lhs); - assertContains(rhs); - } - { - any lhs((small(2))); - any const rhs((Tp(1))); - assert(small::count == 1); - assert(Tp::count == 1); - - try_throw(lhs, rhs); - - assert(small::count == 1); - assert(Tp::count == 1); - assertContains(lhs, 2); - assertContains(rhs); - } - { - any lhs((large(2))); - any const rhs((Tp(1))); - assert(large::count == 1); - assert(Tp::count == 1); - - try_throw(lhs, rhs); - - assert(large::count == 1); - assert(Tp::count == 1); - assertContains(lhs, 2); - assertContains(rhs); - } -#endif -} - -int main() { - test_copy_assign(); - test_copy_assign(); - test_copy_assign(); - test_copy_assign(); - test_copy_assign_empty(); - test_copy_assign_empty(); - test_copy_assign_self(); - test_copy_assign_throws(); - test_copy_assign_throws(); -} diff --git a/test/std/experimental/any/any.class/any.assign/move.pass.cpp b/test/std/experimental/any/any.class/any.assign/move.pass.cpp deleted file mode 100644 index 72351aeae..000000000 --- a/test/std/experimental/any/any.class/any.assign/move.pass.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any& operator=(any &&); - -// Test move assignment. - -#include -#include - -#include "experimental_any_helpers.h" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; - -template -void test_move_assign() { - assert(LHS::count == 0); - assert(RHS::count == 0); - { - LHS const s1(1); - any a(s1); - RHS const s2(2); - any a2(s2); - - assert(LHS::count == 2); - assert(RHS::count == 2); - - a = std::move(a2); - - assert(LHS::count == 1); - assert(RHS::count == 2); - - assertContains(a, 2); - assertEmpty(a2); - } - assert(LHS::count == 0); - assert(RHS::count == 0); -} - -template -void test_move_assign_empty() { - assert(LHS::count == 0); - { - any a; - any a2((LHS(1))); - - assert(LHS::count == 1); - - a = std::move(a2); - - assert(LHS::count == 1); - - assertContains(a, 1); - assertEmpty(a2); - } - assert(LHS::count == 0); - { - any a((LHS(1))); - any a2; - - assert(LHS::count == 1); - - a = std::move(a2); - - assert(LHS::count == 0); - - assertEmpty(a); - assertEmpty(a2); - } - assert(LHS::count == 0); -} - -void test_move_assign_noexcept() { - any a1; - any a2; - static_assert( - noexcept(a1 = std::move(a2)) - , "any & operator=(any &&) must be noexcept" - ); -} - -int main() { - test_move_assign_noexcept(); - test_move_assign(); - test_move_assign(); - test_move_assign(); - test_move_assign(); - test_move_assign_empty(); - test_move_assign_empty(); -} diff --git a/test/std/experimental/any/any.class/any.assign/value.pass.cpp b/test/std/experimental/any/any.class/any.assign/value.pass.cpp deleted file mode 100644 index cd4646fb5..000000000 --- a/test/std/experimental/any/any.class/any.assign/value.pass.cpp +++ /dev/null @@ -1,179 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any& operator=(any const &); - -// Test value copy and move assignment. - -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; - -template -void test_assign_value() { - assert(LHS::count == 0); - assert(RHS::count == 0); - LHS::reset(); - RHS::reset(); - { - any lhs(LHS(1)); - any const rhs(RHS(2)); - - assert(LHS::count == 1); - assert(RHS::count == 1); - assert(RHS::copied == 0); - - lhs = rhs; - - assert(RHS::copied == 1); - assert(LHS::count == 0); - assert(RHS::count == 2); - - assertContains(lhs, 2); - assertContains(rhs, 2); - } - assert(LHS::count == 0); - assert(RHS::count == 0); - LHS::reset(); - RHS::reset(); - { - any lhs(LHS(1)); - any rhs(RHS(2)); - - assert(LHS::count == 1); - assert(RHS::count == 1); - assert(RHS::moved == 1); - - lhs = std::move(rhs); - - assert(RHS::moved >= 1); - assert(RHS::copied == 0); - assert(LHS::count == 0); - assert(RHS::count == 1); - - assertContains(lhs, 2); - assertEmpty(rhs); - } - assert(LHS::count == 0); - assert(RHS::count == 0); -} - -template -void test_assign_value_empty() { - assert(RHS::count == 0); - RHS::reset(); - { - any lhs; - RHS rhs(42); - assert(RHS::count == 1); - assert(RHS::copied == 0); - - lhs = rhs; - - assert(RHS::count == 2); - assert(RHS::copied == 1); - assert(RHS::moved >= 0); - assertContains(lhs, 42); - } - assert(RHS::count == 0); - RHS::reset(); - { - any lhs; - RHS rhs(42); - assert(RHS::count == 1); - assert(RHS::moved == 0); - - lhs = std::move(rhs); - - assert(RHS::count == 2); - assert(RHS::copied == 0); - assert(RHS::moved >= 1); - assertContains(lhs, 42); - } - assert(RHS::count == 0); - RHS::reset(); -} - - -template -void test_assign_throws() { -#if !defined(TEST_HAS_NO_EXCEPTIONS) - auto try_throw= - [](any& lhs, auto&& rhs) { - try { - Move ? lhs = std::move(rhs) - : lhs = rhs; - assert(false); - } catch (my_any_exception const &) { - // do nothing - } catch (...) { - assert(false); - } - }; - // const lvalue to empty - { - any lhs; - Tp rhs(1); - assert(Tp::count == 1); - - try_throw(lhs, rhs); - - assert(Tp::count == 1); - assertEmpty(lhs); - } - { - any lhs((small(2))); - Tp rhs(1); - assert(small::count == 1); - assert(Tp::count == 1); - - try_throw(lhs, rhs); - - assert(small::count == 1); - assert(Tp::count == 1); - assertContains(lhs, 2); - } - { - any lhs((large(2))); - Tp rhs(1); - assert(large::count == 1); - assert(Tp::count == 1); - - try_throw(lhs, rhs); - - assert(large::count == 1); - assert(Tp::count == 1); - assertContains(lhs, 2); - } -#endif -} - -int main() { - test_assign_value(); - test_assign_value(); - test_assign_value(); - test_assign_value(); - test_assign_value_empty(); - test_assign_value_empty(); - test_assign_throws(); - test_assign_throws(); - test_assign_throws(); -} diff --git a/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp b/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp deleted file mode 100644 index 7d2d33d63..000000000 --- a/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// any& operator=(Value &&); - -// Instantiate the value assignment operator with a non-copyable type. - -#include - -class non_copyable -{ - non_copyable(non_copyable const &); - -public: - non_copyable() {} - non_copyable(non_copyable &&) {} -}; - -int main() -{ - using namespace std::experimental; - non_copyable nc; - any a; - a = static_cast(nc); // expected-error-re@experimental/any:* 2 {{static_assert failed{{.*}} "_ValueType must be CopyConstructible."}} - // expected-error@experimental/any:* {{calling a private constructor of class 'non_copyable'}} - -} diff --git a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp deleted file mode 100644 index d477394c0..000000000 --- a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any(any const &); - -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; - -template -void test_copy_throws() { -#if !defined(TEST_HAS_NO_EXCEPTIONS) - assert(Type::count == 0); - { - any const a((Type(42))); - assert(Type::count == 1); - try { - any const a2(a); - assert(false); - } catch (my_any_exception const &) { - // do nothing - } catch (...) { - assert(false); - } - assert(Type::count == 1); - assertContains(a, 42); - } - assert(Type::count == 0); -#endif -} - -void test_copy_empty() { - DisableAllocationGuard g; ((void)g); // No allocations should occur. - any a1; - any a2(a1); - - assertEmpty(a1); - assertEmpty(a2); -} - -template -void test_copy() -{ - // Copying small types should not perform any allocations. - DisableAllocationGuard g(isSmallType()); ((void)g); - assert(Type::count == 0); - Type::reset(); - { - any a((Type(42))); - assert(Type::count == 1); - assert(Type::copied == 0); - - any a2(a); - - assert(Type::copied == 1); - assert(Type::count == 2); - assertContains(a, 42); - assertContains(a, 42); - - // Modify a and check that a2 is unchanged - modifyValue(a, -1); - assertContains(a, -1); - assertContains(a2, 42); - - // modify a2 and check that a is unchanged - modifyValue(a2, 999); - assertContains(a, -1); - assertContains(a2, 999); - - // clear a and check that a2 is unchanged - a.clear(); - assertEmpty(a); - assertContains(a2, 999); - } - assert(Type::count == 0); -} - -int main() { - test_copy(); - test_copy(); - test_copy_empty(); - test_copy_throws(); - test_copy_throws(); -} diff --git a/test/std/experimental/any/any.class/any.cons/default.pass.cpp b/test/std/experimental/any/any.class/any.cons/default.pass.cpp deleted file mode 100644 index 3839e3afc..000000000 --- a/test/std/experimental/any/any.class/any.cons/default.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// any() noexcept; - -#include -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" - - -int main() -{ - using std::experimental::any; - { - static_assert( - std::is_nothrow_default_constructible::value - , "Must be default constructible" - ); - } - { - DisableAllocationGuard g; ((void)g); - any const a; - assertEmpty(a); - } -} diff --git a/test/std/experimental/any/any.class/any.cons/move.pass.cpp b/test/std/experimental/any/any.class/any.cons/move.pass.cpp deleted file mode 100644 index ef980ca5f..000000000 --- a/test/std/experimental/any/any.class/any.cons/move.pass.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any(any &&) noexcept; - -#include -#include -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; - -// Moves are always noexcept. The throws_on_move object -// must be stored dynamically so the pointer is moved and -// not the stored object. -void test_move_does_not_throw() -{ -#if !defined(TEST_HAS_NO_EXCEPTIONS) - assert(throws_on_move::count == 0); - { - throws_on_move v(42); - any a(v); - assert(throws_on_move::count == 2); - // No allocations should be performed after this point. - DisableAllocationGuard g; ((void)g); - try { - any const a2(std::move(a)); - assertEmpty(a); - assertContains(a2, 42); - } catch (...) { - assert(false); - } - assert(throws_on_move::count == 1); - assertEmpty(a); - } - assert(throws_on_move::count == 0); -#endif -} - -void test_move_empty() { - DisableAllocationGuard g; ((void)g); // no allocations should be performed. - - any a1; - any a2(std::move(a1)); - - assertEmpty(a1); - assertEmpty(a2); -} - -template -void test_move() { - assert(Type::count == 0); - Type::reset(); - { - any a((Type(42))); - assert(Type::count == 1); - assert(Type::copied == 0); - assert(Type::moved == 1); - - // Moving should not perform allocations since it must be noexcept. - DisableAllocationGuard g; ((void)g); - - any a2(std::move(a)); - - assert(Type::moved >= 1); // zero or more move operations can be performed. - assert(Type::copied == 0); // no copies can be performed. - assert(Type::count == 1); - assertEmpty(a); // Moves are always destructive. - assertContains(a2, 42); - } - assert(Type::count == 0); -} - -int main() -{ - // noexcept test - { - static_assert( - std::is_nothrow_move_constructible::value - , "any must be nothrow move constructible" - ); - } - test_move(); - test_move(); - test_move_empty(); - test_move_does_not_throw(); -} diff --git a/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp b/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp deleted file mode 100644 index c4f7568ec..000000000 --- a/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// any::any(Value &&) - -// Attempt to construct any with a non-copyable type. - -#include - -class non_copyable -{ - non_copyable(non_copyable const &); - -public: - non_copyable() {} - non_copyable(non_copyable &&) {} -}; - -int main() -{ - using namespace std::experimental; - non_copyable nc; - any a(static_cast(nc)); - // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType must be CopyConstructible."}} - // expected-error@experimental/any:* 1 {{calling a private constructor of class 'non_copyable'}} -} diff --git a/test/std/experimental/any/any.class/any.cons/value.pass.cpp b/test/std/experimental/any/any.class/any.cons/value.pass.cpp deleted file mode 100644 index d37990e6c..000000000 --- a/test/std/experimental/any/any.class/any.cons/value.pass.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// template any(Value &&) - -// Test construction from a value. -// Concerns: -// --------- -// 1. The value is properly move/copied depending on the value category. -// 2. Both small and large values are properly handled. - - -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; - -template -void test_copy_value_throws() -{ -#if !defined(TEST_HAS_NO_EXCEPTIONS) - assert(Type::count == 0); - { - Type const t(42); - assert(Type::count == 1); - try { - any const a2(t); - assert(false); - } catch (my_any_exception const &) { - // do nothing - } catch (...) { - assert(false); - } - assert(Type::count == 1); - assert(t.value == 42); - } - assert(Type::count == 0); -#endif -} - -void test_move_value_throws() -{ -#if !defined(TEST_HAS_NO_EXCEPTIONS) - assert(throws_on_move::count == 0); - { - throws_on_move v; - assert(throws_on_move::count == 1); - try { - any const a(std::move(v)); - assert(false); - } catch (my_any_exception const &) { - // do nothing - } catch (...) { - assert(false); - } - assert(throws_on_move::count == 1); - } - assert(throws_on_move::count == 0); -#endif -} - -template -void test_copy_move_value() { - // constructing from a small type should perform no allocations. - DisableAllocationGuard g(isSmallType()); ((void)g); - assert(Type::count == 0); - Type::reset(); - { - Type t(42); - assert(Type::count == 1); - - any a(t); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::moved == 0); - assertContains(a, 42); - } - assert(Type::count == 0); - Type::reset(); - { - Type t(42); - assert(Type::count == 1); - - any a(std::move(t)); - - assert(Type::count == 2); - assert(Type::copied == 0); - assert(Type::moved == 1); - assertContains(a, 42); - } -} - - -int main() { - test_copy_move_value(); - test_copy_move_value(); - test_copy_value_throws(); - test_copy_value_throws(); - test_move_value_throws(); -} diff --git a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp deleted file mode 100644 index a19bd38f1..000000000 --- a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any::clear() noexcept - -#include -#include - -#include "experimental_any_helpers.h" - -int main() -{ - using std::experimental::any; - using std::experimental::any_cast; - // empty - { - any a; - - // noexcept check - static_assert( - noexcept(a.clear()) - , "any.clear() must be noexcept" - ); - - assertEmpty(a); - - a.clear(); - - assertEmpty(a); - } - // small object - { - any a((small(1))); - assert(small::count == 1); - assertContains(a, 1); - - a.clear(); - - assertEmpty(a); - assert(small::count == 0); - } - // large object - { - any a(large(1)); - assert(large::count == 1); - assertContains(a); - - a.clear(); - - assertEmpty(a); - assert(large::count == 0); - } -} diff --git a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp deleted file mode 100644 index 8de582a6b..000000000 --- a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// any::swap(any &) noexcept - -// Test swap(large, small) and swap(small, large) - -#include -#include - -#include "experimental_any_helpers.h" - -using std::experimental::any; -using std::experimental::any_cast; - -template -void test_swap() { - assert(LHS::count == 0); - assert(RHS::count == 0); - { - any a1((LHS(1))); - any a2(RHS{2}); - assert(LHS::count == 1); - assert(RHS::count == 1); - - a1.swap(a2); - - assert(LHS::count == 1); - assert(RHS::count == 1); - - assertContains(a1, 2); - assertContains(a2, 1); - } - assert(LHS::count == 0); - assert(RHS::count == 0); - assert(LHS::copied == 0); - assert(RHS::copied == 0); -} - -template -void test_swap_empty() { - assert(Tp::count == 0); - { - any a1((Tp(1))); - any a2; - assert(Tp::count == 1); - - a1.swap(a2); - - assert(Tp::count == 1); - - assertContains(a2, 1); - assertEmpty(a1); - } - assert(Tp::count == 0); - { - any a1((Tp(1))); - any a2; - assert(Tp::count == 1); - - a2.swap(a1); - - assert(Tp::count == 1); - - assertContains(a2, 1); - assertEmpty(a1); - } - assert(Tp::count == 0); - assert(Tp::copied == 0); -} - -void test_noexcept() -{ - any a1; - any a2; - static_assert( - noexcept(a1.swap(a2)) - , "any::swap(any&) must be noexcept" - ); -} - -int main() -{ - test_noexcept(); - test_swap_empty(); - test_swap_empty(); - test_swap(); - test_swap(); - test_swap(); - test_swap(); -} diff --git a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp b/test/std/experimental/any/any.class/any.observers/empty.pass.cpp deleted file mode 100644 index bdf0d511b..000000000 --- a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// any::empty() noexcept - -#include -#include - -#include "experimental_any_helpers.h" - -int main() -{ - using std::experimental::any; - // noexcept test - { - any a; - static_assert(noexcept(a.empty()), "any::empty() must be noexcept"); - } - // empty - { - any a; - assert(a.empty()); - - a.clear(); - assert(a.empty()); - - a = 42; - assert(!a.empty()); - } - // small object - { - small const s(1); - any a(s); - assert(!a.empty()); - - a.clear(); - assert(a.empty()); - - a = s; - assert(!a.empty()); - } - // large object - { - large const l(1); - any a(l); - assert(!a.empty()); - - a.clear(); - assert(a.empty()); - - a = l; - assert(!a.empty()); - } -} diff --git a/test/std/experimental/any/any.class/any.observers/type.pass.cpp b/test/std/experimental/any/any.class/any.observers/type.pass.cpp deleted file mode 100644 index 6d0048403..000000000 --- a/test/std/experimental/any/any.class/any.observers/type.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: libcpp-no-rtti - -// - -// any::type() noexcept - -#include -#include -#include "experimental_any_helpers.h" - -int main() -{ - using std::experimental::any; - { - any const a; - assert(a.type() == typeid(void)); - static_assert(noexcept(a.type()), "any::type() must be noexcept"); - } - { - small const s(1); - any const a(s); - assert(a.type() == typeid(small)); - - } - { - large const l(1); - any const a(l); - assert(a.type() == typeid(large)); - } -} diff --git a/test/std/experimental/any/any.class/nothing_to_do.pass.cpp b/test/std/experimental/any/any.class/nothing_to_do.pass.cpp deleted file mode 100644 index c21f8a701..000000000 --- a/test/std/experimental/any/any.class/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -int main () {} diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp deleted file mode 100644 index 46ddbe5b0..000000000 --- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// ValueType const* any_cast(any const *) noexcept; -// -// template -// ValueType * any_cast(any *) noexcept; - -#include -#include -#include - -#include "experimental_any_helpers.h" - -using std::experimental::any; -using std::experimental::any_cast; - -// Test that the operators are properly noexcept. -void test_cast_is_noexcept() { - any a; - static_assert(noexcept(any_cast(&a)), ""); - - any const& ca = a; - static_assert(noexcept(any_cast(&ca)), ""); -} - -// Test that the return type of any_cast is correct. -void test_cast_return_type() { - any a; - static_assert(std::is_same(&a)), int*>::value, ""); - static_assert(std::is_same(&a)), int const*>::value, ""); - - any const& ca = a; - static_assert(std::is_same(&ca)), int const*>::value, ""); - static_assert(std::is_same(&ca)), int const*>::value, ""); -} - -// Test that any_cast handles null pointers. -void test_cast_nullptr() { - any* a = nullptr; - assert(nullptr == any_cast(a)); - assert(nullptr == any_cast(a)); - - any const* ca = nullptr; - assert(nullptr == any_cast(ca)); - assert(nullptr == any_cast(ca)); -} - -// Test casting an empty object. -void test_cast_empty() { - { - any a; - assert(nullptr == any_cast(&a)); - assert(nullptr == any_cast(&a)); - - any const& ca = a; - assert(nullptr == any_cast(&ca)); - assert(nullptr == any_cast(&ca)); - } - // Create as non-empty, then make empty and run test. - { - any a(42); - a.clear(); - assert(nullptr == any_cast(&a)); - assert(nullptr == any_cast(&a)); - - any const& ca = a; - assert(nullptr == any_cast(&ca)); - assert(nullptr == any_cast(&ca)); - } -} - -template -void test_cast() { - assert(Type::count == 0); - Type::reset(); - { - any a((Type(42))); - any const& ca = a; - assert(Type::count == 1); - assert(Type::copied == 0); - assert(Type::moved == 1); - - // Try a cast to a bad type. - // NOTE: Type cannot be an int. - assert(any_cast(&a) == nullptr); - assert(any_cast(&a) == nullptr); - assert(any_cast(&a) == nullptr); - - // Try a cast to the right type, but as a pointer. - assert(any_cast(&a) == nullptr); - assert(any_cast(&a) == nullptr); - - // Check getting a unqualified type from a non-const any. - Type* v = any_cast(&a); - assert(v != nullptr); - assert(v->value == 42); - - // change the stored value and later check for the new value. - v->value = 999; - - // Check getting a const qualified type from a non-const any. - Type const* cv = any_cast(&a); - assert(cv != nullptr); - assert(cv == v); - assert(cv->value == 999); - - // Check getting a unqualified type from a const any. - cv = any_cast(&ca); - assert(cv != nullptr); - assert(cv == v); - assert(cv->value == 999); - - // Check getting a const-qualified type from a const any. - cv = any_cast(&ca); - assert(cv != nullptr); - assert(cv == v); - assert(cv->value == 999); - - // Check that no more objects were created, copied or moved. - assert(Type::count == 1); - assert(Type::copied == 0); - assert(Type::moved == 1); - } - assert(Type::count == 0); -} - -int main() { - test_cast_is_noexcept(); - test_cast_return_type(); - test_cast_nullptr(); - test_cast_empty(); - test_cast(); - test_cast(); -} diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp deleted file mode 100644 index ca6d1de11..000000000 --- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp +++ /dev/null @@ -1,312 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx - -// - -// template -// ValueType const any_cast(any const&); -// -// template -// ValueType any_cast(any &); -// -// template -// ValueType any_cast(any &&); - -#include -#include -#include - -#include "experimental_any_helpers.h" -#include "count_new.hpp" -#include "test_macros.h" - -using std::experimental::any; -using std::experimental::any_cast; -using std::experimental::bad_any_cast; - - -// Test that the operators are NOT marked noexcept. -void test_cast_is_not_noexcept() { - any a; - static_assert(!noexcept(any_cast(static_cast(a))), ""); - static_assert(!noexcept(any_cast(static_cast(a))), ""); - static_assert(!noexcept(any_cast(static_cast(a))), ""); -} - -// Test that the return type of any_cast is correct. -void test_cast_return_type() { - any a; - static_assert(std::is_same(a)), int>::value, ""); - static_assert(std::is_same(a)), int>::value, ""); - static_assert(std::is_same(a)), int&>::value, ""); - static_assert(std::is_same(a)), int const&>::value, ""); - - //static_assert(std::is_same(a)), int&&>::value, ""); - //static_assert(std::is_same(a)), int const&&>::value, ""); - - static_assert(std::is_same(std::move(a))), int>::value, ""); - static_assert(std::is_same(std::move(a))), int>::value, ""); - static_assert(std::is_same(std::move(a))), int&>::value, ""); - static_assert(std::is_same(std::move(a))), int const&>::value, ""); - - //static_assert(std::is_same(std::move(a))), int&&>::value, ""); - //static_assert(std::is_same(std::move(a))), int const&&>::value, ""); - - any const& ca = a; - static_assert(std::is_same(ca)), int>::value, ""); - static_assert(std::is_same(ca)), int>::value, ""); - static_assert(std::is_same(ca)), int const&>::value, ""); - - //static_assert(std::is_same(ca)), int const&&>::value, ""); -} - -template -void checkThrows(any& a) -{ -#if !defined(TEST_HAS_NO_EXCEPTIONS) - try { - any_cast(a); - assert(false); - } catch (bad_any_cast const &) { - // do nothing - } catch (...) { - assert(false); - } - - try { - any_cast(static_cast(a)); - assert(false); - } catch (bad_any_cast const &) { - // do nothing - } catch (...) { - assert(false); - } - - try { - any_cast(static_cast(a)); - assert(false); - } catch (bad_any_cast const &) { - // do nothing - } catch (...) { - assert(false); - } -#else - ((void)a); -#endif -} - -void test_cast_empty() { - // None of these operations should allocate. - DisableAllocationGuard g; ((void)g); - any a; - checkThrows(a); -} - -template -void test_cast_to_reference() { - assert(Type::count == 0); - Type::reset(); - { - any a((Type(42))); - any const& ca = a; - assert(Type::count == 1); - assert(Type::copied == 0); - assert(Type::moved == 1); - - // Try a cast to a bad type. - // NOTE: Type cannot be an int. - checkThrows(a); - checkThrows(a); - checkThrows(a); - checkThrows(a); - - // Check getting a type by reference from a non-const lvalue any. - { - Type& v = any_cast(a); - assert(v.value == 42); - - Type const &cv = any_cast(a); - assert(&cv == &v); - } - // Check getting a type by reference from a const lvalue any. - { - Type const& v = any_cast(ca); - assert(v.value == 42); - - Type const &cv = any_cast(ca); - assert(&cv == &v); - } - // Check getting a type by reference from a non-const rvalue - { - Type& v = any_cast(std::move(a)); - assert(v.value == 42); - - Type const &cv = any_cast(std::move(a)); - assert(&cv == &v); - } - // Check getting a type by reference from a const rvalue any. - { - Type const& v = any_cast(std::move(ca)); - assert(v.value == 42); - - Type const &cv = any_cast(std::move(ca)); - assert(&cv == &v); - } - - // Check that the original object hasn't been changed. - assertContains(a, 42); - - // Check that no objects have been created/copied/moved. - assert(Type::count == 1); - assert(Type::copied == 0); - assert(Type::moved == 1); - } - assert(Type::count == 0); -} - -template -void test_cast_to_value() { - assert(Type::count == 0); - Type::reset(); - { - any a((Type(42))); - assert(Type::count == 1); - assert(Type::copied == 0); - assert(Type::moved == 1); - - // Try a cast to a bad type. - // NOTE: Type cannot be an int. - checkThrows(a); - checkThrows(a); - checkThrows(a); - checkThrows(a); - - Type::reset(); // NOTE: reset does not modify Type::count - // Check getting Type by value from a non-const lvalue any. - // This should cause the non-const copy constructor to be called. - { - Type t = any_cast(a); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::const_copied == 0); - assert(Type::non_const_copied == 1); - assert(Type::moved == 0); - assert(t.value == 42); - } - assert(Type::count == 1); - Type::reset(); - // Check getting const Type by value from a non-const lvalue any. - // This should cause the const copy constructor to be called. - { - Type t = any_cast(a); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::const_copied == 1); - assert(Type::non_const_copied == 0); - assert(Type::moved == 0); - assert(t.value == 42); - } - assert(Type::count == 1); - Type::reset(); - // Check getting Type by value from a non-const lvalue any. - // This should cause the const copy constructor to be called. - { - Type t = any_cast(static_cast(a)); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::const_copied == 1); - assert(Type::non_const_copied == 0); - assert(Type::moved == 0); - assert(t.value == 42); - } - assert(Type::count == 1); - Type::reset(); - // Check getting Type by value from a non-const rvalue any. - // This should cause the non-const copy constructor to be called. - { - Type t = any_cast(static_cast(a)); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::const_copied == 0); - assert(Type::non_const_copied == 1); - assert(Type::moved == 0); - assert(t.value == 42); - } - assert(Type::count == 1); - Type::reset(); - // Check getting const Type by value from a non-const rvalue any. - // This should cause the const copy constructor to be called. - { - Type t = any_cast(static_cast(a)); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::const_copied == 1); - assert(Type::non_const_copied == 0); - assert(Type::moved == 0); - assert(t.value == 42); - } - assert(Type::count == 1); - Type::reset(); - // Check getting Type by value from a const rvalue any. - // This should cause the const copy constructor to be called. - { - Type t = any_cast(static_cast(a)); - - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::const_copied == 1); - assert(Type::non_const_copied == 0); - assert(Type::moved == 0); - assert(t.value == 42); - } - // Ensure we still only have 1 Type object alive. - assert(Type::count == 1); - - // Check that the original object hasn't been changed. - assertContains(a, 42); - } - assert(Type::count == 0); -} - -// Even though you can't get a non-copyable class into std::any -// the standard requires that these overloads compile and function. -void test_non_copyable_ref() { - struct no_copy - { - no_copy() {} - no_copy(no_copy &&) {} - private: - no_copy(no_copy const &); - }; - - any a; - checkThrows(a); - checkThrows(a); - assertEmpty(a); -} - -int main() { - test_cast_is_not_noexcept(); - test_cast_return_type(); - test_cast_empty(); - test_cast_to_reference(); - test_cast_to_reference(); - test_cast_to_value(); - test_cast_to_value(); - test_non_copyable_ref(); -} diff --git a/test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp deleted file mode 100644 index db5149265..000000000 --- a/test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// ValueType any_cast(any const &); - -// Try and cast away const. - -#include - -struct TestType {}; -struct TestType2 {}; - -int main() -{ - using std::experimental::any; - using std::experimental::any_cast; - - any a; - - // expected-error@experimental/any:* 2 {{binding value of type '_Tp' (aka 'const TestType') to reference to type 'TestType' drops 'const' qualifier}} - any_cast(static_cast(a)); // expected-note {{requested here}} - any_cast(static_cast(a)); // expected-note {{requested here}} - - // expected-error@experimental/any:* 2 {{binding value of type '_Tp' (aka 'const TestType2') to reference to type 'TestType2' drops 'const' qualifier}} - any_cast(static_cast(a)); // expected-note {{requested here}} - any_cast(static_cast(a)); // expected-note {{requested here}} -} diff --git a/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp deleted file mode 100644 index 1c52a64fc..000000000 --- a/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// ValueType const any_cast(any const&); -// -// template -// ValueType any_cast(any &); -// -// template -// ValueType any_cast(any &&); - -// Test instantiating the any_cast with a non-copyable type. - -#include - -using std::experimental::any; -using std::experimental::any_cast; - -struct no_copy -{ - no_copy() {} - no_copy(no_copy &&) {} -private: - no_copy(no_copy const &); -}; - -int main() { - any a; - any_cast(static_cast(a)); - any_cast(static_cast(a)); - any_cast(static_cast(a)); - // expected-error@experimental/any:* 3 {{static_assert failed "_ValueType is required to be a reference or a CopyConstructible type."}} - // expected-error@experimental/any:* 3 {{calling a private constructor of class 'no_copy'}} -} diff --git a/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp deleted file mode 100644 index edef3d0a4..000000000 --- a/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// ValueType const* any_cast(any const *) noexcept; -// -// template -// ValueType * any_cast(any *) noexcept; - -#include - -using std::experimental::any; -using std::experimental::any_cast; - -int main() -{ - any a(1); - any_cast(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any_cast(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any_cast(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any_cast(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any const& a2 = a; - any_cast(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any_cast(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any_cast(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} - any_cast(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}} -} diff --git a/test/std/experimental/any/any.nonmembers/swap.pass.cpp b/test/std/experimental/any/any.nonmembers/swap.pass.cpp deleted file mode 100644 index e79bc9ef0..000000000 --- a/test/std/experimental/any/any.nonmembers/swap.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// void swap(any &, any &) noexcept - -// swap(...) just wraps any::swap(...). That function is tested elsewhere. - -#include -#include - -using std::experimental::any; -using std::experimental::any_cast; - -int main() -{ - - { // test noexcept - any a; - static_assert(noexcept(swap(a, a)), "swap(any&, any&) must be noexcept"); - } - { - any a1(1); - any a2(2); - - swap(a1, a2); - - // Support testing against system dylibs that don't have bad_any_cast. - assert(*any_cast(&a1) == 2); - assert(*any_cast(&a2) == 1); - } -} From 14698bce22e90509622b19901a5d4fb232adafca Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Feb 2018 15:49:27 +0000 Subject: [PATCH 0321/1520] Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323975 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/numeric | 110 +------------- include/module.modulemap | 4 - test/libcxx/double_include.sh.cpp | 1 - test/libcxx/min_max_macros.sh.cpp | 2 - .../nothing_to_do.pass.cpp | 15 -- .../numeric.ops/nothing_to_do.pass.cpp | 15 -- .../numeric.ops.gcd/gcd.bool1.fail.cpp | 25 ---- .../numeric.ops.gcd/gcd.bool2.fail.cpp | 25 ---- .../numeric.ops.gcd/gcd.bool3.fail.cpp | 25 ---- .../numeric.ops.gcd/gcd.bool4.fail.cpp | 25 ---- .../gcd.not_integral1.fail.cpp | 24 --- .../gcd.not_integral2.fail.cpp | 24 --- .../numeric.ops/numeric.ops.gcd/gcd.pass.cpp | 139 ------------------ .../numeric.ops.lcm/lcm.bool1.fail.cpp | 25 ---- .../numeric.ops.lcm/lcm.bool2.fail.cpp | 25 ---- .../numeric.ops.lcm/lcm.bool3.fail.cpp | 25 ---- .../numeric.ops.lcm/lcm.bool4.fail.cpp | 25 ---- .../lcm.not_integral1.fail.cpp | 24 --- .../lcm.not_integral2.fail.cpp | 24 --- .../numeric.ops/numeric.ops.lcm/lcm.pass.cpp | 139 ------------------ 20 files changed, 1 insertion(+), 720 deletions(-) delete mode 100644 test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp delete mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp diff --git a/include/experimental/numeric b/include/experimental/numeric index d784c08f0..14a664011 100644 --- a/include/experimental/numeric +++ b/include/experimental/numeric @@ -8,112 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_NUMERIC -#define _LIBCPP_EXPERIMENTAL_NUMERIC -/* - experimental/numeric synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v2 { - - // 13.1.2, Greatest common divisor - template - constexpr common_type_t gcd(M m, N n); - - // 13.1.3, Least common multiple - template - constexpr common_type_t lcm(M m, N n); - -} // namespace fundamentals_v2 -} // namespace experimental -} // namespace std - - */ - -#include -#include -#include // is_integral -#include // numeric_limits - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -#if _LIBCPP_STD_VER > 11 - -_LIBCPP_BEGIN_NAMESPACE_LFTS_V2 - -template ::value> struct __abs; - -template -struct __abs<_Result, _Source, true> { - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - _Result operator()(_Source __t) const noexcept - { - if (__t >= 0) return __t; - if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t); - return -__t; - } -}; - -template -struct __abs<_Result, _Source, false> { - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - _Result operator()(_Source __t) const noexcept { return __t; } -}; - - -template -_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN -inline _Tp __gcd(_Tp __m, _Tp __n) -{ - static_assert((!is_signed<_Tp>::value), "" ); - return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n); -} - - -template -_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY -common_type_t<_Tp,_Up> -gcd(_Tp __m, _Up __n) -{ - static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types"); - static_assert((!is_same::type, bool>::value), "First argument to gcd cannot be bool" ); - static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); - using _Rp = common_type_t<_Tp,_Up>; - using _Wp = make_unsigned_t<_Rp>; - return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd( - static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), - static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); -} - -template -_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY -common_type_t<_Tp,_Up> -lcm(_Tp __m, _Up __n) -{ - static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types"); - static_assert((!is_same::type, bool>::value), "First argument to lcm cannot be bool" ); - static_assert((!is_same::type, bool>::value), "Second argument to lcm cannot be bool" ); - if (__m == 0 || __n == 0) - return 0; - - using _Rp = common_type_t<_Tp,_Up>; - _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n); - _Rp __val2 = __abs<_Rp, _Up>()(__n); - _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); - return __val1 * __val2; -} - -_LIBCPP_END_NAMESPACE_LFTS_V2 - -#endif /* _LIBCPP_STD_VER > 11 */ - -_LIBCPP_POP_MACROS - -#endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */ +#error " has been removed. Use instead." diff --git a/include/module.modulemap b/include/module.modulemap index d25e61907..808ca9896 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -538,10 +538,6 @@ module std [system] { header "experimental/memory_resource" export * } - module numeric { - header "experimental/numeric" - export * - } module propagate_const { header "experimental/propagate_const" export * diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index 60a574a82..32616335d 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -148,7 +148,6 @@ #include #include #include -#include #include #include #include diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp index 7411ca2b3..fdb3f1621 100644 --- a/test/libcxx/min_max_macros.sh.cpp +++ b/test/libcxx/min_max_macros.sh.cpp @@ -257,8 +257,6 @@ TEST_MACROS(); TEST_MACROS(); #include TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include diff --git a/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp b/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp deleted file mode 100644 index 7b2527f22..000000000 --- a/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -int main () {} diff --git a/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp b/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp deleted file mode 100644 index 7b2527f22..000000000 --- a/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -int main () {} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp deleted file mode 100644 index c8d6c5367..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::gcd(false, 4); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp deleted file mode 100644 index a3a2206fb..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::gcd(2, true); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp deleted file mode 100644 index 1f04580dd..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::gcd(false, 4); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp deleted file mode 100644 index 1f0e8a2b3..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::gcd(2, true); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp deleted file mode 100644 index 8b069832a..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::gcd(2.0, 4); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp deleted file mode 100644 index ca9b871ef..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::gcd(4, 6.0); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp deleted file mode 100644 index 3f86cfe4c..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp +++ /dev/null @@ -1,139 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -#include -#include -#include // for rand() -#include - -constexpr struct { - int x; - int y; - int expect; -} Cases[] = { - {0, 0, 0}, - {1, 0, 1}, - {0, 1, 1}, - {1, 1, 1}, - {2, 3, 1}, - {2, 4, 2}, - {36, 17, 1}, - {36, 18, 18} -}; - - -template -constexpr bool test0(Input1 in1, Input2 in2, Output out) -{ - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); - return out == std::experimental::gcd(in1, in2) ? true : (std::abort(), false); -} - - -template -constexpr bool do_test(int = 0) -{ - using S1 = typename std::make_signed::type; - using S2 = typename std::make_signed::type; - using U1 = typename std::make_unsigned::type; - using U2 = typename std::make_unsigned::type; - bool accumulate = true; - for (auto TC : Cases) { - { // Test with two signed types - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - accumulate &= test0(-TC.x, -TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - accumulate &= test0(-TC.x, -TC.y, TC.expect); - } - { // test with two unsigned types - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - } - { // Test with mixed signs - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - } - { // Test with mixed signs - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - } - } - return accumulate; -} - -int main() -{ - auto non_cce = std::rand(); // a value that can't possibly be constexpr - - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - - static_assert(do_test< int8_t>(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - - assert(do_test< int8_t>(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - -// LWG#2792 - { - auto res = std::experimental::gcd((int64_t)1234, (int32_t)-2147483648); - static_assert( std::is_same::type>::value, ""); - assert(res == 2); - } -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp deleted file mode 100644 index e4c2ed8bf..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::lcm(false, 4); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp deleted file mode 100644 index 097b23eae..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::lcm(2, true); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp deleted file mode 100644 index d5e630081..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::lcm(false, 4); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp deleted file mode 100644 index d88c490d6..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, -// or if either is (a possibly cv-qualified) bool, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::lcm(2, true); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp deleted file mode 100644 index d12b35609..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::lcm(2.0, 4); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp deleted file mode 100644 index d5731870e..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) - -// Remarks: If either M or N is not an integer type, the program is ill-formed. - -#include - - -int main() -{ - std::experimental::lcm(4, 6.0); -} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp deleted file mode 100644 index 211363aea..000000000 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp +++ /dev/null @@ -1,139 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) - -#include -#include -#include -#include - -constexpr struct { - int x; - int y; - int expect; -} Cases[] = { - {0, 0, 0}, - {1, 0, 0}, - {0, 1, 0}, - {1, 1, 1}, - {2, 3, 6}, - {2, 4, 4}, - {3, 17, 51}, - {36, 18, 36} -}; - -template -constexpr bool test0(Input1 in1, Input2 in2, Output out) -{ - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); - return out == std::experimental::lcm(in1, in2) ? true : (std::abort(), false); -} - - -template -constexpr bool do_test(int = 0) -{ - using S1 = typename std::make_signed::type; - using S2 = typename std::make_signed::type; - using U1 = typename std::make_unsigned::type; - using U2 = typename std::make_unsigned::type; - bool accumulate = true; - for (auto TC : Cases) { - { // Test with two signed types - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - accumulate &= test0(-TC.x, -TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - accumulate &= test0(-TC.x, -TC.y, TC.expect); - } - { // test with two unsigned types - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - } - { // Test with mixed signs - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - } - { // Test with mixed signs - using Output = std::common_type_t; - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, TC.y, TC.expect); - accumulate &= test0(-TC.x, TC.y, TC.expect); - accumulate &= test0(TC.x, -TC.y, TC.expect); - } - } - return accumulate; -} - -int main() -{ - auto non_cce = std::rand(); // a value that can't possibly be constexpr - - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - - static_assert(do_test< int8_t>(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - - assert(do_test< int8_t>(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - assert((do_test(non_cce))); - -// LWG#2792 - { - auto res1 = std::experimental::lcm((int64_t)1234, (int32_t)-2147483648); - (void) std::experimental::lcm(INT_MIN, 2); // this used to trigger UBSAN - static_assert( std::is_same::type>::value, ""); - assert(res1 == 1324997410816LL); - } -} From b21316f66c189c9a3aa6708f023bc36751b519c9 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Feb 2018 16:36:08 +0000 Subject: [PATCH 0322/1520] Remove std::experimental::sample; use std::sample instead. See https://libcxx.llvm.org/TS_deprecation.html git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323979 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/algorithm | 17 +- .../alg.random.sample/sample.fail.cpp | 41 ----- .../alg.random.sample/sample.pass.cpp | 150 ------------------ .../alg.random.sample/sample.stable.pass.cpp | 53 ------- 4 files changed, 2 insertions(+), 259 deletions(-) delete mode 100644 test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp delete mode 100644 test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp delete mode 100644 test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp diff --git a/include/experimental/algorithm b/include/experimental/algorithm index a6a28f071..eb3bad6ef 100644 --- a/include/experimental/algorithm +++ b/include/experimental/algorithm @@ -23,11 +23,8 @@ inline namespace fundamentals_v1 { template ForwardIterator search(ForwardIterator first, ForwardIterator last, const Searcher &searcher); -template -SampleIterator sample(PopulationIterator first, PopulationIterator last, - SampleIterator out, Distance n, - UniformRandomNumberGenerator &&g); + +// sample removed because it's now part of C++17 } // namespace fundamentals_v1 } // namespace experimental @@ -56,16 +53,6 @@ _LIBCPP_INLINE_VISIBILITY _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s) { return __s(__f, __l).first; } - -template -inline _LIBCPP_INLINE_VISIBILITY -_SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last, - _SampleIterator __output_iter, _Distance __n, - _UniformRandomNumberGenerator &&__g) { - return _VSTD::__sample(__first, __last, __output_iter, __n, __g); -} - _LIBCPP_END_NAMESPACE_LFTS _LIBCPP_POP_MACROS diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp deleted file mode 100644 index 85ff8e15d..000000000 --- a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// - -// template -// SampleIterator sample(PopulationIterator first, PopulationIterator last, -// SampleIterator out, Distance n, -// UniformRandomNumberGenerator &&g); - -#include -#include -#include - -#include "test_iterators.h" - -template void test() { - int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - const unsigned is = sizeof(ia) / sizeof(ia[0]); - const unsigned os = 4; - int oa[os]; - std::minstd_rand g; - std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), - SampleIterator(oa), os, g); -} - -int main() { - // expected-error@algorithm:* {{static_assert failed "SampleIterator must meet the requirements of RandomAccessIterator"}} - // expected-error@algorithm:* 2 {{does not provide a subscript operator}} - // expected-error@algorithm:* {{invalid operands}} - test, output_iterator >(); -} diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp deleted file mode 100644 index 23098d83e..000000000 --- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp +++ /dev/null @@ -1,150 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// SampleIterator sample(PopulationIterator first, PopulationIterator last, -// SampleIterator out, Distance n, -// UniformRandomNumberGenerator &&g); - -#include -#include -#include - -#include "test_iterators.h" - -struct ReservoirSampleExpectations { - enum { os = 4 }; - static int oa1[os]; - static int oa2[os]; -}; - -int ReservoirSampleExpectations::oa1[] = {10, 5, 9, 4}; -int ReservoirSampleExpectations::oa2[] = {5, 2, 10, 4}; - -struct SelectionSampleExpectations { - enum { os = 4 }; - static int oa1[os]; - static int oa2[os]; -}; - -int SelectionSampleExpectations::oa1[] = {1, 4, 6, 7}; -int SelectionSampleExpectations::oa2[] = {1, 2, 6, 8}; - -template struct TestExpectations - : public SelectionSampleExpectations {}; - -template <> -struct TestExpectations - : public ReservoirSampleExpectations {}; - -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> -void test() { - typedef PopulationIteratorType PopulationIterator; - typedef SampleIteratorType SampleIterator; - PopulationItem ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - const unsigned is = sizeof(ia) / sizeof(ia[0]); - typedef TestExpectations::iterator_category> Expectations; - const unsigned os = Expectations::os; - SampleItem oa[os]; - const int *oa1 = Expectations::oa1; - ((void)oa1); // Prevent unused warning - const int *oa2 = Expectations::oa2; - ((void)oa2); // Prevent unused warning - std::minstd_rand g; - SampleIterator end; - end = std::experimental::sample(PopulationIterator(ia), - PopulationIterator(ia + is), - SampleIterator(oa), os, g); - assert(static_cast(end.base() - oa) == std::min(os, is)); - // sample() is deterministic but non-reproducible; - // its results can vary between implementations. - LIBCPP_ASSERT(std::equal(oa, oa + os, oa1)); - end = std::experimental::sample(PopulationIterator(ia), - PopulationIterator(ia + is), - SampleIterator(oa), os, std::move(g)); - assert(static_cast(end.base() - oa) == std::min(os, is)); - LIBCPP_ASSERT(std::equal(oa, oa + os, oa2)); -} - -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> -void test_empty_population() { - typedef PopulationIteratorType PopulationIterator; - typedef SampleIteratorType SampleIterator; - PopulationItem ia[] = {42}; - const unsigned os = 4; - SampleItem oa[os]; - std::minstd_rand g; - SampleIterator end = - std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia), - SampleIterator(oa), os, g); - assert(end.base() == oa); -} - -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> -void test_empty_sample() { - typedef PopulationIteratorType PopulationIterator; - typedef SampleIteratorType SampleIterator; - PopulationItem ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - const unsigned is = sizeof(ia) / sizeof(ia[0]); - SampleItem oa[1]; - std::minstd_rand g; - SampleIterator end = - std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), - SampleIterator(oa), 0, g); - assert(end.base() == oa); -} - -template class PopulationIteratorType, class PopulationItem, - template class SampleIteratorType, class SampleItem> -void test_small_population() { - // The population size is less than the sample size. - typedef PopulationIteratorType PopulationIterator; - typedef SampleIteratorType SampleIterator; - PopulationItem ia[] = {1, 2, 3, 4, 5}; - const unsigned is = sizeof(ia) / sizeof(ia[0]); - const unsigned os = 8; - SampleItem oa[os]; - const SampleItem oa1[] = {1, 2, 3, 4, 5}; - std::minstd_rand g; - SampleIterator end; - end = std::experimental::sample(PopulationIterator(ia), - PopulationIterator(ia + is), - SampleIterator(oa), os, g); - assert(static_cast(end.base() - oa) == std::min(os, is)); - assert(std::equal(oa, end.base(), oa1)); -} - -int main() { - test(); - test(); - test(); - - test(); - test(); - test(); - - test_empty_population(); - test_empty_population(); - test_empty_population(); - - test_empty_sample(); - test_empty_sample(); - test_empty_sample(); - - test_small_population(); - test_small_population(); - test_small_population(); -} diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp deleted file mode 100644 index c805c66fa..000000000 --- a/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// SampleIterator sample(PopulationIterator first, PopulationIterator last, -// SampleIterator out, Distance n, -// UniformRandomNumberGenerator &&g); - -#include -#include -#include - -#include "test_iterators.h" - -// Stable if and only if PopulationIterator meets the requirements of a -// ForwardIterator type. -template -void test_stability(bool expect_stable) { - const unsigned kPopulationSize = 100; - int ia[kPopulationSize]; - for (unsigned i = 0; i < kPopulationSize; ++i) - ia[i] = i; - PopulationIterator first(ia); - PopulationIterator last(ia + kPopulationSize); - - const unsigned kSampleSize = 20; - int oa[kPopulationSize]; - SampleIterator out(oa); - - std::minstd_rand g; - - const int kIterations = 1000; - bool unstable = false; - for (int i = 0; i < kIterations; ++i) { - std::experimental::sample(first, last, out, kSampleSize, g); - unstable |= !std::is_sorted(oa, oa + kSampleSize); - } - assert(expect_stable == !unstable); -} - -int main() { - test_stability, output_iterator >(true); - test_stability, random_access_iterator >(false); -} From fd34566e5a7e445284da398a2c8db5be542dfca6 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Feb 2018 18:45:57 +0000 Subject: [PATCH 0323/1520] Put the exception classes for experimental::optional and experimental::any back in the dylib for binary compatibility git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323989 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/any.cpp | 19 +++++++++++++++++++ src/optional.cpp | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/any.cpp b/src/any.cpp index 968552029..3795258bb 100644 --- a/src/any.cpp +++ b/src/any.cpp @@ -14,3 +14,22 @@ const char* bad_any_cast::what() const _NOEXCEPT { return "bad any cast"; } } + + +#include + +// Preserve std::experimental::any_bad_cast for ABI compatibility +// Even though it no longer exists in a header file +_LIBCPP_BEGIN_NAMESPACE_LFTS + +class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast +{ +public: + virtual const char* what() const _NOEXCEPT; +}; + +const char* bad_any_cast::what() const _NOEXCEPT { + return "bad any cast"; +} + +_LIBCPP_END_NAMESPACE_LFTS diff --git a/src/optional.cpp b/src/optional.cpp index 6444987bf..6099b6b41 100644 --- a/src/optional.cpp +++ b/src/optional.cpp @@ -20,3 +20,23 @@ const char* bad_optional_access::what() const _NOEXCEPT { } // std + +#include + +// Preserve std::experimental::bad_optional_access for ABI compatibility +// Even though it no longer exists in a header file +_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL + +class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access + : public std::logic_error +{ +public: + bad_optional_access() : std::logic_error("Bad optional Access") {} + +// Get the key function ~bad_optional_access() into the dylib + virtual ~bad_optional_access() _NOEXCEPT; +}; + +bad_optional_access::~bad_optional_access() _NOEXCEPT = default; + +_LIBCPP_END_NAMESPACE_EXPERIMENTAL From dfb13510775958083bcc7a842a90025b76f325a1 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 1 Feb 2018 22:24:45 +0000 Subject: [PATCH 0324/1520] Make std::get_temporary_buffer respect overaligned types when possible Patch by Chris Kennelly! Differential Revision: https://reviews.llvm.org/D41746 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324020 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/memory | 49 ++++++++++++++++++- .../temporary.buffer/overaligned.pass.cpp | 33 +++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp diff --git a/include/memory b/include/memory index 22737314d..2d9d75f99 100644 --- a/include/memory +++ b/include/memory @@ -2004,7 +2004,38 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT __n = __m; while (__n > 0) { +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) +#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) + if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) +#else + if (std::alignment_of<_Tp>::value > + std::alignment_of::value) +#endif + { + std::align_val_t __al = + std::align_val_t(std::alignment_of<_Tp>::value); + __r.first = static_cast<_Tp*>(::operator new( + __n * sizeof(_Tp), __al, nothrow)); + } else { + __r.first = static_cast<_Tp*>(::operator new( + __n * sizeof(_Tp), nothrow)); + } +#else +#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) + if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) +#else + if (std::alignment_of<_Tp>::value > + std::alignment_of::value) +#endif + { + // Since aligned operator new is unavailable, return an empty + // buffer rather than one with invalid alignment. + return __r; + } + __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow)); +#endif + if (__r.first) { __r.second = __n; @@ -2017,7 +2048,23 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -void return_temporary_buffer(_Tp* __p) _NOEXCEPT {::operator delete(__p);} +void return_temporary_buffer(_Tp* __p) _NOEXCEPT +{ +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) +#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) + if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) +#else + if (std::alignment_of<_Tp>::value > + std::alignment_of::value) +#endif + { + std::align_val_t __al = std::align_val_t(std::alignment_of<_Tp>::value); + ::operator delete(__p, __al); + return; + } +#endif + ::operator delete(__p); +} #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template diff --git a/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp b/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp new file mode 100644 index 000000000..6476015c0 --- /dev/null +++ b/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// pair +// get_temporary_buffer(ptrdiff_t n); +// +// template +// void +// return_temporary_buffer(T* p); + +#include +#include + +struct alignas(32) A { + int field; +}; + +int main() +{ + std::pair ip = std::get_temporary_buffer(5); + assert(!(ip.first == nullptr) ^ (ip.second == 0)); + assert(reinterpret_cast(ip.first) % alignof(A) == 0); + std::return_temporary_buffer(ip.first); +} From b2189c01fa34c475a53c379489717ba8d3c073c5 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 1 Feb 2018 23:31:22 +0000 Subject: [PATCH 0325/1520] Disable test in C++<11 mode due to use of alignas. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324033 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp b/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp index 6476015c0..52aca8192 100644 --- a/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp +++ b/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template From d33aaa939c0ddc4a1d7a23ec3b4d00619551d3f3 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 2 Feb 2018 22:39:59 +0000 Subject: [PATCH 0326/1520] Fix has_unique_object_representation after Clang commit r324134. Clang previously reported an empty union as having a unique object representation. This was incorrect and was fixed in a recent Clang commit. This patch fixes the libc++ tests. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324153 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../has_unique_object_representations.pass.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp index e4a3d203c..52100c304 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp @@ -55,7 +55,8 @@ class NotEmpty virtual ~NotEmpty(); }; -union Union {}; +union EmptyUnion {}; +struct NonEmptyUnion {int x; unsigned y;}; struct bit_zero { @@ -84,6 +85,7 @@ int main() { test_has_not_has_unique_object_representations(); test_has_not_has_unique_object_representations(); + test_has_not_has_unique_object_representations(); test_has_not_has_unique_object_representations(); test_has_not_has_unique_object_representations(); test_has_not_has_unique_object_representations(); @@ -97,7 +99,7 @@ int main() test_has_unique_object_representations(); - test_has_unique_object_representations(); + test_has_unique_object_representations(); test_has_unique_object_representations(); test_has_unique_object_representations(); From b232793189fbd5c11603a0e282a1fc7e9e160a1f Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 3 Feb 2018 01:45:35 +0000 Subject: [PATCH 0327/1520] Work around Clang bug introduced in r324062 When Clang encounters an already invalid class declaration, it can emit incorrect diagnostics about the exception specification on some of its members. This patch temporarily works around that incorrect diagnostic. The clang bug was introduced in r324062. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324164 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../file.streams/fstreams/traits_mismatch.fail.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp b/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp index dcb7b1f64..c843b7e98 100644 --- a/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp @@ -21,5 +21,10 @@ int main() std::basic_fstream > f; // expected-error-re@ios:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} // expected-error-re@streambuf:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} + +// FIXME: As of commit r324062 Clang incorrectly generates a diagnostic about mismatching +// exception specifications for types which are already invalid for one reason or another. +// For now we tolerate this diagnostic. +// expected-error@ostream:* 0-1 {{exception specification of overriding function is more lax than base version}} } From b173b26b9e9fbc81be07a1f5e1382669c9bbc7e3 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 3 Feb 2018 01:48:21 +0000 Subject: [PATCH 0328/1520] Work around GCC constexpr initialization bug git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324165 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../alg.lex.comparison/lexicographical_compare_comp.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp index f2800e055..b7fbdbfa2 100644 --- a/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 2, 3}; int ib[] = {1, 3, 5, 2, 4, 6}; - std::greater pred; + std::greater pred{}; return !std::lexicographical_compare(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), pred) && std::lexicographical_compare(std::begin(ib), std::end(ib), std::begin(ia), std::end(ia), pred) ; From f3224ac0076b2294d52c6f79305ac2d9e4e9f947 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 01:03:08 +0000 Subject: [PATCH 0329/1520] [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324182 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/array | 76 +++++++++++++++---- .../array/array.cons/default.pass.cpp | 17 +++++ .../sequences/array/array.data/data.pass.cpp | 10 +++ .../array/array.data/data_const.pass.cpp | 10 +++ .../containers/sequences/array/begin.pass.cpp | 9 +++ 5 files changed, 106 insertions(+), 16 deletions(-) diff --git a/include/array b/include/array index 4eb2fe6fc..8cd3ecdf9 100644 --- a/include/array +++ b/include/array @@ -117,6 +117,55 @@ template const T&& get(const array&&) noexce _LIBCPP_BEGIN_NAMESPACE_STD +template +struct __array_traits { + typedef _Tp _StorageT[_Size]; + + _LIBCPP_INLINE_VISIBILITY + static _LIBCPP_CONSTEXPR_AFTER_CXX14 _Tp* __data(_StorageT& __store) { + return __store; + } + + _LIBCPP_INLINE_VISIBILITY + static _LIBCPP_CONSTEXPR_AFTER_CXX14 _Tp const* __data(const _StorageT& __store) { + return __store; + } + + _LIBCPP_INLINE_VISIBILITY + static void __swap(_StorageT& __lhs, _StorageT& __rhs) { + std::swap_ranges(__lhs, __lhs + _Size, __rhs); + } + + _LIBCPP_INLINE_VISIBILITY + static void __fill(_StorageT& __arr, _Tp const& __val) { + _VSTD::fill_n(__arr, _Size, __val); + } +}; + +template +struct __array_traits<_Tp, 0> { + typedef typename aligned_storage::value>::type _StorageT; + + _LIBCPP_INLINE_VISIBILITY + static _Tp* __data(_StorageT& __store) { + _StorageT *__ptr = std::addressof(__store); + return reinterpret_cast<_Tp*>(__ptr); + } + + _LIBCPP_INLINE_VISIBILITY + static const _Tp* __data(const _StorageT& __store) { + const _StorageT *__ptr = std::addressof(__store); + return reinterpret_cast(__ptr); + } + + _LIBCPP_INLINE_VISIBILITY + static void __swap(_StorageT&, _StorageT&) {} + + _LIBCPP_INLINE_VISIBILITY + static void __fill(_StorageT&, _Tp const&) { + } +}; + template struct _LIBCPP_TEMPLATE_VIS array { @@ -134,31 +183,26 @@ struct _LIBCPP_TEMPLATE_VIS array typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - value_type __elems_[_Size > 0 ? _Size : 1]; + typedef __array_traits<_Tp, _Size> _Traits; + typename _Traits::_StorageT __elems_; // No explicit construct/copy/destroy for aggregate type _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) - {_VSTD::fill_n(__elems_, _Size, __u);} + {_Traits::__fill(__elems_, __u);} + _LIBCPP_INLINE_VISIBILITY void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) - { __swap_dispatch((std::integral_constant()), __a); } - - _LIBCPP_INLINE_VISIBILITY - void __swap_dispatch(std::true_type, array&) {} - - _LIBCPP_INLINE_VISIBILITY - void __swap_dispatch(std::false_type, array& __a) - { _VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);} + { _Traits::__swap(__elems_, __a.__elems_); } // iterators: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - iterator begin() _NOEXCEPT {return iterator(__elems_);} + iterator begin() _NOEXCEPT {return iterator(data());} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);} + const_iterator begin() const _NOEXCEPT {return const_iterator(data());} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);} + iterator end() _NOEXCEPT {return iterator(data() + _Size);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);} + const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -201,9 +245,9 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - value_type* data() _NOEXCEPT {return __elems_;} + value_type* data() _NOEXCEPT {return _Traits::__data(__elems_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const value_type* data() const _NOEXCEPT {return __elems_;} + const value_type* data() const _NOEXCEPT {return _Traits::__data(__elems_);} }; template diff --git a/test/std/containers/sequences/array/array.cons/default.pass.cpp b/test/std/containers/sequences/array/array.cons/default.pass.cpp index 7bc62b759..9a2a6eaa3 100644 --- a/test/std/containers/sequences/array/array.cons/default.pass.cpp +++ b/test/std/containers/sequences/array/array.cons/default.pass.cpp @@ -14,6 +14,14 @@ #include #include +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +struct NoDefault { + NoDefault(int) {} +}; + int main() { { @@ -28,4 +36,13 @@ int main() C c; assert(c.size() == 0); } + { + typedef std::array C; + C c; + assert(c.size() == 0); + C c1 = {}; + assert(c1.size() == 0); + C c2 = {{}}; + assert(c2.size() == 0); + } } diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp index d7aed70c9..7b510c203 100644 --- a/test/std/containers/sequences/array/array.data/data.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -36,4 +36,14 @@ int main() T* p = c.data(); (void)p; // to placate scan-build } + { + struct NoDefault { + NoDefault(int) {} + }; + typedef NoDefault T; + typedef std::array C; + C c = {}; + T* p = c.data(); + assert(p != nullptr); + } } diff --git a/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/test/std/containers/sequences/array/array.data/data_const.pass.cpp index 5be082eeb..f10d51580 100644 --- a/test/std/containers/sequences/array/array.data/data_const.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data_const.pass.cpp @@ -38,6 +38,16 @@ int main() const T* p = c.data(); (void)p; // to placate scan-build } + { + struct NoDefault { + NoDefault(int) {} + }; + typedef NoDefault T; + typedef std::array C; + const C c = {}; + const T* p = c.data(); + assert(p != nullptr); + } #if TEST_STD_VER > 14 { typedef std::array C; diff --git a/test/std/containers/sequences/array/begin.pass.cpp b/test/std/containers/sequences/array/begin.pass.cpp index b12ffc851..8cdef466a 100644 --- a/test/std/containers/sequences/array/begin.pass.cpp +++ b/test/std/containers/sequences/array/begin.pass.cpp @@ -31,4 +31,13 @@ int main() *i = 5.5; assert(c[0] == 5.5); } + { + struct NoDefault { + NoDefault(int) {} + }; + typedef NoDefault T; + typedef std::array C; + C c = {}; + assert(c.begin() == c.end()); + } } From 122c064a764a01f302540bf1952ec782c753fcb7 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 02:17:02 +0000 Subject: [PATCH 0330/1520] Make array non-CopyAssignable and make swap and fill ill-formed. The standard isn't exactly clear how std::array should handle zero-sized arrays with const element types. In particular W.R.T. copy assignment, swap, and fill. This patch takes the position that those operations should be ill-formed, and makes changes to libc++ to make it so. This follows up on commit r324182. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324185 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/array | 31 +++++-- .../array/array.cons/implicit_copy.pass.cpp | 93 +++++++++++++++++++ .../sequences/array/array.data/data.pass.cpp | 8 ++ .../sequences/array/array.fill/fill.fail.cpp | 29 ++++++ .../sequences/array/array.swap/swap.fail.cpp | 30 ++++++ 5 files changed, 181 insertions(+), 10 deletions(-) create mode 100644 test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp create mode 100644 test/std/containers/sequences/array/array.fill/fill.fail.cpp create mode 100644 test/std/containers/sequences/array/array.swap/swap.fail.cpp diff --git a/include/array b/include/array index 8cd3ecdf9..4a89ea90d 100644 --- a/include/array +++ b/include/array @@ -122,7 +122,8 @@ struct __array_traits { typedef _Tp _StorageT[_Size]; _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX14 _Tp* __data(_StorageT& __store) { + static _LIBCPP_CONSTEXPR_AFTER_CXX14 typename remove_const<_Tp>::type* + __data(typename remove_const<_StorageT>::type& __store) { return __store; } @@ -144,12 +145,16 @@ struct __array_traits { template struct __array_traits<_Tp, 0> { - typedef typename aligned_storage::value>::type _StorageT; + typedef typename aligned_storage::value>::type + _NonConstStorageT; + typedef typename conditional::value, const _NonConstStorageT, + _NonConstStorageT>::type _StorageT; + typedef typename remove_const<_Tp>::type _NonConstTp; _LIBCPP_INLINE_VISIBILITY - static _Tp* __data(_StorageT& __store) { + static _NonConstTp* __data(_NonConstStorageT& __store) { _StorageT *__ptr = std::addressof(__store); - return reinterpret_cast<_Tp*>(__ptr); + return reinterpret_cast<_NonConstTp*>(__ptr); } _LIBCPP_INLINE_VISIBILITY @@ -162,8 +167,7 @@ struct __array_traits<_Tp, 0> { static void __swap(_StorageT&, _StorageT&) {} _LIBCPP_INLINE_VISIBILITY - static void __fill(_StorageT&, _Tp const&) { - } + static void __fill(_StorageT&, _Tp const&) {} }; template @@ -187,12 +191,19 @@ struct _LIBCPP_TEMPLATE_VIS array typename _Traits::_StorageT __elems_; // No explicit construct/copy/destroy for aggregate type - _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) - {_Traits::__fill(__elems_, __u);} + _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) { + static_assert(_Size != 0 || !is_const<_Tp>::value, + "cannot fill zero-sized array of type 'const T'"); + _Traits::__fill(__elems_, __u); + } _LIBCPP_INLINE_VISIBILITY - void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) - { _Traits::__swap(__elems_, __a.__elems_); } + void swap(array& __a) + _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) { + static_assert(_Size != 0 || !is_const<_Tp>::value, + "cannot swap zero-sized array of type 'const T'"); + _Traits::__swap(__elems_, __a.__elems_); + } // iterators: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 diff --git a/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp new file mode 100644 index 000000000..864318116 --- /dev/null +++ b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp @@ -0,0 +1,93 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// implicitly generated array constructors / assignment operators + +#include +#include +#include +#include "test_macros.h" + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +// FIXME: Clang generates copy assignment operators for types with const members +// in C++03. The generated operator is ill-formed but still present. +// I'm not sure if this is a Clang bug, but we need to work around it for now. +#if TEST_STD_VER < 11 && defined(__clang__) +#define TEST_NOT_COPY_ASSIGNABLE(T) ((void)0) +#else +#define TEST_NOT_COPY_ASSIGNABLE(T) static_assert(!std::is_copy_assignable::value, "") +#endif + +struct NoDefault { + NoDefault(int) {} +}; + +int main() { + { + typedef double T; + typedef std::array C; + C c = {1.1, 2.2, 3.3}; + C c2 = c; + c2 = c; + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + typedef double T; + typedef std::array C; + C c = {1.1, 2.2, 3.3}; + C c2 = c; + ((void)c2); + static_assert(std::is_copy_constructible::value, ""); + TEST_NOT_COPY_ASSIGNABLE(C); + } + { + typedef double T; + typedef std::array C; + C c = {}; + C c2 = c; + c2 = c; + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + // const arrays of size 0 should disable the implicit copy assignment operator. + typedef double T; + typedef std::array C; + C c = {}; + C c2 = c; + ((void)c2); + static_assert(std::is_copy_constructible::value, ""); + TEST_NOT_COPY_ASSIGNABLE(C); + } + { + typedef NoDefault T; + typedef std::array C; + C c = {}; + C c2 = c; + c2 = c; + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + typedef NoDefault T; + typedef std::array C; + C c = {}; + C c2 = c; + ((void)c2); + static_assert(std::is_copy_constructible::value, ""); + TEST_NOT_COPY_ASSIGNABLE(C); + } + +} diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp index 7b510c203..452d6b7f3 100644 --- a/test/std/containers/sequences/array/array.data/data.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -36,6 +36,14 @@ int main() T* p = c.data(); (void)p; // to placate scan-build } + { + typedef double T; + typedef std::array C; + C c = {}; + const T* p = c.data(); + static_assert((std::is_same::value), ""); + (void)p; // to placate scan-build + } { struct NoDefault { NoDefault(int) {} diff --git a/test/std/containers/sequences/array/array.fill/fill.fail.cpp b/test/std/containers/sequences/array/array.fill/fill.fail.cpp new file mode 100644 index 000000000..07816c7c7 --- /dev/null +++ b/test/std/containers/sequences/array/array.fill/fill.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void fill(const T& u); + +#include +#include + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +int main() { + { + typedef double T; + typedef std::array C; + C c = {}; + // expected-error@array:* {{static_assert failed "cannot fill zero-sized array of type 'const T'"}} + c.fill(5.5); // expected-note {{requested here}} + } +} diff --git a/test/std/containers/sequences/array/array.swap/swap.fail.cpp b/test/std/containers/sequences/array/array.swap/swap.fail.cpp new file mode 100644 index 000000000..26febadb7 --- /dev/null +++ b/test/std/containers/sequences/array/array.swap/swap.fail.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void swap(array& a); + +#include +#include + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +int main() { + { + typedef double T; + typedef std::array C; + C c = {}; + C c2 = {}; + // expected-error@array:* {{static_assert failed "cannot swap zero-sized array of type 'const T'"}} + c.swap(c2); // expected-note {{requested here}} + } +} From 7d251c57ac9f876dd66f5a5b0187199cb3376d03 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 02:22:33 +0000 Subject: [PATCH 0331/1520] correct comment about C++03 assignment operators git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324186 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../sequences/array/array.cons/implicit_copy.pass.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp index 864318116..a8434c018 100644 --- a/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp +++ b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp @@ -20,10 +20,10 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" -// FIXME: Clang generates copy assignment operators for types with const members -// in C++03. The generated operator is ill-formed but still present. -// I'm not sure if this is a Clang bug, but we need to work around it for now. -#if TEST_STD_VER < 11 && defined(__clang__) +// In C++03 the copy assignment operator is not deleted when the implicitly +// generated operator would be ill-formed; like in the case of a struct with a +// const member. +#if TEST_STD_VER < 11 #define TEST_NOT_COPY_ASSIGNABLE(T) ((void)0) #else #define TEST_NOT_COPY_ASSIGNABLE(T) static_assert(!std::is_copy_assignable::value, "") From af1fd7c75f5cb2a19c11339d60b4fa2da31fd901 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 02:43:32 +0000 Subject: [PATCH 0332/1520] Address LWG 2849 and fix missing failure condition in copy_file. Previously copy_file didn't handle the case where the input and output were the same file. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324187 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/experimental/filesystem/operations.cpp | 30 ++++++++++++------- .../fs.op.copy_file/copy_file.pass.cpp | 7 ++++- www/upcoming_meeting.html | 4 +-- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index 91aee6ffb..2bc28c21d 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -263,18 +263,22 @@ void __copy(const path& from, const path& to, copy_options options, bool __copy_file(const path& from, const path& to, copy_options options, std::error_code *ec) { - if (ec) ec->clear(); + using StatT = struct ::stat; + if (ec) + ec->clear(); std::error_code m_ec; - auto from_st = detail::posix_stat(from, &m_ec); + StatT from_stat; + auto from_st = detail::posix_stat(from, from_stat, &m_ec); if (not is_regular_file(from_st)) { - if (not m_ec) - m_ec = make_error_code(errc::not_supported); - set_or_throw(m_ec, ec, "copy_file", from, to); - return false; + if (not m_ec) + m_ec = make_error_code(errc::not_supported); + set_or_throw(m_ec, ec, "copy_file", from, to); + return false; } - auto to_st = detail::posix_stat(to, &m_ec); + StatT to_stat; + auto to_st = detail::posix_stat(to, to_stat, &m_ec); if (!status_known(to_st)) { set_or_throw(m_ec, ec, "copy_file", from, to); return false; @@ -285,6 +289,11 @@ bool __copy_file(const path& from, const path& to, copy_options options, set_or_throw(make_error_code(errc::not_supported), ec, "copy_file", from, to); return false; } + if (to_exists && detail::stat_equivalent(from_stat, to_stat)) { + set_or_throw(make_error_code(errc::file_exists), ec, "copy_file", from, + to); + return false; + } if (to_exists && bool(copy_options::skip_existing & options)) { return false; } @@ -302,8 +311,9 @@ bool __copy_file(const path& from, const path& to, copy_options options, return detail::copy_file_impl(from, to, from_st.permissions(), ec); } else { - set_or_throw(make_error_code(errc::file_exists), ec, "copy", from, to); - return false; + set_or_throw(make_error_code(errc::file_exists), ec, "copy_file", from, + to); + return false; } _LIBCPP_UNREACHABLE(); @@ -443,7 +453,7 @@ bool __equivalent(const path& p1, const path& p2, std::error_code *ec) if (!exists(s2)) return make_unsupported_error(); if (ec) ec->clear(); - return (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino); + return detail::stat_equivalent(st1, st2); } diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index 8c5241c71..ee2ad1c46 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -70,17 +70,21 @@ TEST_CASE(test_error_reporting) scoped_test_env env; const path file = env.create_file("file1", 42); const path file2 = env.create_file("file2", 55); + const path non_regular_file = env.create_fifo("non_reg"); const path dne = env.make_env_path("dne"); { // exists(to) && equivalent(to, from) std::error_code ec; - TEST_CHECK(fs::copy_file(file, file, ec) == false); + TEST_CHECK(fs::copy_file(file, file, copy_options::overwrite_existing, + ec) == false); TEST_REQUIRE(ec); + TEST_CHECK(ec == std::make_error_code(std::errc::file_exists)); TEST_CHECK(checkThrow(file, file, ec)); } { // exists(to) && !(skip_existing | overwrite_existing | update_existing) std::error_code ec; TEST_CHECK(fs::copy_file(file, file2, ec) == false); TEST_REQUIRE(ec); + TEST_CHECK(ec == std::make_error_code(std::errc::file_exists)); TEST_CHECK(checkThrow(file, file2, ec)); } } @@ -181,6 +185,7 @@ TEST_CASE(non_regular_file_test) TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing, ec) == false); TEST_CHECK(ec); TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(ec == std::make_error_code(std::errc::not_supported)); TEST_CHECK(is_fifo(fifo)); } } diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index f5b2e91fd..720552357 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -63,7 +63,7 @@ 2243istream::putback problemJacksonvilleComplete 2816resize_file has impossible postconditionJacksonvilleNothing to do 2843Unclear behavior of std::pmr::memory_resource::do_allocate()Jacksonville -2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?Jacksonville +2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?JacksonvilleNothing to do 2851std::filesystem enum classes are now underspecifiedJacksonville 2969polymorphic_allocator::construct() shouldn't pass resource()Jacksonville 2975Missing case for pair construction in scoped and polymorphic allocatorsJacksonville @@ -100,7 +100,7 @@
  • 2243 - We already do this.
  • 2816 - Wording changes only
  • 2843 - We don't have PMRs yet
  • -
  • 2849 - Eric?
  • +
  • 2849 - We already report different errors.
  • 2851 - Eric?
  • 2969 - We don't have PMRs yet
  • 2975 - We can do the scoped_ bit, but the PMR stuff will have to wait.
  • From cc7688a7194136647a307ab3f5e46a4feec7ecbb Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 02:45:33 +0000 Subject: [PATCH 0333/1520] Mark issue 2851 as complete git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324188 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 720552357..3166a04ed 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -64,7 +64,7 @@ 2816resize_file has impossible postconditionJacksonvilleNothing to do 2843Unclear behavior of std::pmr::memory_resource::do_allocate()Jacksonville 2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?JacksonvilleNothing to do -2851std::filesystem enum classes are now underspecifiedJacksonville +2851std::filesystem enum classes are now underspecifiedJacksonvilleNothing to do 2969polymorphic_allocator::construct() shouldn't pass resource()Jacksonville 2975Missing case for pair construction in scoped and polymorphic allocatorsJacksonville 2989path's stream insertion operator lets you insert everything under the sunJacksonville @@ -101,7 +101,7 @@
  • 2816 - Wording changes only
  • 2843 - We don't have PMRs yet
  • 2849 - We already report different errors.
  • -
  • 2851 - Eric?
  • +
  • 2851 - Wording changes only
  • 2969 - We don't have PMRs yet
  • 2975 - We can do the scoped_ bit, but the PMR stuff will have to wait.
  • 2989 - Eric?
  • From 0b47a655acc005972be176257716934abe431b72 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 03:10:53 +0000 Subject: [PATCH 0334/1520] Implement LWG2989: path's streaming operators allow everything under the sun. Because path can be constructed from a ton of different types, including string and wide strings, this caused it's streaming operators to suck up all sorts of silly types via silly conversions. For example: using namespace std::experimental::filesystem::v1; std::wstring w(L"wide"); std::cout << w; // converts to path. This patch tentatively adopts the resolution to LWG2989 and fixes the issue by making the streaming operators friends of path. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324189 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/filesystem | 72 ++++++++++--------- .../path.nonmember/path.io.pass.cpp | 33 +++++++++ www/upcoming_meeting.html | 4 +- 3 files changed, 72 insertions(+), 37 deletions(-) diff --git a/include/experimental/filesystem b/include/experimental/filesystem index 674490f60..39750d9b4 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -28,12 +28,13 @@ path operator/ (const path& lhs, const path& rhs); + // fs.path.io operators are friends of path. template - basic_ostream& + friend basic_ostream& operator<<(basic_ostream& os, const path& p); template - basic_istream& + friend basic_istream& operator>>(basic_istream& is, path& p); template @@ -994,6 +995,40 @@ public: iterator begin() const; iterator end() const; + + template + _LIBCPP_INLINE_VISIBILITY + friend typename enable_if::value && + is_same<_Traits, char_traits>::value, + basic_ostream<_CharT, _Traits>& + >::type + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { + __os << std::__quoted(__p.native()); + return __os; + } + + template + _LIBCPP_INLINE_VISIBILITY + friend typename enable_if::value || + !is_same<_Traits, char_traits>::value, + basic_ostream<_CharT, _Traits>& + >::type + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { + __os << std::__quoted(__p.string<_CharT, _Traits>()); + return __os; + } + + template + _LIBCPP_INLINE_VISIBILITY + friend basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) + { + basic_string<_CharT, _Traits> __tmp; + __is >> __quoted(__tmp); + __p = __tmp; + return __is; + } + private: inline _LIBCPP_INLINE_VISIBILITY path& __assign_view(__string_view const& __s) noexcept { __pn_ = string_type(__s); return *this; } @@ -1037,39 +1072,6 @@ path operator/(const path& __lhs, const path& __rhs) { return path(__lhs) /= __rhs; } -template -_LIBCPP_INLINE_VISIBILITY -typename enable_if::value && - is_same<_Traits, char_traits>::value, - basic_ostream<_CharT, _Traits>& ->::type -operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { - __os << std::__quoted(__p.native()); - return __os; -} - -template -_LIBCPP_INLINE_VISIBILITY -typename enable_if::value || - !is_same<_Traits, char_traits>::value, - basic_ostream<_CharT, _Traits>& ->::type -operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { - __os << std::__quoted(__p.string<_CharT, _Traits>()); - return __os; -} - -template -_LIBCPP_INLINE_VISIBILITY -basic_istream<_CharT, _Traits>& -operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) -{ - basic_string<_CharT, _Traits> __tmp; - __is >> __quoted(__tmp); - __p = __tmp; - return __is; -} - template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_pathable<_Source>::value, path>::type diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp index 4b7ad735c..8dd82a845 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "test_macros.h" #include "test_iterators.h" @@ -35,6 +36,8 @@ MultiStringType InStr = MKSTR("abcdefg/\"hijklmnop\"/qrstuvwxyz/123456789"); MultiStringType OutStr = MKSTR("\"abcdefg/\\\"hijklmnop\\\"/qrstuvwxyz/123456789\""); + + template void doIOTest() { using namespace fs; @@ -56,10 +59,40 @@ void doIOTest() { } } +namespace impl { +using namespace fs; + +template () << std::declval())> +std::true_type is_ostreamable_imp(int); + +template +std::false_type is_ostreamable_imp(long); + +template () >> std::declval())> +std::true_type is_istreamable_imp(int); + +template +std::false_type is_istreamable_imp(long); + + +} // namespace impl + +template +struct is_ostreamable : decltype(impl::is_ostreamable_imp(0)) {}; +template +struct is_istreamable : decltype(impl::is_istreamable_imp(0)) {}; + +void test_LWG2989() { + static_assert(!is_ostreamable::value, ""); + static_assert(!is_ostreamable::value, ""); + static_assert(!is_istreamable::value, ""); + static_assert(!is_istreamable::value, ""); +} int main() { doIOTest(); doIOTest(); //doIOTest(); //doIOTest(); + test_LWG2989(); } diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 3166a04ed..f11461150 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -67,7 +67,7 @@ 2851std::filesystem enum classes are now underspecifiedJacksonvilleNothing to do 2969polymorphic_allocator::construct() shouldn't pass resource()Jacksonville 2975Missing case for pair construction in scoped and polymorphic allocatorsJacksonville -2989path's stream insertion operator lets you insert everything under the sunJacksonville +2989path's stream insertion operator lets you insert everything under the sunJacksonvilleCompleted 3000monotonic_memory_resource::do_is_equal uses dynamic_cast unnecessarilyJacksonville 3002[networking.ts] basic_socket_acceptor::is_open() isn't noexceptJacksonville 3004§[string.capacity] and §[vector.capacity] should specify time complexity for capacity()JacksonvilleNothing to do @@ -104,7 +104,7 @@
  • 2851 - Wording changes only
  • 2969 - We don't have PMRs yet
  • 2975 - We can do the scoped_ bit, but the PMR stuff will have to wait.
  • -
  • 2989 - Eric?
  • +
  • 2989 - Proposed changes LGTM
  • 3000 - We don't have PMRs yet
  • 3002 - No networking TS implementation yet
  • 3004 - Wording changes only
  • From 9611902923caf807981a66a086758d88f6932911 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 03:26:55 +0000 Subject: [PATCH 0335/1520] Remove debug println from rec.dir.itr.increment test git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324190 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index ea81ee253..87c10c499 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -24,7 +24,6 @@ #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -#include using namespace std::experimental::filesystem; @@ -347,7 +346,6 @@ TEST_CASE(test_PR35078_with_symlink) Opts |= directory_options::follow_directory_symlink; recursive_directory_iterator it(startDir, Opts, ec); while (!ec && it != endIt && *it != symDir) { - std::cout << *it << std::endl; if (*it == nestedFile) SeenFile3 = true; it.increment(ec); From b2c07b0af236e19c0d696e9dfaec7d3dfa48f645 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 07:29:53 +0000 Subject: [PATCH 0336/1520] Mark LWG 3013 as already complete. See r316941 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324191 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index f11461150..1b918ba61 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -75,7 +75,7 @@ 3007allocate_shared should rebind allocator to cv-unqualified value_type for constructionJacksonville 3009Including <string_view> doesn't provide std::size/empty/dataJacksonvilleComplete 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville -3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonville +3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete 3014More noexcept issues with filesystem operationsJacksonville 3015copy_options::unspecified underspecifiedJacksonville 3017list splice functions should use addressofJacksonville @@ -112,7 +112,7 @@
  • 3007 - Looks easy
  • 3009 - We do this already; tests added in r323719
  • 3010 - No networking TS implementation yet
  • -
  • 3013 - Eric?
  • +
  • 3013 - We already implement this
  • 3014 - Eric?
  • 3015 - Eric?
  • 3017 - We don't do the splicing stuff yet
  • From 4d0f42850bbe144ac476af08df29df8ba7bf2f25 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 07:35:36 +0000 Subject: [PATCH 0337/1520] Implement LWG 3014 - Fix more noexcept issues in filesystem. This patch removes the noexcept declaration from filesystem operations which require creating temporary paths or creating a directory iterator. Either of these operations can throw. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324192 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/filesystem | 16 ++++++++-------- .../fs.op.copy_file/copy_file.pass.cpp | 4 ++-- .../create_directories.pass.cpp | 2 +- .../fs.op.remove_all/remove_all.pass.cpp | 2 +- www/upcoming_meeting.html | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/experimental/filesystem b/include/experimental/filesystem index 39750d9b4..cdfe9e254 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -88,17 +88,17 @@ error_code& ec); bool copy_file(const path& from, const path& to); - bool copy_file(const path& from, const path& to, error_code& ec) _NOEXCEPT; + bool copy_file(const path& from, const path& to, error_code& ec); bool copy_file(const path& from, const path& to, copy_options option); bool copy_file(const path& from, const path& to, copy_options option, - error_code& ec) _NOEXCEPT; + error_code& ec); void copy_symlink(const path& existing_symlink, const path& new_symlink); void copy_symlink(const path& existing_symlink, const path& new_symlink, error_code& ec) _NOEXCEPT; bool create_directories(const path& p); - bool create_directories(const path& p, error_code& ec) _NOEXCEPT; + bool create_directories(const path& p, error_code& ec); bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec) _NOEXCEPT; @@ -188,7 +188,7 @@ bool remove(const path& p, error_code& ec) _NOEXCEPT; uintmax_t remove_all(const path& p); - uintmax_t remove_all(const path& p, error_code& ec) _NOEXCEPT; + uintmax_t remove_all(const path& p, error_code& ec); void rename(const path& from, const path& to); void rename(const path& from, const path& to, error_code& ec) _NOEXCEPT; @@ -1375,7 +1375,7 @@ bool copy_file(const path& __from, const path& __to) { } inline _LIBCPP_INLINE_VISIBILITY -bool copy_file(const path& __from, const path& __to, error_code& __ec) _NOEXCEPT { +bool copy_file(const path& __from, const path& __to, error_code& __ec) { return __copy_file(__from, __to, copy_options::none, &__ec); } @@ -1386,7 +1386,7 @@ bool copy_file(const path& __from, const path& __to, copy_options __opt) { inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, const path& __to, - copy_options __opt, error_code& __ec) _NOEXCEPT { + copy_options __opt, error_code& __ec){ return __copy_file(__from, __to, __opt, &__ec); } @@ -1406,7 +1406,7 @@ bool create_directories(const path& __p) { } inline _LIBCPP_INLINE_VISIBILITY -bool create_directories(const path& __p, error_code& __ec) _NOEXCEPT { +bool create_directories(const path& __p, error_code& __ec) { return __create_directories(__p, &__ec); } @@ -1699,7 +1699,7 @@ uintmax_t remove_all(const path& __p) { } inline _LIBCPP_INLINE_VISIBILITY -uintmax_t remove_all(const path& __p, error_code& __ec) _NOEXCEPT { +uintmax_t remove_all(const path& __p, error_code& __ec) { return __remove_all(__p, &__ec); } diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index ee2ad1c46..fe5f00128 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -44,8 +44,8 @@ TEST_CASE(test_signatures) ASSERT_SAME_TYPE(decltype(fs::copy_file(p, p, opts, ec)), bool); ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p)); ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, opts)); - ASSERT_NOEXCEPT(fs::copy_file(p, p, ec)); - ASSERT_NOEXCEPT(fs::copy_file(p, p, opts, ec)); + ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, ec)); + ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, opts, ec)); } TEST_CASE(test_error_reporting) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp index ba0602549..c7d9339df 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp @@ -34,7 +34,7 @@ TEST_CASE(test_signatures) ASSERT_SAME_TYPE(decltype(fs::create_directories(p)), bool); ASSERT_SAME_TYPE(decltype(fs::create_directories(p, ec)), bool); ASSERT_NOT_NOEXCEPT(fs::create_directories(p)); - ASSERT_NOEXCEPT(fs::create_directories(p, ec)); + ASSERT_NOT_NOEXCEPT(fs::create_directories(p, ec)); } TEST_CASE(create_existing_directory) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp index b0538a179..64c5c88c8 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp @@ -33,7 +33,7 @@ TEST_CASE(test_signatures) ASSERT_SAME_TYPE(decltype(fs::remove_all(p, ec)), std::uintmax_t); ASSERT_NOT_NOEXCEPT(fs::remove_all(p)); - ASSERT_NOEXCEPT(fs::remove_all(p, ec)); + ASSERT_NOT_NOEXCEPT(fs::remove_all(p, ec)); } TEST_CASE(test_error_reporting) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 1b918ba61..67708aac8 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -76,7 +76,7 @@ 3009Including <string_view> doesn't provide std::size/empty/dataJacksonvilleComplete 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville 3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete -3014More noexcept issues with filesystem operationsJacksonville +3014More noexcept issues with filesystem operationsJacksonvilleComplete 3015copy_options::unspecified underspecifiedJacksonville 3017list splice functions should use addressofJacksonville 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville @@ -113,7 +113,7 @@
  • 3009 - We do this already; tests added in r323719
  • 3010 - No networking TS implementation yet
  • 3013 - We already implement this
  • -
  • 3014 - Eric?
  • +
  • 3014 - We implement this
  • 3015 - Eric?
  • 3017 - We don't do the splicing stuff yet
  • 3020 - No networking TS implementation yet
  • From 88232b14d4c5b91a831022fb721dfa1b85a2e53d Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 07:37:09 +0000 Subject: [PATCH 0338/1520] Mark LWG 3014 as complete. No code changes needed git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324193 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 67708aac8..7c4a27ba8 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -77,7 +77,7 @@ 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville 3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete 3014More noexcept issues with filesystem operationsJacksonvilleComplete -3015copy_options::unspecified underspecifiedJacksonville + 3015copy_options::unspecified underspecifiedJacksonvilleNothing to do 3017list splice functions should use addressofJacksonville 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville @@ -114,7 +114,7 @@
  • 3010 - No networking TS implementation yet
  • 3013 - We already implement this
  • 3014 - We implement this
  • -
  • 3015 - Eric?
  • +
  • 3015 - Wording changes only
  • 3017 - We don't do the splicing stuff yet
  • 3020 - No networking TS implementation yet
  • 3026 - I think this is just wording cleanup - Eric?
  • From 13177172d0aa6bacbfd8a3b0e47f0b7409a09671 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 4 Feb 2018 08:02:35 +0000 Subject: [PATCH 0339/1520] Fix initialization of array with GCC. Previously, when handling zero-sized array of const objects we used a const version of aligned_storage_t, which is not an array type. However, GCC complains about initialization of the form: array arr = {}; This patch fixes that bug by making the dummy object used to represent the zero-sized array an array itself. This avoids GCC's complaints about the uninitialized const member. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324194 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/array | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/array b/include/array index 4a89ea90d..068ab506a 100644 --- a/include/array +++ b/include/array @@ -146,21 +146,19 @@ struct __array_traits { template struct __array_traits<_Tp, 0> { typedef typename aligned_storage::value>::type - _NonConstStorageT; + _NonConstStorageT[1]; typedef typename conditional::value, const _NonConstStorageT, _NonConstStorageT>::type _StorageT; - typedef typename remove_const<_Tp>::type _NonConstTp; + _LIBCPP_INLINE_VISIBILITY - static _NonConstTp* __data(_NonConstStorageT& __store) { - _StorageT *__ptr = std::addressof(__store); - return reinterpret_cast<_NonConstTp*>(__ptr); + static _NonConstTp* __data(_NonConstStorageT &__store) { + return reinterpret_cast<_NonConstTp*>(__store); } _LIBCPP_INLINE_VISIBILITY - static const _Tp* __data(const _StorageT& __store) { - const _StorageT *__ptr = std::addressof(__store); - return reinterpret_cast(__ptr); + static const _Tp* __data(const _StorageT &__store) { + return reinterpret_cast(__store); } _LIBCPP_INLINE_VISIBILITY From b50d2443d55b82ba4fe478cbc7e829f6f2ac8006 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 5 Feb 2018 23:43:34 +0000 Subject: [PATCH 0340/1520] Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324290 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/string_view | 809 +-- include/module.modulemap | 4 - test/libcxx/double_include.sh.cpp | 1 - test/libcxx/min_max_macros.sh.cpp | 2 - test/std/experimental/nothing_to_do.pass.cpp | 2 - .../experimental/string.view/lit.local.cfg | 3 - .../string.view/nothing_to_do.pass.cpp | 12 - .../string.view.access/at.pass.cpp | 63 - .../string.view.access/back.pass.cpp | 50 - .../string.view.access/data.pass.cpp | 50 - .../string.view.access/front.pass.cpp | 50 - .../string.view.access/index.pass.cpp | 53 - .../string.view.capacity/capacity.pass.cpp | 89 - .../opeq.string_view.pointer.pass.cpp | 69 - .../opeq.string_view.string.pass.cpp | 50 - .../opeq.string_view.string_view.pass.cpp | 62 - .../opge.string_view.pointer.pass.cpp | 72 - .../opge.string_view.string.pass.cpp | 50 - .../opge.string_view.string_view.pass.cpp | 65 - .../opgt.string_view.pointer.pass.cpp | 72 - .../opgt.string_view.string.pass.cpp | 50 - .../opgt.string_view.string_view.pass.cpp | 65 - .../ople.string_view.pointer.pass.cpp | 72 - .../ople.string_view.string.pass.cpp | 50 - .../ople.string_view.string_view.pass.cpp | 65 - .../oplt.string_view.pointer.pass.cpp | 72 - .../oplt.string_view.string.pass.cpp | 50 - .../oplt.string_view.string_view.pass.cpp | 65 - .../opne.string_view.pointer.pass.cpp | 70 - .../opne.string_view.string.pass.cpp | 49 - .../opne.string_view.string_view.pass.cpp | 62 - .../string.view.cons/default.pass.cpp | 48 - .../string.view.cons/from_literal.pass.cpp | 65 - .../string.view.cons/from_ptr_len.pass.cpp | 83 - .../string.view.cons/from_string.pass.cpp | 56 - .../string.view.cons/from_string1.fail.cpp | 32 - .../string.view.cons/from_string2.fail.cpp | 32 - .../string.view.find/find_char_size.pass.cpp | 85 - .../find_first_not_of_char_size.pass.cpp | 85 - .../find_first_not_of_pointer_size.pass.cpp | 166 - ...nd_first_not_of_pointer_size_size.pass.cpp | 393 -- ...ind_first_not_of_string_view_size.pass.cpp | 148 - .../find_first_of_char_size.pass.cpp | 83 - .../find_first_of_pointer_size.pass.cpp | 166 - .../find_first_of_pointer_size_size.pass.cpp | 393 -- .../find_first_of_string_view_size.pass.cpp | 148 - .../find_last_not_of_char_size.pass.cpp | 83 - .../find_last_not_of_pointer_size.pass.cpp | 166 - ...ind_last_not_of_pointer_size_size.pass.cpp | 393 -- ...find_last_not_of_string_view_size.pass.cpp | 148 - .../find_last_of_char_size.pass.cpp | 83 - .../find_last_of_pointer_size.pass.cpp | 166 - .../find_last_of_pointer_size_size.pass.cpp | 393 -- .../find_last_of_string_view_size.pass.cpp | 148 - .../find_pointer_size.pass.cpp | 172 - .../find_pointer_size_size.pass.cpp | 394 -- .../find_string_view_size.pass.cpp | 165 - .../string.view.find/rfind_char_size.pass.cpp | 84 - .../rfind_pointer_size.pass.cpp | 172 - .../rfind_pointer_size_size.pass.cpp | 393 -- .../rfind_string_view_size.pass.cpp | 165 - .../string.view.hash/string_view.pass.cpp | 55 - .../string.view.io/stream_insert.pass.cpp | 58 - .../string.view.iterators/begin.pass.cpp | 79 - .../string.view.iterators/end.pass.cpp | 88 - .../string.view.iterators/rbegin.pass.cpp | 61 - .../string.view.iterators/rend.pass.cpp | 69 - .../string.view.modifiers/clear.pass.cpp | 67 - .../remove_prefix.pass.cpp | 78 - .../remove_suffix.pass.cpp | 78 - .../string.view.modifiers/swap.pass.cpp | 76 - .../string.view.nonmem/quoted.pass.cpp | 214 - .../string.view.ops/basic_string.pass.cpp | 65 - .../string.view.ops/compare.pointer.pass.cpp | 127 - .../compare.pointer_size.pass.cpp | 453 -- .../compare.size_size_sv.pass.cpp | 403 -- ...compare.size_size_sv_pointer_size.pass.cpp | 1356 ---- .../compare.size_size_sv_size_size.pass.cpp | 5849 ----------------- .../string.view.ops/compare.sv.pass.cpp | 122 - .../string.view/string.view.ops/copy.pass.cpp | 101 - .../string.view.ops/substr.pass.cpp | 119 - .../string.view.ops/to_string.pass.cpp | 76 - .../string.view.synop/nothing_to_do.pass.cpp | 12 - .../nothing_to_do.pass.cpp | 12 - 84 files changed, 1 insertion(+), 17023 deletions(-) delete mode 100644 test/std/experimental/string.view/lit.local.cfg delete mode 100644 test/std/experimental/string.view/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.access/at.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.access/back.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.access/data.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.access/front.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.access/index.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opge.string_view.string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opgt.string_view.string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/ople.string_view.string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/oplt.string_view.string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opne.string_view.string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.cons/default.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.cons/from_string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp delete mode 100644 test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_first_of_string_view_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_last_of_string_view_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.hash/string_view.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.io/stream_insert.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.iterators/begin.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.iterators/end.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.iterators/rend.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/copy.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/substr.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.ops/to_string.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.synop/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/string.view/string.view.template/nothing_to_do.pass.cpp diff --git a/include/experimental/string_view b/include/experimental/string_view index da104f9a1..f13bff54d 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view @@ -8,811 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_LFTS_STRING_VIEW -#define _LIBCPP_LFTS_STRING_VIEW - -/* -string_view synopsis - -namespace std { - namespace experimental { - inline namespace library_fundamentals_v1 { - - // 7.2, Class template basic_string_view - template> - class basic_string_view; - - // 7.9, basic_string_view non-member comparison functions - template - constexpr bool operator==(basic_string_view x, - basic_string_view y) noexcept; - template - constexpr bool operator!=(basic_string_view x, - basic_string_view y) noexcept; - template - constexpr bool operator< (basic_string_view x, - basic_string_view y) noexcept; - template - constexpr bool operator> (basic_string_view x, - basic_string_view y) noexcept; - template - constexpr bool operator<=(basic_string_view x, - basic_string_view y) noexcept; - template - constexpr bool operator>=(basic_string_view x, - basic_string_view y) noexcept; - // see below, sufficient additional overloads of comparison functions - - // 7.10, Inserters and extractors - template - basic_ostream& - operator<<(basic_ostream& os, - basic_string_view str); - - // basic_string_view typedef names - typedef basic_string_view string_view; - typedef basic_string_view u16string_view; - typedef basic_string_view u32string_view; - typedef basic_string_view wstring_view; - - template> - class basic_string_view { - public: - // types - typedef traits traits_type; - typedef charT value_type; - typedef charT* pointer; - typedef const charT* const_pointer; - typedef charT& reference; - typedef const charT& const_reference; - typedef implementation-defined const_iterator; - typedef const_iterator iterator; - typedef reverse_iterator const_reverse_iterator; - typedef const_reverse_iterator reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - static constexpr size_type npos = size_type(-1); - - // 7.3, basic_string_view constructors and assignment operators - constexpr basic_string_view() noexcept; - constexpr basic_string_view(const basic_string_view&) noexcept = default; - basic_string_view& operator=(const basic_string_view&) noexcept = default; - template - basic_string_view(const basic_string& str) noexcept; - constexpr basic_string_view(const charT* str); - constexpr basic_string_view(const charT* str, size_type len); - - // 7.4, basic_string_view iterator support - constexpr const_iterator begin() const noexcept; - constexpr const_iterator end() const noexcept; - constexpr const_iterator cbegin() const noexcept; - constexpr const_iterator cend() const noexcept; - const_reverse_iterator rbegin() const noexcept; - const_reverse_iterator rend() const noexcept; - const_reverse_iterator crbegin() const noexcept; - const_reverse_iterator crend() const noexcept; - - // 7.5, basic_string_view capacity - constexpr size_type size() const noexcept; - constexpr size_type length() const noexcept; - constexpr size_type max_size() const noexcept; - constexpr bool empty() const noexcept; - - // 7.6, basic_string_view element access - constexpr const_reference operator[](size_type pos) const; - constexpr const_reference at(size_type pos) const; - constexpr const_reference front() const; - constexpr const_reference back() const; - constexpr const_pointer data() const noexcept; - - // 7.7, basic_string_view modifiers - constexpr void clear() noexcept; - constexpr void remove_prefix(size_type n); - constexpr void remove_suffix(size_type n); - constexpr void swap(basic_string_view& s) noexcept; - - // 7.8, basic_string_view string operations - template - explicit operator basic_string() const; - template> - basic_string to_string( - const Allocator& a = Allocator()) const; - - size_type copy(charT* s, size_type n, size_type pos = 0) const; - - constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const; - constexpr int compare(basic_string_view s) const noexcept; - constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const; - constexpr int compare(size_type pos1, size_type n1, - basic_string_view s, size_type pos2, size_type n2) const; - constexpr int compare(const charT* s) const; - constexpr int compare(size_type pos1, size_type n1, const charT* s) const; - constexpr int compare(size_type pos1, size_type n1, - const charT* s, size_type n2) const; - constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept; - constexpr size_type find(charT c, size_type pos = 0) const noexcept; - constexpr size_type find(const charT* s, size_type pos, size_type n) const; - constexpr size_type find(const charT* s, size_type pos = 0) const; - constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept; - constexpr size_type rfind(charT c, size_type pos = npos) const noexcept; - constexpr size_type rfind(const charT* s, size_type pos, size_type n) const; - constexpr size_type rfind(const charT* s, size_type pos = npos) const; - constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept; - constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept; - constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const; - constexpr size_type find_first_of(const charT* s, size_type pos = 0) const; - constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept; - constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept; - constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const; - constexpr size_type find_last_of(const charT* s, size_type pos = npos) const; - constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept; - constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept; - constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; - constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const; - constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept; - constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept; - constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; - constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const; - - private: - const_pointer data_; // exposition only - size_type size_; // exposition only - }; - - } // namespace fundamentals_v1 - } // namespace experimental - - // 7.11, Hash support - template struct hash; - template <> struct hash; - template <> struct hash; - template <> struct hash; - template <> struct hash; - -} // namespace std - - -*/ - -#include - -#include -#include -#include -#include -#include -#include - -#include <__debug> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_LFTS - - template > - class _LIBCPP_TEMPLATE_VIS basic_string_view { - public: - // types - typedef _Traits traits_type; - typedef _CharT value_type; - typedef const _CharT* pointer; - typedef const _CharT* const_pointer; - typedef const _CharT& reference; - typedef const _CharT& const_reference; - typedef const_pointer const_iterator; // See [string.view.iterators] - typedef const_iterator iterator; - typedef _VSTD::reverse_iterator const_reverse_iterator; - typedef const_reverse_iterator reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); - - // [string.view.cons], construct/copy - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {} - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - basic_string_view(const basic_string_view&) _NOEXCEPT = default; - - _LIBCPP_INLINE_VISIBILITY - basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default; - - template - _LIBCPP_INLINE_VISIBILITY - basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT - : __data (__str.data()), __size(__str.size()) {} - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - basic_string_view(const _CharT* __s, size_type __len) - : __data(__s), __size(__len) - { -// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr"); - } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - basic_string_view(const _CharT* __s) - : __data(__s), __size(_Traits::length(__s)) {} - - // [string.view.iterators], iterators - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT { return cbegin(); } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT { return cend(); } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT { return __data; } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT { return __data + __size; } - - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } - - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } - - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } - - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } - - // [string.view.capacity], capacity - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT { return __size; } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - size_type length() const _NOEXCEPT { return __size; } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits::max(); } - - _LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY - empty() const _NOEXCEPT { return __size == 0; } - - // [string.view.access], element access - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_reference operator[](size_type __pos) const { return __data[__pos]; } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_reference at(size_type __pos) const - { - return __pos >= size() - ? (__throw_out_of_range("string_view::at"), __data[0]) - : __data[__pos]; - } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_reference front() const - { - return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0]; - } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_reference back() const - { - return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1]; - } - - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_pointer data() const _NOEXCEPT { return __data; } - - // [string.view.modifiers], modifiers: - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - __data = nullptr; - __size = 0; - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - void remove_prefix(size_type __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()"); - __data += __n; - __size -= __n; - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - void remove_suffix(size_type __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()"); - __size -= __n; - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - void swap(basic_string_view& __other) _NOEXCEPT - { - const value_type *__p = __data; - __data = __other.__data; - __other.__data = __p; - - size_type __sz = __size; - __size = __other.__size; - __other.__size = __sz; -// _VSTD::swap( __data, __other.__data ); -// _VSTD::swap( __size, __other.__size ); - } - - // [string.view.ops], string operations: - template - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const - { return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); } - - template > - _LIBCPP_INLINE_VISIBILITY - basic_string<_CharT, _Traits, _Allocator> - to_string( const _Allocator& __a = _Allocator()) const - { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); } - - size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const - { - if ( __pos > size()) - __throw_out_of_range("string_view::copy"); - size_type __rlen = _VSTD::min( __n, size() - __pos ); - _VSTD::copy_n(begin() + __pos, __rlen, __s ); - return __rlen; - } - - _LIBCPP_CONSTEXPR - basic_string_view substr(size_type __pos = 0, size_type __n = npos) const - { -// if (__pos > size()) -// __throw_out_of_range("string_view::substr"); -// size_type __rlen = _VSTD::min( __n, size() - __pos ); -// return basic_string_view(data() + __pos, __rlen); - return __pos > size() - ? (__throw_out_of_range("string_view::substr"), basic_string_view()) - : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos)); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT - { - size_type __rlen = _VSTD::min( size(), __sv.size()); - int __retval = _Traits::compare(data(), __sv.data(), __rlen); - if ( __retval == 0 ) // first __rlen chars matched - __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 ); - return __retval; - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const - { - return substr(__pos1, __n1).compare(__sv); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - int compare( size_type __pos1, size_type __n1, - basic_string_view _sv, size_type __pos2, size_type __n2) const - { - return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - int compare(const _CharT* __s) const - { - return compare(basic_string_view(__s)); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - int compare(size_type __pos1, size_type __n1, const _CharT* __s) const - { - return substr(__pos1, __n1).compare(basic_string_view(__s)); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const - { - return substr(__pos1, __n1).compare(basic_string_view(__s, __n2)); - } - - // find - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT - { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); - return _VSTD::__str_find - (data(), size(), __s.data(), __pos, __s.size()); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT - { - return _VSTD::__str_find - (data(), size(), __c, __pos); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find(const _CharT* __s, size_type __pos, size_type __n) const - { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): received nullptr"); - return _VSTD::__str_find - (data(), size(), __s, __pos, __n); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find(const _CharT* __s, size_type __pos = 0) const - { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): received nullptr"); - return _VSTD::__str_find - (data(), size(), __s, __pos, traits_type::length(__s)); - } - - // rfind - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT - { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); - return _VSTD::__str_rfind - (data(), size(), __s.data(), __pos, __s.size()); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT - { - return _VSTD::__str_rfind - (data(), size(), __c, __pos); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const - { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr"); - return _VSTD::__str_rfind - (data(), size(), __s, __pos, __n); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type rfind(const _CharT* __s, size_type __pos=npos) const - { - _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): received nullptr"); - return _VSTD::__str_rfind - (data(), size(), __s, __pos, traits_type::length(__s)); - } - - // find_first_of - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT - { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr"); - return _VSTD::__str_find_first_of - (data(), size(), __s.data(), __pos, __s.size()); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT - { return find(__c, __pos); } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const - { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr"); - return _VSTD::__str_find_first_of - (data(), size(), __s, __pos, __n); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_of(const _CharT* __s, size_type __pos=0) const - { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): received nullptr"); - return _VSTD::__str_find_first_of - (data(), size(), __s, __pos, traits_type::length(__s)); - } - - // find_last_of - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT - { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr"); - return _VSTD::__str_find_last_of - (data(), size(), __s.data(), __pos, __s.size()); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT - { return rfind(__c, __pos); } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const - { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr"); - return _VSTD::__str_find_last_of - (data(), size(), __s, __pos, __n); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_of(const _CharT* __s, size_type __pos=npos) const - { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): received nullptr"); - return _VSTD::__str_find_last_of - (data(), size(), __s, __pos, traits_type::length(__s)); - } - - // find_first_not_of - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT - { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr"); - return _VSTD::__str_find_first_not_of - (data(), size(), __s.data(), __pos, __s.size()); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT - { - return _VSTD::__str_find_first_not_of - (data(), size(), __c, __pos); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr"); - return _VSTD::__str_find_first_not_of - (data(), size(), __s, __pos, __n); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const - { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): received nullptr"); - return _VSTD::__str_find_first_not_of - (data(), size(), __s, __pos, traits_type::length(__s)); - } - - // find_last_not_of - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT - { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr"); - return _VSTD::__str_find_last_not_of - (data(), size(), __s.data(), __pos, __s.size()); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT - { - return _VSTD::__str_find_last_not_of - (data(), size(), __c, __pos); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr"); - return _VSTD::__str_find_last_not_of - (data(), size(), __s, __pos, __n); - } - - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const - { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): received nullptr"); - return _VSTD::__str_find_last_not_of - (data(), size(), __s, __pos, traits_type::length(__s)); - } - - private: - const value_type* __data; - size_type __size; - }; - - - // [string.view.comparison] - // operator == - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator==(basic_string_view<_CharT, _Traits> __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - if ( __lhs.size() != __rhs.size()) return false; - return __lhs.compare(__rhs) == 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator==(basic_string_view<_CharT, _Traits> __lhs, - typename _VSTD::common_type >::type __rhs) _NOEXCEPT - { - if ( __lhs.size() != __rhs.size()) return false; - return __lhs.compare(__rhs) == 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator==(typename _VSTD::common_type >::type __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - if ( __lhs.size() != __rhs.size()) return false; - return __lhs.compare(__rhs) == 0; - } - - - // operator != - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - if ( __lhs.size() != __rhs.size()) - return true; - return __lhs.compare(__rhs) != 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator!=(basic_string_view<_CharT, _Traits> __lhs, - typename _VSTD::common_type >::type __rhs) _NOEXCEPT - { - if ( __lhs.size() != __rhs.size()) - return true; - return __lhs.compare(__rhs) != 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator!=(typename _VSTD::common_type >::type __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - if ( __lhs.size() != __rhs.size()) - return true; - return __lhs.compare(__rhs) != 0; - } - - - // operator < - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) < 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator<(basic_string_view<_CharT, _Traits> __lhs, - typename _VSTD::common_type >::type __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) < 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator<(typename _VSTD::common_type >::type __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) < 0; - } - - - // operator > - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) > 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator>(basic_string_view<_CharT, _Traits> __lhs, - typename _VSTD::common_type >::type __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) > 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator>(typename _VSTD::common_type >::type __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) > 0; - } - - - // operator <= - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) <= 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator<=(basic_string_view<_CharT, _Traits> __lhs, - typename _VSTD::common_type >::type __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) <= 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator<=(typename _VSTD::common_type >::type __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) <= 0; - } - - - // operator >= - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) >= 0; - } - - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator>=(basic_string_view<_CharT, _Traits> __lhs, - typename _VSTD::common_type >::type __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) >= 0; - } - - template - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator>=(typename _VSTD::common_type >::type __lhs, - basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT - { - return __lhs.compare(__rhs) >= 0; - } - - - // [string.view.io] - template - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) - { - return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); - } - - typedef basic_string_view string_view; - typedef basic_string_view u16string_view; - typedef basic_string_view u32string_view; - typedef basic_string_view wstring_view; - -_LIBCPP_END_NAMESPACE_LFTS -_LIBCPP_BEGIN_NAMESPACE_STD - -// [string.view.hash] -// Shamelessly stolen from -template -struct _LIBCPP_TEMPLATE_VIS hash > - : public unary_function, size_t> -{ - size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT; -}; - -template -size_t -hash >::operator()( - const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT -{ - return __do_string_hash(__val.data(), __val.data() + __val.size()); -} - -#if _LIBCPP_STD_VER > 11 -template -__quoted_output_proxy<_CharT, const _CharT *, _Traits> -quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv, - _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) -{ - return __quoted_output_proxy<_CharT, const _CharT *, _Traits> - ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape ); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_LFTS_STRING_VIEW +#error " has been removed. Use instead." diff --git a/include/module.modulemap b/include/module.modulemap index 808ca9896..9775447ec 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -558,10 +558,6 @@ module std [system] { header "experimental/string" export * } - module string_view { - header "experimental/string_view" - export * - } module system_error { header "experimental/system_error" export * diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index 32616335d..d10849eb4 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -153,7 +153,6 @@ #include #include #include -#include #include #include #include diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp index fdb3f1621..f245d35c4 100644 --- a/test/libcxx/min_max_macros.sh.cpp +++ b/test/libcxx/min_max_macros.sh.cpp @@ -267,8 +267,6 @@ TEST_MACROS(); TEST_MACROS(); #include TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include diff --git a/test/std/experimental/nothing_to_do.pass.cpp b/test/std/experimental/nothing_to_do.pass.cpp index c21f8a701..86bf8cc11 100644 --- a/test/std/experimental/nothing_to_do.pass.cpp +++ b/test/std/experimental/nothing_to_do.pass.cpp @@ -7,6 +7,4 @@ // //===----------------------------------------------------------------------===// -#include - int main () {} diff --git a/test/std/experimental/string.view/lit.local.cfg b/test/std/experimental/string.view/lit.local.cfg deleted file mode 100644 index 376dbe7c1..000000000 --- a/test/std/experimental/string.view/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Disable all of the filesystem tests if the correct feature is not available. -if 'msvc' in config.available_features: - config.unsupported = True diff --git a/test/std/experimental/string.view/nothing_to_do.pass.cpp b/test/std/experimental/string.view/nothing_to_do.pass.cpp deleted file mode 100644 index c21f8a701..000000000 --- a/test/std/experimental/string.view/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -int main () {} diff --git a/test/std/experimental/string.view/string.view.access/at.pass.cpp b/test/std/experimental/string.view/string.view.access/at.pass.cpp deleted file mode 100644 index eaea06298..000000000 --- a/test/std/experimental/string.view/string.view.access/at.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// NOTE: Older versions of clang have a bug where they fail to evaluate -// string_view::at as a constant expression. -// XFAIL: clang-3.4, clang-3.3 - - -// - -// constexpr const _CharT& at(size_type _pos) const; - -#include -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - std::experimental::basic_string_view sv ( s, len ); - assert ( sv.length() == len ); - for ( size_t i = 0; i < len; ++i ) { - assert ( sv.at(i) == s[i] ); - assert ( &sv.at(i) == s + i ); - } - -#ifndef TEST_HAS_NO_EXCEPTIONS - try { sv.at(len); } catch ( const std::out_of_range & ) { return ; } - assert ( false ); -#endif -} - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); -#endif - -#if TEST_STD_VER >= 11 - { - constexpr std::experimental::basic_string_view sv ( "ABC", 2 ); - static_assert ( sv.length() == 2, "" ); - static_assert ( sv.at(0) == 'A', "" ); - static_assert ( sv.at(1) == 'B', "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.access/back.pass.cpp b/test/std/experimental/string.view/string.view.access/back.pass.cpp deleted file mode 100644 index 09f795034..000000000 --- a/test/std/experimental/string.view/string.view.access/back.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr const _CharT& front(); - -#include -#include - -#include "test_macros.h" - -template -bool test ( const CharT *s, size_t len ) { - std::experimental::basic_string_view sv ( s, len ); - assert ( sv.length() == len ); - assert ( sv.back() == s[len-1] ); - return &sv.back() == s + len - 1; - } - -int main () { - assert ( test ( "ABCDE", 5 )); - assert ( test ( "a", 1 )); - - assert ( test ( L"ABCDE", 5 )); - assert ( test ( L"a", 1 )); - -#if TEST_STD_VER >= 11 - assert ( test ( u"ABCDE", 5 )); - assert ( test ( u"a", 1 )); - - assert ( test ( U"ABCDE", 5 )); - assert ( test ( U"a", 1 )); -#endif - -#if TEST_STD_VER >= 11 - { - constexpr std::experimental::basic_string_view sv ( "ABC", 2 ); - static_assert ( sv.length() == 2, "" ); - static_assert ( sv.back() == 'B', "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.access/data.pass.cpp b/test/std/experimental/string.view/string.view.access/data.pass.cpp deleted file mode 100644 index 4b581d653..000000000 --- a/test/std/experimental/string.view/string.view.access/data.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr const _CharT* data() const noexcept; - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - std::experimental::basic_string_view sv ( s, len ); - assert ( sv.length() == len ); - assert ( sv.data() == s ); - } - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); -#endif - -#if TEST_STD_VER > 11 - { - constexpr const char *s = "ABC"; - constexpr std::experimental::basic_string_view sv( s, 2 ); - static_assert( sv.length() == 2, "" ); - static_assert( sv.data() == s, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.access/front.pass.cpp b/test/std/experimental/string.view/string.view.access/front.pass.cpp deleted file mode 100644 index acb00a46a..000000000 --- a/test/std/experimental/string.view/string.view.access/front.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr const _CharT& back(); - -#include -#include - -#include "test_macros.h" - -template -bool test ( const CharT *s, size_t len ) { - std::experimental::basic_string_view sv ( s, len ); - assert ( sv.length() == len ); - assert ( sv.front() == s[0] ); - return &sv.front() == s; - } - -int main () { - assert ( test ( "ABCDE", 5 )); - assert ( test ( "a", 1 )); - - assert ( test ( L"ABCDE", 5 )); - assert ( test ( L"a", 1 )); - -#if TEST_STD_VER >= 11 - assert ( test ( u"ABCDE", 5 )); - assert ( test ( u"a", 1 )); - - assert ( test ( U"ABCDE", 5 )); - assert ( test ( U"a", 1 )); -#endif - -#if TEST_STD_VER >= 11 - { - constexpr std::experimental::basic_string_view sv ( "ABC", 2 ); - static_assert ( sv.length() == 2, "" ); - static_assert ( sv.front() == 'A', "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.access/index.pass.cpp b/test/std/experimental/string.view/string.view.access/index.pass.cpp deleted file mode 100644 index 0cb385eef..000000000 --- a/test/std/experimental/string.view/string.view.access/index.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr const _CharT& operator[](size_type _pos) const; - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - std::experimental::basic_string_view sv ( s, len ); - assert ( sv.length() == len ); - for ( size_t i = 0; i < len; ++i ) { - assert ( sv[i] == s[i] ); - assert ( &sv[i] == s + i ); - } - } - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); -#endif - -#if TEST_STD_VER > 11 - { - constexpr std::experimental::basic_string_view sv ( "ABC", 2 ); - static_assert ( sv.length() == 2, "" ); - static_assert ( sv[0] == 'A', "" ); - static_assert ( sv[1] == 'B', "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp deleted file mode 100644 index a5108bf12..000000000 --- a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp +++ /dev/null @@ -1,89 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// [string.view.capacity], capacity -// constexpr size_type size() const noexcept; -// constexpr size_type length() const noexcept; -// constexpr size_type max_size() const noexcept; -// constexpr bool empty() const noexcept; - -#include -#include - -#include "test_macros.h" - -template -void test1 () { -#if TEST_STD_VER > 11 - { - constexpr SV sv1; - static_assert ( sv1.size() == 0, "" ); - static_assert ( sv1.empty(), ""); - static_assert ( sv1.size() == sv1.length(), "" ); - static_assert ( sv1.max_size() > sv1.size(), ""); - } -#endif - - { - SV sv1; - assert ( sv1.size() == 0 ); - assert ( sv1.empty()); - assert ( sv1.size() == sv1.length()); - assert ( sv1.max_size() > sv1.size()); - } -} - -template -void test2 ( const CharT *s, size_t len ) { - { - std::experimental::basic_string_view sv1 ( s ); - assert ( sv1.size() == len ); - assert ( sv1.data() == s ); - assert ( sv1.empty() == (len == 0)); - assert ( sv1.size() == sv1.length()); - assert ( sv1.max_size() > sv1.size()); - } -} - -int main () { - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test1 (); - test1 (); - test1 (); - test1 (); - - test2 ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 ); - test2 ( "ABCDE", 5 ); - test2 ( "a", 1 ); - test2 ( "", 0 ); - - test2 ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 ); - test2 ( L"ABCDE", 5 ); - test2 ( L"a", 1 ); - test2 ( L"", 0 ); - -#if TEST_STD_VER >= 11 - test2 ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 ); - test2 ( u"ABCDE", 5 ); - test2 ( u"a", 1 ); - test2 ( u"", 0 ); - - test2 ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 ); - test2 ( U"ABCDE", 5 ); - test2 ( U"a", 1 ); - test2 ( U"", 0 ); -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp deleted file mode 100644 index bd566a986..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator==(basic_string_view lhs, const charT* rhs); -// template -// constexpr bool operator==(const charT* lhs, basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(S lhs, const typename S::value_type* rhs, bool x) -{ - assert((lhs == rhs) == x); - assert((rhs == lhs) == x); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), "", true); - test(S(""), "abcde", false); - test(S(""), "abcdefghij", false); - test(S(""), "abcdefghijklmnopqrst", false); - test(S("abcde"), "", false); - test(S("abcde"), "abcde", true); - test(S("abcde"), "abcdefghij", false); - test(S("abcde"), "abcdefghijklmnopqrst", false); - test(S("abcdefghij"), "", false); - test(S("abcdefghij"), "abcde", false); - test(S("abcdefghij"), "abcdefghij", true); - test(S("abcdefghij"), "abcdefghijklmnopqrst", false); - test(S("abcdefghijklmnopqrst"), "", false); - test(S("abcdefghijklmnopqrst"), "abcde", false); - test(S("abcdefghijklmnopqrst"), "abcdefghij", false); - test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - static_assert ( sv1 == "", "" ); - static_assert ( "" == sv1, "" ); - static_assert (!(sv1 == "abcde"), "" ); - static_assert (!("abcde" == sv1), "" ); - - static_assert ( sv2 == "abcde", "" ); - static_assert ( "abcde" == sv2, "" ); - static_assert (!(sv2 == "abcde0"), "" ); - static_assert (!("abcde0" == sv2), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp deleted file mode 100644 index 1fd72d796..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator==(const charT* lhs, const basic_string rhs); -// template -// bool operator==(const basic_string_view lhs, const CharT* rhs); - -#include -#include - -template -void -test(const std::string &lhs, S rhs, bool x) -{ - assert((lhs == rhs) == x); - assert((rhs == lhs) == x); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test("", S(""), true); - test("", S("abcde"), false); - test("", S("abcdefghij"), false); - test("", S("abcdefghijklmnopqrst"), false); - test("abcde", S(""), false); - test("abcde", S("abcde"), true); - test("abcde", S("abcdefghij"), false); - test("abcde", S("abcdefghijklmnopqrst"), false); - test("abcdefghij", S(""), false); - test("abcdefghij", S("abcde"), false); - test("abcdefghij", S("abcdefghij"), true); - test("abcdefghij", S("abcdefghijklmnopqrst"), false); - test("abcdefghijklmnopqrst", S(""), false); - test("abcdefghijklmnopqrst", S("abcde"), false); - test("abcdefghijklmnopqrst", S("abcdefghij"), false); - test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); - } -} - diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp deleted file mode 100644 index 51decdca6..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator==(const basic_string_view lhs, -// const basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(S lhs, S rhs, bool x) -{ - assert((lhs == rhs) == x); - assert((rhs == lhs) == x); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), S(""), true); - test(S(""), S("abcde"), false); - test(S(""), S("abcdefghij"), false); - test(S(""), S("abcdefghijklmnopqrst"), false); - test(S("abcde"), S(""), false); - test(S("abcde"), S("abcde"), true); - test(S("abcde"), S("abcdefghij"), false); - test(S("abcde"), S("abcdefghijklmnopqrst"), false); - test(S("abcdefghij"), S(""), false); - test(S("abcdefghij"), S("abcde"), false); - test(S("abcdefghij"), S("abcdefghij"), true); - test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); - test(S("abcdefghijklmnopqrst"), S(""), false); - test(S("abcdefghijklmnopqrst"), S("abcde"), false); - test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); - test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2; - constexpr SV sv3 { "abcde", 5 }; - static_assert ( sv1 == sv2, "" ); - static_assert (!(sv1 == sv3), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp deleted file mode 100644 index cf8a30a39..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator>=(const charT* lhs, basic_string_wiew rhs); -// template -// constexpr bool operator>=(basic_string_wiew lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const typename S::value_type* lhs, const S& rhs, bool x, bool y) -{ - assert((lhs >= rhs) == x); - assert((rhs >= lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test("", S(""), true, true); - test("", S("abcde"), false, true); - test("", S("abcdefghij"), false, true); - test("", S("abcdefghijklmnopqrst"), false, true); - test("abcde", S(""), true, false); - test("abcde", S("abcde"), true, true); - test("abcde", S("abcdefghij"), false, true); - test("abcde", S("abcdefghijklmnopqrst"), false, true); - test("abcdefghij", S(""), true, false); - test("abcdefghij", S("abcde"), true, false); - test("abcdefghij", S("abcdefghij"), true, true); - test("abcdefghij", S("abcdefghijklmnopqrst"), false, true); - test("abcdefghijklmnopqrst", S(""), true, false); - test("abcdefghijklmnopqrst", S("abcde"), true, false); - test("abcdefghijklmnopqrst", S("abcdefghij"), true, false); - test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert ( sv1 >= "", "" ); - static_assert ( "" >= sv1, "" ); - static_assert (!(sv1 >= "abcde"), "" ); - static_assert ( "abcde" >= sv1, "" ); - - static_assert ( sv2 >= "", "" ); - static_assert (!("" >= sv2), "" ); - static_assert ( sv2 >= "abcde", "" ); - static_assert ( "abcde" >= sv2, "" ); - static_assert (!(sv2 >= "abcde0"), "" ); - static_assert ( "abcde0" >= sv2, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.string.pass.cpp deleted file mode 100644 index 0790f80f8..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator>=(const basic_string& lhs, -// basic_string_view rhs); -// bool operator>=(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -template -void -test(const S& lhs, const typename S::value_type* rhs, bool x, bool y) -{ - assert((lhs >= rhs) == x); - assert((rhs >= lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), "", true, true); - test(S(""), "abcde", false, true); - test(S(""), "abcdefghij", false, true); - test(S(""), "abcdefghijklmnopqrst", false, true); - test(S("abcde"), "", true, false); - test(S("abcde"), "abcde", true, true); - test(S("abcde"), "abcdefghij", false, true); - test(S("abcde"), "abcdefghijklmnopqrst", false, true); - test(S("abcdefghij"), "", true, false); - test(S("abcdefghij"), "abcde", true, false); - test(S("abcdefghij"), "abcdefghij", true, true); - test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true); - test(S("abcdefghijklmnopqrst"), "", true, false); - test(S("abcdefghijklmnopqrst"), "abcde", true, false); - test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false); - test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true, true); - } -} diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp deleted file mode 100644 index 1bacf285f..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator>=(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& lhs, const S& rhs, bool x, bool y) -{ - assert((lhs >= rhs) == x); - assert((rhs >= lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), S(""), true, true); - test(S(""), S("abcde"), false, true); - test(S(""), S("abcdefghij"), false, true); - test(S(""), S("abcdefghijklmnopqrst"), false, true); - test(S("abcde"), S(""), true, false); - test(S("abcde"), S("abcde"), true, true); - test(S("abcde"), S("abcdefghij"), false, true); - test(S("abcde"), S("abcdefghijklmnopqrst"), false, true); - test(S("abcdefghij"), S(""), true, false); - test(S("abcdefghij"), S("abcde"), true, false); - test(S("abcdefghij"), S("abcdefghij"), true, true); - test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false, true); - test(S("abcdefghijklmnopqrst"), S(""), true, false); - test(S("abcdefghijklmnopqrst"), S("abcde"), true, false); - test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true, false); - test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert ( sv1 >= sv1, "" ); - static_assert ( sv2 >= sv2, "" ); - - static_assert (!(sv1 >= sv2), "" ); - static_assert ( sv2 >= sv1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp deleted file mode 100644 index 0aae3d41a..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr template -// bool operator>(const charT* lhs, basic_string_wiew rhs); -// constexpr template -// bool operator>(basic_string_wiew lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const typename S::value_type* lhs, const S& rhs, bool x, bool y) -{ - assert((lhs > rhs) == x); - assert((rhs > lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test("", S(""), false, false); - test("", S("abcde"), false, true); - test("", S("abcdefghij"), false, true); - test("", S("abcdefghijklmnopqrst"), false, true); - test("abcde", S(""), true, false); - test("abcde", S("abcde"), false, false); - test("abcde", S("abcdefghij"), false, true); - test("abcde", S("abcdefghijklmnopqrst"), false, true); - test("abcdefghij", S(""), true, false); - test("abcdefghij", S("abcde"), true, false); - test("abcdefghij", S("abcdefghij"), false, false); - test("abcdefghij", S("abcdefghijklmnopqrst"), false, true); - test("abcdefghijklmnopqrst", S(""), true, false); - test("abcdefghijklmnopqrst", S("abcde"), true, false); - test("abcdefghijklmnopqrst", S("abcdefghij"), true, false); - test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (!(sv1 > ""), "" ); - static_assert (!("" > sv1), "" ); - static_assert (!(sv1 > "abcde"), "" ); - static_assert ( "abcde" > sv1, "" ); - - static_assert ( sv2 > "", "" ); - static_assert (!("" > sv2), "" ); - static_assert (!(sv2 > "abcde"), "" ); - static_assert (!("abcde" > sv2), "" ); - static_assert (!(sv2 > "abcde0"), "" ); - static_assert ( "abcde0" > sv2, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string.pass.cpp deleted file mode 100644 index 92f812f82..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator>(const basic_string& lhs, -// basic_string_view rhs); -// bool operator>(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -template -void -test(const S& lhs, const typename S::value_type* rhs, bool x, bool y) -{ - assert((lhs > rhs) == x); - assert((rhs > lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), "", false, false); - test(S(""), "abcde", false, true); - test(S(""), "abcdefghij", false, true); - test(S(""), "abcdefghijklmnopqrst", false, true); - test(S("abcde"), "", true, false); - test(S("abcde"), "abcde", false, false); - test(S("abcde"), "abcdefghij", false, true); - test(S("abcde"), "abcdefghijklmnopqrst", false, true); - test(S("abcdefghij"), "", true, false); - test(S("abcdefghij"), "abcde", true, false); - test(S("abcdefghij"), "abcdefghij", false, false); - test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true); - test(S("abcdefghijklmnopqrst"), "", true, false); - test(S("abcdefghijklmnopqrst"), "abcde", true, false); - test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false); - test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false); - } -} diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp deleted file mode 100644 index e014872a6..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator>(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& lhs, const S& rhs, bool x, bool y) -{ - assert((lhs > rhs) == x); - assert((rhs > lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), S(""), false, false); - test(S(""), S("abcde"), false, true); - test(S(""), S("abcdefghij"), false, true); - test(S(""), S("abcdefghijklmnopqrst"), false, true); - test(S("abcde"), S(""), true, false); - test(S("abcde"), S("abcde"), false, false); - test(S("abcde"), S("abcdefghij"), false, true); - test(S("abcde"), S("abcdefghijklmnopqrst"), false, true); - test(S("abcdefghij"), S(""), true, false); - test(S("abcdefghij"), S("abcde"), true, false); - test(S("abcdefghij"), S("abcdefghij"), false, false); - test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false, true); - test(S("abcdefghijklmnopqrst"), S(""), true, false); - test(S("abcdefghijklmnopqrst"), S("abcde"), true, false); - test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true, false); - test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (!(sv1 > sv1), "" ); - static_assert (!(sv2 > sv2), "" ); - - static_assert (!(sv1 > sv2), "" ); - static_assert ( sv2 > sv1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp deleted file mode 100644 index bdc4c966f..000000000 --- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<=(const charT* lhs, basic_string_wiew rhs); -// template -// constexpr bool operator<=(basic_string_wiew lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const typename S::value_type* lhs, const S& rhs, bool x, bool y) -{ - assert((lhs <= rhs) == x); - assert((rhs <= lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test("", S(""), true, true); - test("", S("abcde"), true, false); - test("", S("abcdefghij"), true, false); - test("", S("abcdefghijklmnopqrst"), true, false); - test("abcde", S(""), false, true); - test("abcde", S("abcde"), true, true); - test("abcde", S("abcdefghij"), true, false); - test("abcde", S("abcdefghijklmnopqrst"), true, false); - test("abcdefghij", S(""), false, true); - test("abcdefghij", S("abcde"), false, true); - test("abcdefghij", S("abcdefghij"), true, true); - test("abcdefghij", S("abcdefghijklmnopqrst"), true, false); - test("abcdefghijklmnopqrst", S(""), false, true); - test("abcdefghijklmnopqrst", S("abcde"), false, true); - test("abcdefghijklmnopqrst", S("abcdefghij"), false, true); - test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert ( sv1 <= "", "" ); - static_assert ( "" <= sv1, "" ); - static_assert ( sv1 <= "abcde", "" ); - static_assert (!("abcde" <= sv1), "" ); - - static_assert (!(sv2 <= ""), "" ); - static_assert ( "" <= sv2, "" ); - static_assert ( sv2 <= "abcde", "" ); - static_assert ( "abcde" <= sv2, "" ); - static_assert ( sv2 <= "abcde0", "" ); - static_assert (!("abcde0" <= sv2), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.string.pass.cpp deleted file mode 100644 index 39abbd04f..000000000 --- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator<=(const basic_string& lhs, -// basic_string_view rhs); -// bool operator<=(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -template -void -test(const S& lhs, const typename S::value_type* rhs, bool x, bool y) -{ - assert((lhs <= rhs) == x); - assert((rhs <= lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), "", true, true); - test(S(""), "abcde", true, false); - test(S(""), "abcdefghij", true, false); - test(S(""), "abcdefghijklmnopqrst", true, false); - test(S("abcde"), "", false, true); - test(S("abcde"), "abcde", true, true); - test(S("abcde"), "abcdefghij", true, false); - test(S("abcde"), "abcdefghijklmnopqrst", true, false); - test(S("abcdefghij"), "", false, true); - test(S("abcdefghij"), "abcde", false, true); - test(S("abcdefghij"), "abcdefghij", true, true); - test(S("abcdefghij"), "abcdefghijklmnopqrst", true, false); - test(S("abcdefghijklmnopqrst"), "", false, true); - test(S("abcdefghijklmnopqrst"), "abcde", false, true); - test(S("abcdefghijklmnopqrst"), "abcdefghij", false, true); - test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true, true); - } -} diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp deleted file mode 100644 index e814283ad..000000000 --- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<=(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& lhs, const S& rhs, bool x, bool y) -{ - assert((lhs <= rhs) == x); - assert((rhs <= lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), S(""), true, true); - test(S(""), S("abcde"), true, false); - test(S(""), S("abcdefghij"), true, false); - test(S(""), S("abcdefghijklmnopqrst"), true, false); - test(S("abcde"), S(""), false, true); - test(S("abcde"), S("abcde"), true, true); - test(S("abcde"), S("abcdefghij"), true, false); - test(S("abcde"), S("abcdefghijklmnopqrst"), true, false); - test(S("abcdefghij"), S(""), false, true); - test(S("abcdefghij"), S("abcde"), false, true); - test(S("abcdefghij"), S("abcdefghij"), true, true); - test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true, false); - test(S("abcdefghijklmnopqrst"), S(""), false, true); - test(S("abcdefghijklmnopqrst"), S("abcde"), false, true); - test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false, true); - test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert ( sv1 <= sv1, "" ); - static_assert ( sv2 <= sv2, "" ); - - static_assert ( sv1 <= sv2, "" ); - static_assert (!(sv2 <= sv1), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp deleted file mode 100644 index 10e82437c..000000000 --- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<(const charT* lhs, basic_string_wiew rhs); -// template -// constexpr bool operator<(basic_string_wiew lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const typename S::value_type* lhs, const S& rhs, bool x, bool y) -{ - assert((lhs < rhs) == x); - assert((rhs < lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test("", S(""), false, false); - test("", S("abcde"), true, false); - test("", S("abcdefghij"), true, false); - test("", S("abcdefghijklmnopqrst"), true, false); - test("abcde", S(""), false, true); - test("abcde", S("abcde"), false, false); - test("abcde", S("abcdefghij"), true, false); - test("abcde", S("abcdefghijklmnopqrst"), true, false); - test("abcdefghij", S(""), false, true); - test("abcdefghij", S("abcde"), false, true); - test("abcdefghij", S("abcdefghij"), false, false); - test("abcdefghij", S("abcdefghijklmnopqrst"), true, false); - test("abcdefghijklmnopqrst", S(""), false, true); - test("abcdefghijklmnopqrst", S("abcde"), false, true); - test("abcdefghijklmnopqrst", S("abcdefghij"), false, true); - test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (!(sv1 < ""), "" ); - static_assert (!("" < sv1), "" ); - static_assert ( sv1 < "abcde", "" ); - static_assert (!("abcde" < sv1), "" ); - - static_assert (!(sv2 < ""), "" ); - static_assert ( "" < sv2, "" ); - static_assert (!(sv2 < "abcde"), "" ); - static_assert (!("abcde" < sv2), "" ); - static_assert ( sv2 < "abcde0", "" ); - static_assert (!("abcde0" < sv2), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string.pass.cpp deleted file mode 100644 index 51ea639ba..000000000 --- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator<(const basic_string& lhs, -// basic_string_view rhs); -// bool operator<(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -template -void -test(const S& lhs, const typename S::value_type* rhs, bool x, bool y) -{ - assert((lhs < rhs) == x); - assert((rhs < lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), "", false, false); - test(S(""), "abcde", true, false); - test(S(""), "abcdefghij", true, false); - test(S(""), "abcdefghijklmnopqrst", true, false); - test(S("abcde"), "", false, true); - test(S("abcde"), "abcde", false, false); - test(S("abcde"), "abcdefghij", true, false); - test(S("abcde"), "abcdefghijklmnopqrst", true, false); - test(S("abcdefghij"), "", false, true); - test(S("abcdefghij"), "abcde", false, true); - test(S("abcdefghij"), "abcdefghij", false, false); - test(S("abcdefghij"), "abcdefghijklmnopqrst", true, false); - test(S("abcdefghijklmnopqrst"), "", false, true); - test(S("abcdefghijklmnopqrst"), "abcde", false, true); - test(S("abcdefghijklmnopqrst"), "abcdefghij", false, true); - test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false); - } -} diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp deleted file mode 100644 index 77d8fa3e5..000000000 --- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& lhs, const S& rhs, bool x, bool y) -{ - assert((lhs < rhs) == x); - assert((rhs < lhs) == y); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), S(""), false, false); - test(S(""), S("abcde"), true, false); - test(S(""), S("abcdefghij"), true, false); - test(S(""), S("abcdefghijklmnopqrst"), true, false); - test(S("abcde"), S(""), false, true); - test(S("abcde"), S("abcde"), false, false); - test(S("abcde"), S("abcdefghij"), true, false); - test(S("abcde"), S("abcdefghijklmnopqrst"), true, false); - test(S("abcdefghij"), S(""), false, true); - test(S("abcdefghij"), S("abcde"), false, true); - test(S("abcdefghij"), S("abcdefghij"), false, false); - test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true, false); - test(S("abcdefghijklmnopqrst"), S(""), false, true); - test(S("abcdefghijklmnopqrst"), S("abcde"), false, true); - test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false, true); - test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (!(sv1 < sv1), "" ); - static_assert (!(sv2 < sv2), "" ); - - static_assert ( sv1 < sv2, "" ); - static_assert (!(sv2 < sv1), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp deleted file mode 100644 index 9c13199d2..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator!=(basic_string_view lhs, const charT* rhs); -// template -// constexpr bool operator!=(const charT* lhs, basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(S lhs, const typename S::value_type* rhs, bool x) -{ - assert((lhs != rhs) == x); - assert((rhs != lhs) == x); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), "", false); - test(S(""), "abcde", true); - test(S(""), "abcdefghij", true); - test(S(""), "abcdefghijklmnopqrst", true); - test(S("abcde"), "", true); - test(S("abcde"), "abcde", false); - test(S("abcde"), "abcdefghij", true); - test(S("abcde"), "abcdefghijklmnopqrst", true); - test(S("abcdefghij"), "", true); - test(S("abcdefghij"), "abcde", true); - test(S("abcdefghij"), "abcdefghij", false); - test(S("abcdefghij"), "abcdefghijklmnopqrst", true); - test(S("abcdefghijklmnopqrst"), "", true); - test(S("abcdefghijklmnopqrst"), "abcde", true); - test(S("abcdefghijklmnopqrst"), "abcdefghij", true); - test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (!(sv1 != ""), "" ); - static_assert (!("" != sv1), "" ); - static_assert ( sv1 != "abcde", "" ); - static_assert ( "abcde" != sv1, "" ); - - static_assert (!(sv2 != "abcde"), "" ); - static_assert (!("abcde" != sv2), "" ); - static_assert ( sv2 != "abcde0", "" ); - static_assert ( "abcde0" != sv2, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.string.pass.cpp deleted file mode 100644 index 9ed0ac1d0..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator!=(const basic_string &lhs, basic_string_view rhs); -// template -// bool operator!=(basic_string_view lhs, const basic_string &rhs); - -#include -#include - -template -void -test(const std::string &lhs, S rhs, bool x) -{ - assert((lhs != rhs) == x); - assert((rhs != lhs) == x); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test("", S(""), false); - test("", S("abcde"), true); - test("", S("abcdefghij"), true); - test("", S("abcdefghijklmnopqrst"), true); - test("abcde", S(""), true); - test("abcde", S("abcde"), false); - test("abcde", S("abcdefghij"), true); - test("abcde", S("abcdefghijklmnopqrst"), true); - test("abcdefghij", S(""), true); - test("abcdefghij", S("abcde"), true); - test("abcdefghij", S("abcdefghij"), false); - test("abcdefghij", S("abcdefghijklmnopqrst"), true); - test("abcdefghijklmnopqrst", S(""), true); - test("abcdefghijklmnopqrst", S("abcde"), true); - test("abcdefghijklmnopqrst", S("abcdefghij"), true); - test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); - } -} diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp deleted file mode 100644 index c74b327f1..000000000 --- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator!=(const basic_string_view lhs, -// const basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(S lhs, S rhs, bool x) -{ - assert((lhs != rhs) == x); - assert((rhs != lhs) == x); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), S(""), false); - test(S(""), S("abcde"), true); - test(S(""), S("abcdefghij"), true); - test(S(""), S("abcdefghijklmnopqrst"), true); - test(S("abcde"), S(""), true); - test(S("abcde"), S("abcde"), false); - test(S("abcde"), S("abcdefghij"), true); - test(S("abcde"), S("abcdefghijklmnopqrst"), true); - test(S("abcdefghij"), S(""), true); - test(S("abcdefghij"), S("abcde"), true); - test(S("abcdefghij"), S("abcdefghij"), false); - test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); - test(S("abcdefghijklmnopqrst"), S(""), true); - test(S("abcdefghijklmnopqrst"), S("abcde"), true); - test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); - test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2; - constexpr SV sv3 { "abcde", 5 }; - static_assert (!( sv1 != sv2), "" ); - static_assert ( sv1 != sv3, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.cons/default.pass.cpp b/test/std/experimental/string.view/string.view.cons/default.pass.cpp deleted file mode 100644 index 37df020e7..000000000 --- a/test/std/experimental/string.view/string.view.cons/default.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr basic_string_view () noexcept; - -#include -#include - -#include "test_macros.h" - -template -void test () { -#if TEST_STD_VER > 11 - { - constexpr T sv1; - static_assert ( sv1.size() == 0, "" ); - static_assert ( sv1.empty(), ""); - } -#endif - - { - T sv1; - assert ( sv1.size() == 0 ); - assert ( sv1.empty()); - } -} - -int main () { - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test (); - test (); - test (); - test (); - -} diff --git a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp deleted file mode 100644 index a8638389e..000000000 --- a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr basic_string_view(const _CharT* _s) -// : __data (_s), __size(_Traits::length(_s)) {} - - -#include -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -size_t StrLen ( const CharT *s ) { - size_t retVal = 0; - while ( *s != 0 ) { ++retVal; ++s; } - return retVal; - } - -template -void test ( const CharT *s ) { - std::experimental::basic_string_view sv1 ( s ); - assert ( sv1.size() == StrLen( s )); - assert ( sv1.data() == s ); - } - - -int main () { - - test ( "QBCDE" ); - test ( "A" ); - test ( "" ); - - test ( L"QBCDE" ); - test ( L"A" ); - test ( L"" ); - -#if TEST_STD_VER >= 11 - test ( u"QBCDE" ); - test ( u"A" ); - test ( u"" ); - - test ( U"QBCDE" ); - test ( U"A" ); - test ( U"" ); -#endif - -#if TEST_STD_VER > 11 - { - constexpr std::experimental::basic_string_view> sv1 ( "ABCDE" ); - static_assert ( sv1.size() == 5, ""); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp deleted file mode 100644 index c2f312daa..000000000 --- a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// constexpr basic_string_view(const _CharT* _s, size_type _len) -// : __data (_s), __size(_len) {} - - -#include -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t sz ) { - { - std::experimental::basic_string_view sv1 ( s, sz ); - assert ( sv1.size() == sz ); - assert ( sv1.data() == s ); - } -} - -int main () { - - test ( "QBCDE", 5 ); - test ( "QBCDE", 2 ); - test ( "", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const char *s = "QBCDE"; - constexpr std::experimental::basic_string_view sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif - - test ( L"QBCDE", 5 ); - test ( L"QBCDE", 2 ); - test ( L"", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const wchar_t *s = L"QBCDE"; - constexpr std::experimental::basic_string_view sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif - -#if TEST_STD_VER >= 11 - test ( u"QBCDE", 5 ); - test ( u"QBCDE", 2 ); - test ( u"", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const char16_t *s = u"QBCDE"; - constexpr std::experimental::basic_string_view sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif - - test ( U"QBCDE", 5 ); - test ( U"QBCDE", 2 ); - test ( U"", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const char32_t *s = U"QBCDE"; - constexpr std::experimental::basic_string_view sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif -#endif -} diff --git a/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp deleted file mode 100644 index 4ecd2cdff..000000000 --- a/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// template -// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept - - -#include -#include -#include - -#include "test_macros.h" - -struct dummy_char_traits : public std::char_traits {}; - -template -void test ( const std::basic_string &str ) { - std::experimental::basic_string_view sv1 ( str ); - assert ( sv1.size() == str.size()); - assert ( sv1.data() == str.data()); -} - -int main () { - - test ( std::string("QBCDE") ); - test ( std::string("") ); - test ( std::string() ); - - test ( std::wstring(L"QBCDE") ); - test ( std::wstring(L"") ); - test ( std::wstring() ); - -#if TEST_STD_VER >= 11 - test ( std::u16string{u"QBCDE"} ); - test ( std::u16string{u""} ); - test ( std::u16string{} ); - - test ( std::u32string{U"QBCDE"} ); - test ( std::u32string{U""} ); - test ( std::u32string{} ); -#endif - - test ( std::basic_string("QBCDE") ); - test ( std::basic_string("") ); - test ( std::basic_string() ); - -} diff --git a/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp b/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp deleted file mode 100644 index 72e9dad83..000000000 --- a/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// template -// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept - -#include -#include -#include - -struct dummy_char_traits : public std::char_traits {}; - -int main () { - using string_view = std::experimental::basic_string_view; - using string = std:: basic_string ; - - { - string s{"QBCDE"}; - string_view sv1 ( s ); - assert ( sv1.size() == s.size()); - assert ( sv1.data() == s.data()); - } -} diff --git a/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp b/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp deleted file mode 100644 index a14e131c8..000000000 --- a/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// template -// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept - -#include -#include -#include - -struct dummy_char_traits : public std::char_traits {}; - -int main () { - using string_view = std::experimental::basic_string_view; - using string = std:: basic_string ; - - { - string s{"QBCDE"}; - string_view sv1 ( s ); - assert ( sv1.size() == s.size()); - assert ( sv1.data() == s.data()); - } -} diff --git a/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp deleted file mode 100644 index fdaf8aa06..000000000 --- a/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find(charT c, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, typename S::value_type c, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find(c, pos) == x); - if (x != S::npos) - assert(pos <= x && x + 1 <= s.size()); -} - -template -void -test(const S& s, typename S::value_type c, typename S::size_type x) -{ - assert(s.find(c) == x); - if (x != S::npos) - assert(0 <= x && x + 1 <= s.size()); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), 'c', 0, S::npos); - test(S(""), 'c', 1, S::npos); - test(S("abcde"), 'c', 0, 2); - test(S("abcde"), 'c', 1, 2); - test(S("abcde"), 'c', 2, 2); - test(S("abcde"), 'c', 4, S::npos); - test(S("abcde"), 'c', 5, S::npos); - test(S("abcde"), 'c', 6, S::npos); - test(S("abcdeabcde"), 'c', 0, 2); - test(S("abcdeabcde"), 'c', 1, 2); - test(S("abcdeabcde"), 'c', 5, 7); - test(S("abcdeabcde"), 'c', 9, S::npos); - test(S("abcdeabcde"), 'c', 10, S::npos); - test(S("abcdeabcde"), 'c', 11, S::npos); - test(S("abcdeabcdeabcdeabcde"), 'c', 0, 2); - test(S("abcdeabcdeabcdeabcde"), 'c', 1, 2); - test(S("abcdeabcdeabcdeabcde"), 'c', 10, 12); - test(S("abcdeabcdeabcdeabcde"), 'c', 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), 'c', 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), 'c', 21, S::npos); - - test(S(""), 'c', S::npos); - test(S("abcde"), 'c', 2); - test(S("abcdeabcde"), 'c', 2); - test(S("abcdeabcdeabcdeabcde"), 'c', 2); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find( 'c', 0 ) == SV::npos, "" ); - static_assert (sv1.find( 'c', 1 ) == SV::npos, "" ); - static_assert (sv2.find( 'c', 0 ) == 2, "" ); - static_assert (sv2.find( 'c', 1 ) == 2, "" ); - static_assert (sv2.find( 'c', 2 ) == 2, "" ); - static_assert (sv2.find( 'c', 3 ) == SV::npos, "" ); - static_assert (sv2.find( 'c', 4 ) == SV::npos, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp deleted file mode 100644 index 859980af2..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_first_not_of(charT c, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, typename S::value_type c, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_first_not_of(c, pos) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void -test(const S& s, typename S::value_type c, typename S::size_type x) -{ - assert(s.find_first_not_of(c) == x); - if (x != S::npos) - assert(x < s.size()); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), 'q', 0, S::npos); - test(S(""), 'q', 1, S::npos); - test(S("kitcj"), 'q', 0, 0); - test(S("qkamf"), 'q', 1, 1); - test(S("nhmko"), 'q', 2, 2); - test(S("tpsaf"), 'q', 4, 4); - test(S("lahfb"), 'q', 5, S::npos); - test(S("irkhs"), 'q', 6, S::npos); - test(S("gmfhdaipsr"), 'q', 0, 0); - test(S("kantesmpgj"), 'q', 1, 1); - test(S("odaftiegpm"), 'q', 5, 5); - test(S("oknlrstdpi"), 'q', 9, 9); - test(S("eolhfgpjqk"), 'q', 10, S::npos); - test(S("pcdrofikas"), 'q', 11, S::npos); - test(S("nbatdlmekrgcfqsophij"), 'q', 0, 0); - test(S("bnrpehidofmqtcksjgla"), 'q', 1, 1); - test(S("jdmciepkaqgotsrfnhlb"), 'q', 10, 10); - test(S("jtdaefblsokrmhpgcnqi"), 'q', 19, 19); - test(S("hkbgspofltajcnedqmri"), 'q', 20, S::npos); - test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos); - - test(S(""), 'q', S::npos); - test(S("q"), 'q', S::npos); - test(S("qqq"), 'q', S::npos); - test(S("csope"), 'q', 0); - test(S("gfsmthlkon"), 'q', 0); - test(S("laenfsbridchgotmkqpj"), 'q', 0); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_first_not_of( 'q', 0 ) == SV::npos, "" ); - static_assert (sv1.find_first_not_of( 'q', 1 ) == SV::npos, "" ); - static_assert (sv2.find_first_not_of( 'q', 0 ) == 0, "" ); - static_assert (sv2.find_first_not_of( 'q', 1 ) == 1, "" ); - static_assert (sv2.find_first_not_of( 'q', 5 ) == SV::npos, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp deleted file mode 100644 index 1f7ce3ef5..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp +++ /dev/null @@ -1,166 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_first_not_of(str, pos) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type x) -{ - assert(s.find_first_not_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, S::npos); - test(S(""), "laenf", 0, S::npos); - test(S(""), "pqlnkmbdjo", 0, S::npos); - test(S(""), "qkamfogpnljdcshbreti", 0, S::npos); - test(S(""), "", 1, S::npos); - test(S(""), "bjaht", 1, S::npos); - test(S(""), "hjlcmgpket", 1, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos); - test(S("fodgq"), "", 0, 0); - test(S("qanej"), "dfkap", 0, 0); - test(S("clbao"), "ihqrfebgad", 0, 0); - test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, S::npos); - test(S("srdfq"), "", 1, 1); - test(S("oemth"), "ikcrq", 1, 1); - test(S("cdaih"), "dmajblfhsg", 1, 3); - test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, S::npos); - test(S("cshmd"), "", 2, 2); - test(S("lhcdo"), "oebqi", 2, 2); - test(S("qnsoh"), "kojhpmbsfe", 2, S::npos); - test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, S::npos); - test(S("fmtsp"), "", 4, 4); - test(S("khbpm"), "aobjd", 4, 4); - test(S("pbsji"), "pcbahntsje", 4, 4); - test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, S::npos); - test(S("eqmpa"), "", 5, S::npos); - test(S("omigs"), "kocgb", 5, S::npos); - test(S("onmje"), "fbslrjiqkm", 5, S::npos); - test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, S::npos); - test(S("schfa"), "", 6, S::npos); - test(S("igdsc"), "qngpd", 6, S::npos); - test(S("brqgo"), "rodhqklgmb", 6, S::npos); - test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, S::npos); - test(S("hcjitbfapl"), "", 0, 0); - test(S("daiprenocl"), "ashjd", 0, 2); - test(S("litpcfdghe"), "mgojkldsqh", 0, 1); - test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, S::npos); - test(S("qpghtfbaji"), "", 1, 1); - test(S("gfshlcmdjr"), "nadkh", 1, 1); - test(S("nkodajteqp"), "ofdrqmkebl", 1, 4); - test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, S::npos); - test(S("crnklpmegd"), "", 5, 5); - test(S("jsbtafedoc"), "prqgn", 5, 5); - test(S("qnmodrtkeb"), "pejafmnokr", 5, 6); - test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, S::npos); - test(S("lmofqdhpki"), "", 9, 9); - test(S("hnefkqimca"), "rtjpa", 9, S::npos); - test(S("drtasbgmfp"), "ktsrmnqagd", 9, 9); - test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, S::npos); - test(S("elgofjmbrq"), "", 10, S::npos); - test(S("mjqdgalkpc"), "dplqa", 10, S::npos); - test(S("kthqnfcerm"), "dkacjoptns", 10, S::npos); - test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, S::npos); - test(S("eqsgalomhb"), "", 11, S::npos); - test(S("akiteljmoh"), "lofbc", 11, S::npos); - test(S("hlbdfreqjo"), "astoegbfpn", 11, S::npos); - test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, S::npos); - test(S("snafbdlghrjkpqtoceim"), "", 0, 0); - test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, 0); - test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, 1); - test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, S::npos); - test(S("jlnkraeodhcspfgbqitm"), "", 1, 1); - test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, 1); - test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 3); - test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, S::npos); - test(S("hdpkobnsalmcfijregtq"), "", 10, 10); - test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 11); - test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 13); - test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, S::npos); - test(S("niptglfbosehkamrdqcj"), "", 19, 19); - test(S("copqdhstbingamjfkler"), "djkqc", 19, 19); - test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, S::npos); - test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, S::npos); - test(S("eaintpchlqsbdgrkjofm"), "", 20, S::npos); - test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, S::npos); - test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, S::npos); - test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, S::npos); - test(S("liatsqdoegkmfcnbhrpj"), "", 21, S::npos); - test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, S::npos); - test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, S::npos); - test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); -} - -template -void test1() -{ - test(S(""), "", S::npos); - test(S(""), "laenf", S::npos); - test(S(""), "pqlnkmbdjo", S::npos); - test(S(""), "qkamfogpnljdcshbreti", S::npos); - test(S("nhmko"), "", 0); - test(S("lahfb"), "irkhs", 0); - test(S("gmfhd"), "kantesmpgj", 2); - test(S("odaft"), "oknlrstdpiqmjbaghcfe", S::npos); - test(S("eolhfgpjqk"), "", 0); - test(S("nbatdlmekr"), "bnrpe", 2); - test(S("jdmciepkaq"), "jtdaefblso", 2); - test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", S::npos); - test(S("gprdcokbnjhlsfmtieqa"), "", 0); - test(S("qjghlnftcaismkropdeb"), "bjaht", 0); - test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 1); - test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_first_not_of( "", 0) == SV::npos, "" ); - static_assert (sv1.find_first_not_of( "irkhs", 0) == SV::npos, "" ); - static_assert (sv2.find_first_not_of( "", 0) == 0, "" ); - static_assert (sv2.find_first_not_of( "gfsrt", 0) == 0, "" ); - static_assert (sv2.find_first_not_of( "lecar", 0) == 1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp deleted file mode 100644 index 28255dd45..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type n, typename S::size_type x) -{ - assert(s.find_first_not_of(str, pos, n) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, 0, S::npos); - test(S(""), "irkhs", 0, 0, S::npos); - test(S(""), "kante", 0, 1, S::npos); - test(S(""), "oknlr", 0, 2, S::npos); - test(S(""), "pcdro", 0, 4, S::npos); - test(S(""), "bnrpe", 0, 5, S::npos); - test(S(""), "jtdaefblso", 0, 0, S::npos); - test(S(""), "oselktgbca", 0, 1, S::npos); - test(S(""), "eqgaplhckj", 0, 5, S::npos); - test(S(""), "bjahtcmnlp", 0, 9, S::npos); - test(S(""), "hjlcmgpket", 0, 10, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos); - test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos); - test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos); - test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos); - test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos); - test(S(""), "", 1, 0, S::npos); - test(S(""), "lbtqd", 1, 0, S::npos); - test(S(""), "tboim", 1, 1, S::npos); - test(S(""), "slcer", 1, 2, S::npos); - test(S(""), "cbjfs", 1, 4, S::npos); - test(S(""), "aqibs", 1, 5, S::npos); - test(S(""), "gtfblmqinc", 1, 0, S::npos); - test(S(""), "mkqpbtdalg", 1, 1, S::npos); - test(S(""), "kphatlimcd", 1, 5, S::npos); - test(S(""), "pblasqogic", 1, 9, S::npos); - test(S(""), "arosdhcfme", 1, 10, S::npos); - test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos); - test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos); - test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos); - test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos); - test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos); - test(S("eaint"), "", 0, 0, 0); - test(S("binja"), "gfsrt", 0, 0, 0); - test(S("latkm"), "pfsoc", 0, 1, 0); - test(S("lecfr"), "tpflm", 0, 2, 0); - test(S("eqkst"), "sgkec", 0, 4, 1); - test(S("cdafr"), "romds", 0, 5, 0); - test(S("prbhe"), "qhjistlgmr", 0, 0, 0); - test(S("lbisk"), "pedfirsglo", 0, 1, 0); - test(S("hrlpd"), "aqcoslgrmk", 0, 5, 0); - test(S("ehmja"), "dabckmepqj", 0, 9, 1); - test(S("mhqgd"), "pqscrjthli", 0, 10, 0); - test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, 0); - test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, 0); - test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, 0); - test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, S::npos); - test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, S::npos); - test(S("clrgb"), "", 1, 0, 1); - test(S("tjmek"), "osmia", 1, 0, 1); - test(S("bgstp"), "ckonl", 1, 1, 1); - test(S("hstrk"), "ilcaj", 1, 2, 1); - test(S("kmspj"), "lasiq", 1, 4, 1); - test(S("tjboh"), "kfqmr", 1, 5, 1); - test(S("ilbcj"), "klnitfaobg", 1, 0, 1); - test(S("jkngf"), "gjhmdlqikp", 1, 1, 1); - test(S("gfcql"), "skbgtahqej", 1, 5, 1); - test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 1); - test(S("bthpg"), "bjgfmnlkio", 1, 10, 1); - test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, 1); - test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, 1); - test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, 3); - test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, S::npos); - test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, S::npos); - test(S("ndrhl"), "", 2, 0, 2); - test(S("mrecp"), "otkgb", 2, 0, 2); - test(S("qlasf"), "cqsjl", 2, 1, 2); - test(S("smaqd"), "dpifl", 2, 2, 2); - test(S("hjeni"), "oapht", 2, 4, 2); - test(S("ocmfj"), "cifts", 2, 5, 2); - test(S("hmftq"), "nmsckbgalo", 2, 0, 2); - test(S("fklad"), "tpksqhamle", 2, 1, 2); - test(S("dirnm"), "tpdrchmkji", 2, 5, 3); - test(S("hrgdc"), "ijagfkblst", 2, 9, 3); - test(S("ifakg"), "kpocsignjb", 2, 10, 2); - test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, 2); - test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, 2); - test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 2); - test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, S::npos); - test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, S::npos); - test(S("cjgao"), "", 4, 0, 4); - test(S("kjplq"), "mabns", 4, 0, 4); - test(S("herni"), "bdnrp", 4, 1, 4); - test(S("tadrb"), "scidp", 4, 2, 4); - test(S("pkfeo"), "agbjl", 4, 4, 4); - test(S("hoser"), "jfmpr", 4, 5, S::npos); - test(S("kgrsp"), "rbpefghsmj", 4, 0, 4); - test(S("pgejb"), "apsfntdoqc", 4, 1, 4); - test(S("thlnq"), "ndkjeisgcl", 4, 5, 4); - test(S("nbmit"), "rnfpqatdeo", 4, 9, S::npos); - test(S("jgmib"), "bntjlqrfik", 4, 10, S::npos); - test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, 4); - test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, 4); - test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, S::npos); - test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, S::npos); - test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, S::npos); - test(S("klopi"), "", 5, 0, S::npos); - test(S("dajhn"), "psthd", 5, 0, S::npos); - test(S("jbgno"), "rpmjd", 5, 1, S::npos); - test(S("hkjae"), "dfsmk", 5, 2, S::npos); -} - -template -void test1() -{ - test(S("gbhqo"), "skqne", 5, 4, S::npos); - test(S("ktdor"), "kipnf", 5, 5, S::npos); - test(S("ldprn"), "hmrnqdgifl", 5, 0, S::npos); - test(S("egmjk"), "fsmjcdairn", 5, 1, S::npos); - test(S("armql"), "pcdgltbrfj", 5, 5, S::npos); - test(S("cdhjo"), "aekfctpirg", 5, 9, S::npos); - test(S("jcons"), "ledihrsgpf", 5, 10, S::npos); - test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, S::npos); - test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, S::npos); - test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, S::npos); - test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, S::npos); - test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, S::npos); - test(S("gajqn"), "", 6, 0, S::npos); - test(S("stedk"), "hrnat", 6, 0, S::npos); - test(S("tjkaf"), "gsqdt", 6, 1, S::npos); - test(S("dthpe"), "bspkd", 6, 2, S::npos); - test(S("klhde"), "ohcmb", 6, 4, S::npos); - test(S("bhlki"), "heatr", 6, 5, S::npos); - test(S("lqmoh"), "pmblckedfn", 6, 0, S::npos); - test(S("mtqin"), "aceqmsrbik", 6, 1, S::npos); - test(S("dpqbr"), "lmbtdehjrn", 6, 5, S::npos); - test(S("kdhmo"), "teqmcrlgib", 6, 9, S::npos); - test(S("jblqp"), "njolbmspac", 6, 10, S::npos); - test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, S::npos); - test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, S::npos); - test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, S::npos); - test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, S::npos); - test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, S::npos); - test(S("jnkrfhotgl"), "", 0, 0, 0); - test(S("dltjfngbko"), "rqegt", 0, 0, 0); - test(S("bmjlpkiqde"), "dashm", 0, 1, 0); - test(S("skrflobnqm"), "jqirk", 0, 2, 0); - test(S("jkpldtshrm"), "rckeg", 0, 4, 0); - test(S("ghasdbnjqo"), "jscie", 0, 5, 0); - test(S("igrkhpbqjt"), "efsphndliq", 0, 0, 0); - test(S("ikthdgcamf"), "gdicosleja", 0, 1, 0); - test(S("pcofgeniam"), "qcpjibosfl", 0, 5, 2); - test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, 4); - test(S("itphbqsker"), "dtablcrseo", 0, 10, 0); - test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, 0); - test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, 0); - test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, 0); - test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, 1); - test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, S::npos); - test(S("shbcqnmoar"), "", 1, 0, 1); - test(S("bdoshlmfin"), "ontrs", 1, 0, 1); - test(S("khfrebnsgq"), "pfkna", 1, 1, 1); - test(S("getcrsaoji"), "ekosa", 1, 2, 2); - test(S("fjiknedcpq"), "anqhk", 1, 4, 1); - test(S("tkejgnafrm"), "jekca", 1, 5, 4); - test(S("jnakolqrde"), "ikemsjgacf", 1, 0, 1); - test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, 1); - test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 3); - test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 1); - test(S("cigfqkated"), "sqcflrgtim", 1, 10, 5); - test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, 1); - test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, 1); - test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, 5); - test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, 5); - test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, S::npos); - test(S("ectnhskflp"), "", 5, 0, 5); - test(S("fgtianblpq"), "pijag", 5, 0, 5); - test(S("mfeqklirnh"), "jrckd", 5, 1, 5); - test(S("astedncjhk"), "qcloh", 5, 2, 5); - test(S("fhlqgcajbr"), "thlmp", 5, 4, 5); - test(S("epfhocmdng"), "qidmo", 5, 5, 5); - test(S("apcnsibger"), "lnegpsjqrd", 5, 0, 5); - test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 6); - test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, 5); - test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 6); - test(S("jbhcfposld"), "trfqgmckbe", 5, 10, 5); - test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, 5); - test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, 5); - test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 6); - test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, 8); - test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, S::npos); - test(S("shoiedtcjb"), "", 9, 0, 9); - test(S("ebcinjgads"), "tqbnh", 9, 0, 9); - test(S("dqmregkcfl"), "akmle", 9, 1, 9); - test(S("ngcrieqajf"), "iqfkm", 9, 2, 9); - test(S("qosmilgnjb"), "tqjsr", 9, 4, 9); - test(S("ikabsjtdfl"), "jplqg", 9, 5, S::npos); - test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, 9); - test(S("fdnplotmgh"), "morkglpesn", 9, 1, 9); - test(S("fdbicojerm"), "dmicerngat", 9, 5, S::npos); - test(S("mbtafndjcq"), "radgeskbtc", 9, 9, 9); - test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, 9); - test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, 9); - test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, 9); - test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, 9); - test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, S::npos); - test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, S::npos); - test(S("ncjpmaekbs"), "", 10, 0, S::npos); - test(S("hlbosgmrak"), "hpmsd", 10, 0, S::npos); - test(S("pqfhsgilen"), "qnpor", 10, 1, S::npos); - test(S("gqtjsbdckh"), "otdma", 10, 2, S::npos); - test(S("cfkqpjlegi"), "efhjg", 10, 4, S::npos); - test(S("beanrfodgj"), "odpte", 10, 5, S::npos); - test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, S::npos); - test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos); -} - -template -void test2() -{ - test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); - test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, S::npos); - test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, S::npos); - test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, S::npos); - test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, S::npos); - test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, S::npos); - test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, S::npos); - test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, S::npos); - test(S("cqjohampgd"), "", 11, 0, S::npos); - test(S("hobitmpsan"), "aocjb", 11, 0, S::npos); - test(S("tjehkpsalm"), "jbrnk", 11, 1, S::npos); - test(S("ngfbojitcl"), "tqedg", 11, 2, S::npos); - test(S("rcfkdbhgjo"), "nqskp", 11, 4, S::npos); - test(S("qghptonrea"), "eaqkl", 11, 5, S::npos); - test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, S::npos); - test(S("hlmgabenti"), "lsftgajqpm", 11, 1, S::npos); - test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, S::npos); - test(S("jqedtkornm"), "shkncmiaqj", 11, 9, S::npos); - test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, S::npos); - test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, S::npos); - test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, S::npos); - test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, S::npos); - test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, S::npos); - test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, S::npos); - test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, 0); - test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, 0); - test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, 0); - test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, 0); - test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, 0); - test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, 0); - test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, 0); - test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, 0); - test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, 0); - test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, 0); - test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, 0); - test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, 0); - test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, 0); - test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, 0); - test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, 11); - test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, S::npos); - test(S("febhmqtjanokscdirpgl"), "", 1, 0, 1); - test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, 1); - test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, 1); - test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 2); - test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 2); - test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, 1); - test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, 1); - test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, 1); - test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, 1); - test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 3); - test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 2); - test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, 1); - test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, 1); - test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 2); - test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, 13); - test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, S::npos); - test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, 10); - test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, 10); - test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, 10); - test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, 10); - test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 11); - test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 10); - test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, 10); - test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, 10); - test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 10); - test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 11); - test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 10); - test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, 10); - test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, 10); - test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 11); - test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, 11); - test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, S::npos); - test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, 19); - test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, 19); - test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, 19); - test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, 19); - test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, 19); - test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, S::npos); - test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, 19); - test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, 19); - test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, 19); - test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, 19); - test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, 19); - test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, 19); - test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, 19); - test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, S::npos); - test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, S::npos); - test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, S::npos); - test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, S::npos); - test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, S::npos); - test(S("grkpahljcftesdmonqib"), "odife", 20, 1, S::npos); - test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, S::npos); - test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, S::npos); - test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, S::npos); - test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, S::npos); - test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, S::npos); - test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, S::npos); - test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, S::npos); - test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, S::npos); - test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); -} - -template -void test3() -{ - test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); - test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, S::npos); - test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, S::npos); - test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, S::npos); - test(S("ecgdanriptblhjfqskom"), "", 21, 0, S::npos); - test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, S::npos); - test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, S::npos); - test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, S::npos); - test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, S::npos); - test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, S::npos); - test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, S::npos); - test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, S::npos); - test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, S::npos); - test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, S::npos); - test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, S::npos); - test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, S::npos); - test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, S::npos); - test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, S::npos); - test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, S::npos); - test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - test2(); - test3(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_first_not_of( "", 0, 0) == SV::npos, "" ); - static_assert (sv1.find_first_not_of( "irkhs", 0, 5) == SV::npos, "" ); - static_assert (sv2.find_first_not_of( "", 0, 0) == 0, "" ); - static_assert (sv2.find_first_not_of( "gfsrt", 0, 5) == 0, "" ); - static_assert (sv2.find_first_not_of( "lecar", 0, 5) == 1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp deleted file mode 100644 index 700231294..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// size_type find_first_not_of(const basic_string& str, size_type pos = 0) const; - -#include -#include - -template -void -test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) -{ - assert(s.find_first_not_of(str, pos) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void -test(const S& s, const S& str, typename S::size_type x) -{ - assert(s.find_first_not_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), S(""), 0, S::npos); - test(S(""), S("laenf"), 0, S::npos); - test(S(""), S("pqlnkmbdjo"), 0, S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos); - test(S(""), S(""), 1, S::npos); - test(S(""), S("bjaht"), 1, S::npos); - test(S(""), S("hjlcmgpket"), 1, S::npos); - test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos); - test(S("fodgq"), S(""), 0, 0); - test(S("qanej"), S("dfkap"), 0, 0); - test(S("clbao"), S("ihqrfebgad"), 0, 0); - test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, S::npos); - test(S("srdfq"), S(""), 1, 1); - test(S("oemth"), S("ikcrq"), 1, 1); - test(S("cdaih"), S("dmajblfhsg"), 1, 3); - test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, S::npos); - test(S("cshmd"), S(""), 2, 2); - test(S("lhcdo"), S("oebqi"), 2, 2); - test(S("qnsoh"), S("kojhpmbsfe"), 2, S::npos); - test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, S::npos); - test(S("fmtsp"), S(""), 4, 4); - test(S("khbpm"), S("aobjd"), 4, 4); - test(S("pbsji"), S("pcbahntsje"), 4, 4); - test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, S::npos); - test(S("eqmpa"), S(""), 5, S::npos); - test(S("omigs"), S("kocgb"), 5, S::npos); - test(S("onmje"), S("fbslrjiqkm"), 5, S::npos); - test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, S::npos); - test(S("schfa"), S(""), 6, S::npos); - test(S("igdsc"), S("qngpd"), 6, S::npos); - test(S("brqgo"), S("rodhqklgmb"), 6, S::npos); - test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, S::npos); - test(S("hcjitbfapl"), S(""), 0, 0); - test(S("daiprenocl"), S("ashjd"), 0, 2); - test(S("litpcfdghe"), S("mgojkldsqh"), 0, 1); - test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, S::npos); - test(S("qpghtfbaji"), S(""), 1, 1); - test(S("gfshlcmdjr"), S("nadkh"), 1, 1); - test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 4); - test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, S::npos); - test(S("crnklpmegd"), S(""), 5, 5); - test(S("jsbtafedoc"), S("prqgn"), 5, 5); - test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 6); - test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, S::npos); - test(S("lmofqdhpki"), S(""), 9, 9); - test(S("hnefkqimca"), S("rtjpa"), 9, S::npos); - test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, 9); - test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, S::npos); - test(S("elgofjmbrq"), S(""), 10, S::npos); - test(S("mjqdgalkpc"), S("dplqa"), 10, S::npos); - test(S("kthqnfcerm"), S("dkacjoptns"), 10, S::npos); - test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, S::npos); - test(S("eqsgalomhb"), S(""), 11, S::npos); - test(S("akiteljmoh"), S("lofbc"), 11, S::npos); - test(S("hlbdfreqjo"), S("astoegbfpn"), 11, S::npos); - test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, S::npos); - test(S("snafbdlghrjkpqtoceim"), S(""), 0, 0); - test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, 0); - test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, 1); - test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, S::npos); - test(S("jlnkraeodhcspfgbqitm"), S(""), 1, 1); - test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, 1); - test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 3); - test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, S::npos); - test(S("hdpkobnsalmcfijregtq"), S(""), 10, 10); - test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 11); - test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 13); - test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, S::npos); - test(S("niptglfbosehkamrdqcj"), S(""), 19, 19); - test(S("copqdhstbingamjfkler"), S("djkqc"), 19, 19); - test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, S::npos); - test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, S::npos); - test(S("eaintpchlqsbdgrkjofm"), S(""), 20, S::npos); - test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, S::npos); - test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, S::npos); - test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, S::npos); - test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, S::npos); - test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, S::npos); - test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, S::npos); - test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); -} - -template -void test1() -{ - test(S(""), S(""), S::npos); - test(S(""), S("laenf"), S::npos); - test(S(""), S("pqlnkmbdjo"), S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), S::npos); - test(S("nhmko"), S(""), 0); - test(S("lahfb"), S("irkhs"), 0); - test(S("gmfhd"), S("kantesmpgj"), 2); - test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), S::npos); - test(S("eolhfgpjqk"), S(""), 0); - test(S("nbatdlmekr"), S("bnrpe"), 2); - test(S("jdmciepkaq"), S("jtdaefblso"), 2); - test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), S::npos); - test(S("gprdcokbnjhlsfmtieqa"), S(""), 0); - test(S("qjghlnftcaismkropdeb"), S("bjaht"), 0); - test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 1); - test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp deleted file mode 100644 index ffafcfc04..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_first_of(charT c, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, typename S::value_type c, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_first_of(c, pos) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void -test(const S& s, typename S::value_type c, typename S::size_type x) -{ - assert(s.find_first_of(c) == x); - if (x != S::npos) - assert(x < s.size()); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), 'e', 0, S::npos); - test(S(""), 'e', 1, S::npos); - test(S("kitcj"), 'e', 0, S::npos); - test(S("qkamf"), 'e', 1, S::npos); - test(S("nhmko"), 'e', 2, S::npos); - test(S("tpsaf"), 'e', 4, S::npos); - test(S("lahfb"), 'e', 5, S::npos); - test(S("irkhs"), 'e', 6, S::npos); - test(S("gmfhdaipsr"), 'e', 0, S::npos); - test(S("kantesmpgj"), 'e', 1, 4); - test(S("odaftiegpm"), 'e', 5, 6); - test(S("oknlrstdpi"), 'e', 9, S::npos); - test(S("eolhfgpjqk"), 'e', 10, S::npos); - test(S("pcdrofikas"), 'e', 11, S::npos); - test(S("nbatdlmekrgcfqsophij"), 'e', 0, 7); - test(S("bnrpehidofmqtcksjgla"), 'e', 1, 4); - test(S("jdmciepkaqgotsrfnhlb"), 'e', 10, S::npos); - test(S("jtdaefblsokrmhpgcnqi"), 'e', 19, S::npos); - test(S("hkbgspofltajcnedqmri"), 'e', 20, S::npos); - test(S("oselktgbcapndfjihrmq"), 'e', 21, S::npos); - - test(S(""), 'e', S::npos); - test(S("csope"), 'e', 4); - test(S("gfsmthlkon"), 'e', S::npos); - test(S("laenfsbridchgotmkqpj"), 'e', 2); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_first_of( 'e', 0 ) == SV::npos, "" ); - static_assert (sv1.find_first_of( 'e', 1 ) == SV::npos, "" ); - static_assert (sv2.find_first_of( 'q', 0 ) == SV::npos, "" ); - static_assert (sv2.find_first_of( 'e', 1 ) == 4, "" ); - static_assert (sv2.find_first_of( 'e', 5 ) == SV::npos, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp deleted file mode 100644 index 7b37fe057..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp +++ /dev/null @@ -1,166 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_first_of(const charT* s, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_first_of(str, pos) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type x) -{ - assert(s.find_first_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, S::npos); - test(S(""), "laenf", 0, S::npos); - test(S(""), "pqlnkmbdjo", 0, S::npos); - test(S(""), "qkamfogpnljdcshbreti", 0, S::npos); - test(S(""), "", 1, S::npos); - test(S(""), "bjaht", 1, S::npos); - test(S(""), "hjlcmgpket", 1, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos); - test(S("fodgq"), "", 0, S::npos); - test(S("qanej"), "dfkap", 0, 1); - test(S("clbao"), "ihqrfebgad", 0, 2); - test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, 0); - test(S("srdfq"), "", 1, S::npos); - test(S("oemth"), "ikcrq", 1, S::npos); - test(S("cdaih"), "dmajblfhsg", 1, 1); - test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, 1); - test(S("cshmd"), "", 2, S::npos); - test(S("lhcdo"), "oebqi", 2, 4); - test(S("qnsoh"), "kojhpmbsfe", 2, 2); - test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, 2); - test(S("fmtsp"), "", 4, S::npos); - test(S("khbpm"), "aobjd", 4, S::npos); - test(S("pbsji"), "pcbahntsje", 4, S::npos); - test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, 4); - test(S("eqmpa"), "", 5, S::npos); - test(S("omigs"), "kocgb", 5, S::npos); - test(S("onmje"), "fbslrjiqkm", 5, S::npos); - test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, S::npos); - test(S("schfa"), "", 6, S::npos); - test(S("igdsc"), "qngpd", 6, S::npos); - test(S("brqgo"), "rodhqklgmb", 6, S::npos); - test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, S::npos); - test(S("hcjitbfapl"), "", 0, S::npos); - test(S("daiprenocl"), "ashjd", 0, 0); - test(S("litpcfdghe"), "mgojkldsqh", 0, 0); - test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, 0); - test(S("qpghtfbaji"), "", 1, S::npos); - test(S("gfshlcmdjr"), "nadkh", 1, 3); - test(S("nkodajteqp"), "ofdrqmkebl", 1, 1); - test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, 1); - test(S("crnklpmegd"), "", 5, S::npos); - test(S("jsbtafedoc"), "prqgn", 5, S::npos); - test(S("qnmodrtkeb"), "pejafmnokr", 5, 5); - test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, 5); - test(S("lmofqdhpki"), "", 9, S::npos); - test(S("hnefkqimca"), "rtjpa", 9, 9); - test(S("drtasbgmfp"), "ktsrmnqagd", 9, S::npos); - test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, 9); - test(S("elgofjmbrq"), "", 10, S::npos); - test(S("mjqdgalkpc"), "dplqa", 10, S::npos); - test(S("kthqnfcerm"), "dkacjoptns", 10, S::npos); - test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, S::npos); - test(S("eqsgalomhb"), "", 11, S::npos); - test(S("akiteljmoh"), "lofbc", 11, S::npos); - test(S("hlbdfreqjo"), "astoegbfpn", 11, S::npos); - test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, S::npos); - test(S("snafbdlghrjkpqtoceim"), "", 0, S::npos); - test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, 3); - test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, 0); - test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, 0); - test(S("jlnkraeodhcspfgbqitm"), "", 1, S::npos); - test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, 3); - test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 1); - test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, 1); - test(S("hdpkobnsalmcfijregtq"), "", 10, S::npos); - test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 10); - test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 10); - test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, 10); - test(S("niptglfbosehkamrdqcj"), "", 19, S::npos); - test(S("copqdhstbingamjfkler"), "djkqc", 19, S::npos); - test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, 19); - test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, 19); - test(S("eaintpchlqsbdgrkjofm"), "", 20, S::npos); - test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, S::npos); - test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, S::npos); - test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, S::npos); - test(S("liatsqdoegkmfcnbhrpj"), "", 21, S::npos); - test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, S::npos); - test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, S::npos); - test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); -} - -template -void test1() -{ - test(S(""), "", S::npos); - test(S(""), "laenf", S::npos); - test(S(""), "pqlnkmbdjo", S::npos); - test(S(""), "qkamfogpnljdcshbreti", S::npos); - test(S("nhmko"), "", S::npos); - test(S("lahfb"), "irkhs", 2); - test(S("gmfhd"), "kantesmpgj", 0); - test(S("odaft"), "oknlrstdpiqmjbaghcfe", 0); - test(S("eolhfgpjqk"), "", S::npos); - test(S("nbatdlmekr"), "bnrpe", 0); - test(S("jdmciepkaq"), "jtdaefblso", 0); - test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", 0); - test(S("gprdcokbnjhlsfmtieqa"), "", S::npos); - test(S("qjghlnftcaismkropdeb"), "bjaht", 1); - test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 0); - test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_first_of( "", 0) == SV::npos, "" ); - static_assert (sv1.find_first_of( "irkhs", 0) == SV::npos, "" ); - static_assert (sv2.find_first_of( "", 0) == SV::npos, "" ); - static_assert (sv2.find_first_of( "gfsrt", 0) == SV::npos, "" ); - static_assert (sv2.find_first_of( "lecar", 0) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp deleted file mode 100644 index 1f7ea383a..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type n, typename S::size_type x) -{ - assert(s.find_first_of(str, pos, n) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, 0, S::npos); - test(S(""), "irkhs", 0, 0, S::npos); - test(S(""), "kante", 0, 1, S::npos); - test(S(""), "oknlr", 0, 2, S::npos); - test(S(""), "pcdro", 0, 4, S::npos); - test(S(""), "bnrpe", 0, 5, S::npos); - test(S(""), "jtdaefblso", 0, 0, S::npos); - test(S(""), "oselktgbca", 0, 1, S::npos); - test(S(""), "eqgaplhckj", 0, 5, S::npos); - test(S(""), "bjahtcmnlp", 0, 9, S::npos); - test(S(""), "hjlcmgpket", 0, 10, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos); - test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos); - test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos); - test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos); - test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos); - test(S(""), "", 1, 0, S::npos); - test(S(""), "lbtqd", 1, 0, S::npos); - test(S(""), "tboim", 1, 1, S::npos); - test(S(""), "slcer", 1, 2, S::npos); - test(S(""), "cbjfs", 1, 4, S::npos); - test(S(""), "aqibs", 1, 5, S::npos); - test(S(""), "gtfblmqinc", 1, 0, S::npos); - test(S(""), "mkqpbtdalg", 1, 1, S::npos); - test(S(""), "kphatlimcd", 1, 5, S::npos); - test(S(""), "pblasqogic", 1, 9, S::npos); - test(S(""), "arosdhcfme", 1, 10, S::npos); - test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos); - test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos); - test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos); - test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos); - test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos); - test(S("eaint"), "", 0, 0, S::npos); - test(S("binja"), "gfsrt", 0, 0, S::npos); - test(S("latkm"), "pfsoc", 0, 1, S::npos); - test(S("lecfr"), "tpflm", 0, 2, S::npos); - test(S("eqkst"), "sgkec", 0, 4, 0); - test(S("cdafr"), "romds", 0, 5, 1); - test(S("prbhe"), "qhjistlgmr", 0, 0, S::npos); - test(S("lbisk"), "pedfirsglo", 0, 1, S::npos); - test(S("hrlpd"), "aqcoslgrmk", 0, 5, S::npos); - test(S("ehmja"), "dabckmepqj", 0, 9, 0); - test(S("mhqgd"), "pqscrjthli", 0, 10, 1); - test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, S::npos); - test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, S::npos); - test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, S::npos); - test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, 0); - test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, 0); - test(S("clrgb"), "", 1, 0, S::npos); - test(S("tjmek"), "osmia", 1, 0, S::npos); - test(S("bgstp"), "ckonl", 1, 1, S::npos); - test(S("hstrk"), "ilcaj", 1, 2, S::npos); - test(S("kmspj"), "lasiq", 1, 4, 2); - test(S("tjboh"), "kfqmr", 1, 5, S::npos); - test(S("ilbcj"), "klnitfaobg", 1, 0, S::npos); - test(S("jkngf"), "gjhmdlqikp", 1, 1, 3); - test(S("gfcql"), "skbgtahqej", 1, 5, S::npos); - test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 2); - test(S("bthpg"), "bjgfmnlkio", 1, 10, 4); - test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, S::npos); - test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, S::npos); - test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, 1); - test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, 1); - test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, 1); - test(S("ndrhl"), "", 2, 0, S::npos); - test(S("mrecp"), "otkgb", 2, 0, S::npos); - test(S("qlasf"), "cqsjl", 2, 1, S::npos); - test(S("smaqd"), "dpifl", 2, 2, 4); - test(S("hjeni"), "oapht", 2, 4, S::npos); - test(S("ocmfj"), "cifts", 2, 5, 3); - test(S("hmftq"), "nmsckbgalo", 2, 0, S::npos); - test(S("fklad"), "tpksqhamle", 2, 1, S::npos); - test(S("dirnm"), "tpdrchmkji", 2, 5, 2); - test(S("hrgdc"), "ijagfkblst", 2, 9, 2); - test(S("ifakg"), "kpocsignjb", 2, 10, 3); - test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, S::npos); - test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, S::npos); - test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 3); - test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, 2); - test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, 2); - test(S("cjgao"), "", 4, 0, S::npos); - test(S("kjplq"), "mabns", 4, 0, S::npos); - test(S("herni"), "bdnrp", 4, 1, S::npos); - test(S("tadrb"), "scidp", 4, 2, S::npos); - test(S("pkfeo"), "agbjl", 4, 4, S::npos); - test(S("hoser"), "jfmpr", 4, 5, 4); - test(S("kgrsp"), "rbpefghsmj", 4, 0, S::npos); - test(S("pgejb"), "apsfntdoqc", 4, 1, S::npos); - test(S("thlnq"), "ndkjeisgcl", 4, 5, S::npos); - test(S("nbmit"), "rnfpqatdeo", 4, 9, 4); - test(S("jgmib"), "bntjlqrfik", 4, 10, 4); - test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, S::npos); - test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, S::npos); - test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, 4); - test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, 4); - test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, 4); - test(S("klopi"), "", 5, 0, S::npos); - test(S("dajhn"), "psthd", 5, 0, S::npos); - test(S("jbgno"), "rpmjd", 5, 1, S::npos); - test(S("hkjae"), "dfsmk", 5, 2, S::npos); -} - -template -void test1() -{ - test(S("gbhqo"), "skqne", 5, 4, S::npos); - test(S("ktdor"), "kipnf", 5, 5, S::npos); - test(S("ldprn"), "hmrnqdgifl", 5, 0, S::npos); - test(S("egmjk"), "fsmjcdairn", 5, 1, S::npos); - test(S("armql"), "pcdgltbrfj", 5, 5, S::npos); - test(S("cdhjo"), "aekfctpirg", 5, 9, S::npos); - test(S("jcons"), "ledihrsgpf", 5, 10, S::npos); - test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, S::npos); - test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, S::npos); - test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, S::npos); - test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, S::npos); - test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, S::npos); - test(S("gajqn"), "", 6, 0, S::npos); - test(S("stedk"), "hrnat", 6, 0, S::npos); - test(S("tjkaf"), "gsqdt", 6, 1, S::npos); - test(S("dthpe"), "bspkd", 6, 2, S::npos); - test(S("klhde"), "ohcmb", 6, 4, S::npos); - test(S("bhlki"), "heatr", 6, 5, S::npos); - test(S("lqmoh"), "pmblckedfn", 6, 0, S::npos); - test(S("mtqin"), "aceqmsrbik", 6, 1, S::npos); - test(S("dpqbr"), "lmbtdehjrn", 6, 5, S::npos); - test(S("kdhmo"), "teqmcrlgib", 6, 9, S::npos); - test(S("jblqp"), "njolbmspac", 6, 10, S::npos); - test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, S::npos); - test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, S::npos); - test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, S::npos); - test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, S::npos); - test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, S::npos); - test(S("jnkrfhotgl"), "", 0, 0, S::npos); - test(S("dltjfngbko"), "rqegt", 0, 0, S::npos); - test(S("bmjlpkiqde"), "dashm", 0, 1, 8); - test(S("skrflobnqm"), "jqirk", 0, 2, 8); - test(S("jkpldtshrm"), "rckeg", 0, 4, 1); - test(S("ghasdbnjqo"), "jscie", 0, 5, 3); - test(S("igrkhpbqjt"), "efsphndliq", 0, 0, S::npos); - test(S("ikthdgcamf"), "gdicosleja", 0, 1, 5); - test(S("pcofgeniam"), "qcpjibosfl", 0, 5, 0); - test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, 0); - test(S("itphbqsker"), "dtablcrseo", 0, 10, 1); - test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, S::npos); - test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, S::npos); - test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, 4); - test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, 0); - test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, 0); - test(S("shbcqnmoar"), "", 1, 0, S::npos); - test(S("bdoshlmfin"), "ontrs", 1, 0, S::npos); - test(S("khfrebnsgq"), "pfkna", 1, 1, S::npos); - test(S("getcrsaoji"), "ekosa", 1, 2, 1); - test(S("fjiknedcpq"), "anqhk", 1, 4, 4); - test(S("tkejgnafrm"), "jekca", 1, 5, 1); - test(S("jnakolqrde"), "ikemsjgacf", 1, 0, S::npos); - test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, S::npos); - test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 1); - test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 4); - test(S("cigfqkated"), "sqcflrgtim", 1, 10, 1); - test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, S::npos); - test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, S::npos); - test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, 1); - test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, 1); - test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, 1); - test(S("ectnhskflp"), "", 5, 0, S::npos); - test(S("fgtianblpq"), "pijag", 5, 0, S::npos); - test(S("mfeqklirnh"), "jrckd", 5, 1, S::npos); - test(S("astedncjhk"), "qcloh", 5, 2, 6); - test(S("fhlqgcajbr"), "thlmp", 5, 4, S::npos); - test(S("epfhocmdng"), "qidmo", 5, 5, 6); - test(S("apcnsibger"), "lnegpsjqrd", 5, 0, S::npos); - test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 5); - test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, 7); - test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 5); - test(S("jbhcfposld"), "trfqgmckbe", 5, 10, S::npos); - test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, S::npos); - test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, S::npos); - test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 5); - test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, 5); - test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, 5); - test(S("shoiedtcjb"), "", 9, 0, S::npos); - test(S("ebcinjgads"), "tqbnh", 9, 0, S::npos); - test(S("dqmregkcfl"), "akmle", 9, 1, S::npos); - test(S("ngcrieqajf"), "iqfkm", 9, 2, S::npos); - test(S("qosmilgnjb"), "tqjsr", 9, 4, S::npos); - test(S("ikabsjtdfl"), "jplqg", 9, 5, 9); - test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, S::npos); - test(S("fdnplotmgh"), "morkglpesn", 9, 1, S::npos); - test(S("fdbicojerm"), "dmicerngat", 9, 5, 9); - test(S("mbtafndjcq"), "radgeskbtc", 9, 9, S::npos); - test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, S::npos); - test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, S::npos); - test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, S::npos); - test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, S::npos); - test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, 9); - test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, 9); - test(S("ncjpmaekbs"), "", 10, 0, S::npos); - test(S("hlbosgmrak"), "hpmsd", 10, 0, S::npos); - test(S("pqfhsgilen"), "qnpor", 10, 1, S::npos); - test(S("gqtjsbdckh"), "otdma", 10, 2, S::npos); - test(S("cfkqpjlegi"), "efhjg", 10, 4, S::npos); - test(S("beanrfodgj"), "odpte", 10, 5, S::npos); - test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, S::npos); - test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos); -} - -template -void test2() -{ - test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); - test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, S::npos); - test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, S::npos); - test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, S::npos); - test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, S::npos); - test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, S::npos); - test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, S::npos); - test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, S::npos); - test(S("cqjohampgd"), "", 11, 0, S::npos); - test(S("hobitmpsan"), "aocjb", 11, 0, S::npos); - test(S("tjehkpsalm"), "jbrnk", 11, 1, S::npos); - test(S("ngfbojitcl"), "tqedg", 11, 2, S::npos); - test(S("rcfkdbhgjo"), "nqskp", 11, 4, S::npos); - test(S("qghptonrea"), "eaqkl", 11, 5, S::npos); - test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, S::npos); - test(S("hlmgabenti"), "lsftgajqpm", 11, 1, S::npos); - test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, S::npos); - test(S("jqedtkornm"), "shkncmiaqj", 11, 9, S::npos); - test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, S::npos); - test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, S::npos); - test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, S::npos); - test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, S::npos); - test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, S::npos); - test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, S::npos); - test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, S::npos); - test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, S::npos); - test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, 4); - test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, 3); - test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, 3); - test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, 3); - test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, S::npos); - test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, 19); - test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, 2); - test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, 2); - test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, 2); - test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, S::npos); - test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, 16); - test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, 1); - test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, 0); - test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, 0); - test(S("febhmqtjanokscdirpgl"), "", 1, 0, S::npos); - test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, S::npos); - test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, 6); - test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 1); - test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 1); - test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, 6); - test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, S::npos); - test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, 19); - test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, 4); - test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 1); - test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 1); - test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, S::npos); - test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, 7); - test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 1); - test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, 1); - test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, 1); - test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, S::npos); - test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, S::npos); - test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, 12); - test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, S::npos); - test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 10); - test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 15); - test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, S::npos); - test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, S::npos); - test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 11); - test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 10); - test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 11); - test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, S::npos); - test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, 18); - test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 10); - test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, 10); - test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, 10); - test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, S::npos); - test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, S::npos); - test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, S::npos); - test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, S::npos); - test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, S::npos); - test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, 19); - test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, S::npos); - test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, S::npos); - test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, S::npos); - test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, S::npos); - test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, S::npos); - test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, S::npos); - test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, S::npos); - test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, 19); - test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, 19); - test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, 19); - test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, S::npos); - test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, S::npos); - test(S("grkpahljcftesdmonqib"), "odife", 20, 1, S::npos); - test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, S::npos); - test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, S::npos); - test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, S::npos); - test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, S::npos); - test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, S::npos); - test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, S::npos); - test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, S::npos); - test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, S::npos); - test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); -} - -template -void test3() -{ - test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); - test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, S::npos); - test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, S::npos); - test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, S::npos); - test(S("ecgdanriptblhjfqskom"), "", 21, 0, S::npos); - test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, S::npos); - test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, S::npos); - test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, S::npos); - test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, S::npos); - test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, S::npos); - test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, S::npos); - test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, S::npos); - test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, S::npos); - test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, S::npos); - test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, S::npos); - test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, S::npos); - test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, S::npos); - test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, S::npos); - test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, S::npos); - test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - test2(); - test3(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_first_of( "", 0, 0) == SV::npos, "" ); - static_assert (sv1.find_first_of( "irkhs", 0, 5) == SV::npos, "" ); - static_assert (sv2.find_first_of( "", 0, 0) == SV::npos, "" ); - static_assert (sv2.find_first_of( "gfsrt", 0, 5) == SV::npos, "" ); - static_assert (sv2.find_first_of( "lecar", 0, 5) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_string_view_size.pass.cpp deleted file mode 100644 index fddd47171..000000000 --- a/test/std/experimental/string.view/string.view.find/find_first_of_string_view_size.pass.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// size_type find_first_of(const basic_string_view& str, size_type pos = 0) const; - -#include -#include - -template -void -test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) -{ - assert(s.find_first_of(str, pos) == x); - if (x != S::npos) - assert(pos <= x && x < s.size()); -} - -template -void -test(const S& s, const S& str, typename S::size_type x) -{ - assert(s.find_first_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), S(""), 0, S::npos); - test(S(""), S("laenf"), 0, S::npos); - test(S(""), S("pqlnkmbdjo"), 0, S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos); - test(S(""), S(""), 1, S::npos); - test(S(""), S("bjaht"), 1, S::npos); - test(S(""), S("hjlcmgpket"), 1, S::npos); - test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos); - test(S("fodgq"), S(""), 0, S::npos); - test(S("qanej"), S("dfkap"), 0, 1); - test(S("clbao"), S("ihqrfebgad"), 0, 2); - test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, 0); - test(S("srdfq"), S(""), 1, S::npos); - test(S("oemth"), S("ikcrq"), 1, S::npos); - test(S("cdaih"), S("dmajblfhsg"), 1, 1); - test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, 1); - test(S("cshmd"), S(""), 2, S::npos); - test(S("lhcdo"), S("oebqi"), 2, 4); - test(S("qnsoh"), S("kojhpmbsfe"), 2, 2); - test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, 2); - test(S("fmtsp"), S(""), 4, S::npos); - test(S("khbpm"), S("aobjd"), 4, S::npos); - test(S("pbsji"), S("pcbahntsje"), 4, S::npos); - test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, 4); - test(S("eqmpa"), S(""), 5, S::npos); - test(S("omigs"), S("kocgb"), 5, S::npos); - test(S("onmje"), S("fbslrjiqkm"), 5, S::npos); - test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, S::npos); - test(S("schfa"), S(""), 6, S::npos); - test(S("igdsc"), S("qngpd"), 6, S::npos); - test(S("brqgo"), S("rodhqklgmb"), 6, S::npos); - test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, S::npos); - test(S("hcjitbfapl"), S(""), 0, S::npos); - test(S("daiprenocl"), S("ashjd"), 0, 0); - test(S("litpcfdghe"), S("mgojkldsqh"), 0, 0); - test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, 0); - test(S("qpghtfbaji"), S(""), 1, S::npos); - test(S("gfshlcmdjr"), S("nadkh"), 1, 3); - test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 1); - test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, 1); - test(S("crnklpmegd"), S(""), 5, S::npos); - test(S("jsbtafedoc"), S("prqgn"), 5, S::npos); - test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 5); - test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, 5); - test(S("lmofqdhpki"), S(""), 9, S::npos); - test(S("hnefkqimca"), S("rtjpa"), 9, 9); - test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, S::npos); - test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, 9); - test(S("elgofjmbrq"), S(""), 10, S::npos); - test(S("mjqdgalkpc"), S("dplqa"), 10, S::npos); - test(S("kthqnfcerm"), S("dkacjoptns"), 10, S::npos); - test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, S::npos); - test(S("eqsgalomhb"), S(""), 11, S::npos); - test(S("akiteljmoh"), S("lofbc"), 11, S::npos); - test(S("hlbdfreqjo"), S("astoegbfpn"), 11, S::npos); - test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, S::npos); - test(S("snafbdlghrjkpqtoceim"), S(""), 0, S::npos); - test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, 3); - test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, 0); - test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, 0); - test(S("jlnkraeodhcspfgbqitm"), S(""), 1, S::npos); - test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, 3); - test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 1); - test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, 1); - test(S("hdpkobnsalmcfijregtq"), S(""), 10, S::npos); - test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 10); - test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 10); - test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, 10); - test(S("niptglfbosehkamrdqcj"), S(""), 19, S::npos); - test(S("copqdhstbingamjfkler"), S("djkqc"), 19, S::npos); - test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, 19); - test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, 19); - test(S("eaintpchlqsbdgrkjofm"), S(""), 20, S::npos); - test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, S::npos); - test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, S::npos); - test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, S::npos); - test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, S::npos); - test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, S::npos); - test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, S::npos); - test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); -} - -template -void test1() -{ - test(S(""), S(""), S::npos); - test(S(""), S("laenf"), S::npos); - test(S(""), S("pqlnkmbdjo"), S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), S::npos); - test(S("nhmko"), S(""), S::npos); - test(S("lahfb"), S("irkhs"), 2); - test(S("gmfhd"), S("kantesmpgj"), 0); - test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), 0); - test(S("eolhfgpjqk"), S(""), S::npos); - test(S("nbatdlmekr"), S("bnrpe"), 0); - test(S("jdmciepkaq"), S("jtdaefblso"), 0); - test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), 0); - test(S("gprdcokbnjhlsfmtieqa"), S(""), S::npos); - test(S("qjghlnftcaismkropdeb"), S("bjaht"), 1); - test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 0); - test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp deleted file mode 100644 index 307be2370..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// const size_type find_last_not_of(charT c, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, typename S::value_type c, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_last_not_of(c, pos) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void -test(const S& s, typename S::value_type c, typename S::size_type x) -{ - assert(s.find_last_not_of(c) == x); - if (x != S::npos) - assert(x < s.size()); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), 'i', 0, S::npos); - test(S(""), 'i', 1, S::npos); - test(S("kitcj"), 'i', 0, 0); - test(S("qkamf"), 'i', 1, 1); - test(S("nhmko"), 'i', 2, 2); - test(S("tpsaf"), 'i', 4, 4); - test(S("lahfb"), 'i', 5, 4); - test(S("irkhs"), 'i', 6, 4); - test(S("gmfhdaipsr"), 'i', 0, 0); - test(S("kantesmpgj"), 'i', 1, 1); - test(S("odaftiegpm"), 'i', 5, 4); - test(S("oknlrstdpi"), 'i', 9, 8); - test(S("eolhfgpjqk"), 'i', 10, 9); - test(S("pcdrofikas"), 'i', 11, 9); - test(S("nbatdlmekrgcfqsophij"), 'i', 0, 0); - test(S("bnrpehidofmqtcksjgla"), 'i', 1, 1); - test(S("jdmciepkaqgotsrfnhlb"), 'i', 10, 10); - test(S("jtdaefblsokrmhpgcnqi"), 'i', 19, 18); - test(S("hkbgspofltajcnedqmri"), 'i', 20, 18); - test(S("oselktgbcapndfjihrmq"), 'i', 21, 19); - - test(S(""), 'i', S::npos); - test(S("csope"), 'i', 4); - test(S("gfsmthlkon"), 'i', 9); - test(S("laenfsbridchgotmkqpj"), 'i', 19); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_last_not_of( 'i', 0 ) == SV::npos, "" ); - static_assert (sv1.find_last_not_of( 'i', 1 ) == SV::npos, "" ); - static_assert (sv2.find_last_not_of( 'a', 0 ) == SV::npos, "" ); - static_assert (sv2.find_last_not_of( 'a', 1 ) == 1, "" ); - static_assert (sv2.find_last_not_of( 'e', 5 ) == 3, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp deleted file mode 100644 index b0d3f0636..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp +++ /dev/null @@ -1,166 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_last_not_of(str, pos) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type x) -{ - assert(s.find_last_not_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, S::npos); - test(S(""), "laenf", 0, S::npos); - test(S(""), "pqlnkmbdjo", 0, S::npos); - test(S(""), "qkamfogpnljdcshbreti", 0, S::npos); - test(S(""), "", 1, S::npos); - test(S(""), "bjaht", 1, S::npos); - test(S(""), "hjlcmgpket", 1, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos); - test(S("fodgq"), "", 0, 0); - test(S("qanej"), "dfkap", 0, 0); - test(S("clbao"), "ihqrfebgad", 0, 0); - test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, S::npos); - test(S("srdfq"), "", 1, 1); - test(S("oemth"), "ikcrq", 1, 1); - test(S("cdaih"), "dmajblfhsg", 1, 0); - test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, S::npos); - test(S("cshmd"), "", 2, 2); - test(S("lhcdo"), "oebqi", 2, 2); - test(S("qnsoh"), "kojhpmbsfe", 2, 1); - test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, S::npos); - test(S("fmtsp"), "", 4, 4); - test(S("khbpm"), "aobjd", 4, 4); - test(S("pbsji"), "pcbahntsje", 4, 4); - test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, S::npos); - test(S("eqmpa"), "", 5, 4); - test(S("omigs"), "kocgb", 5, 4); - test(S("onmje"), "fbslrjiqkm", 5, 4); - test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, S::npos); - test(S("schfa"), "", 6, 4); - test(S("igdsc"), "qngpd", 6, 4); - test(S("brqgo"), "rodhqklgmb", 6, S::npos); - test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, S::npos); - test(S("hcjitbfapl"), "", 0, 0); - test(S("daiprenocl"), "ashjd", 0, S::npos); - test(S("litpcfdghe"), "mgojkldsqh", 0, S::npos); - test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, S::npos); - test(S("qpghtfbaji"), "", 1, 1); - test(S("gfshlcmdjr"), "nadkh", 1, 1); - test(S("nkodajteqp"), "ofdrqmkebl", 1, 0); - test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, S::npos); - test(S("crnklpmegd"), "", 5, 5); - test(S("jsbtafedoc"), "prqgn", 5, 5); - test(S("qnmodrtkeb"), "pejafmnokr", 5, 4); - test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, S::npos); - test(S("lmofqdhpki"), "", 9, 9); - test(S("hnefkqimca"), "rtjpa", 9, 8); - test(S("drtasbgmfp"), "ktsrmnqagd", 9, 9); - test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, S::npos); - test(S("elgofjmbrq"), "", 10, 9); - test(S("mjqdgalkpc"), "dplqa", 10, 9); - test(S("kthqnfcerm"), "dkacjoptns", 10, 9); - test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, S::npos); - test(S("eqsgalomhb"), "", 11, 9); - test(S("akiteljmoh"), "lofbc", 11, 9); - test(S("hlbdfreqjo"), "astoegbfpn", 11, 8); - test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, S::npos); - test(S("snafbdlghrjkpqtoceim"), "", 0, 0); - test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, 0); - test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, S::npos); - test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, S::npos); - test(S("jlnkraeodhcspfgbqitm"), "", 1, 1); - test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, 1); - test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 0); - test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, S::npos); - test(S("hdpkobnsalmcfijregtq"), "", 10, 10); - test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 9); - test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 9); - test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, S::npos); - test(S("niptglfbosehkamrdqcj"), "", 19, 19); - test(S("copqdhstbingamjfkler"), "djkqc", 19, 19); - test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, 16); - test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, S::npos); - test(S("eaintpchlqsbdgrkjofm"), "", 20, 19); - test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, 18); - test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, 19); - test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, S::npos); - test(S("liatsqdoegkmfcnbhrpj"), "", 21, 19); - test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, 19); - test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, 19); - test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); -} - -template -void test1() -{ - test(S(""), "", S::npos); - test(S(""), "laenf", S::npos); - test(S(""), "pqlnkmbdjo", S::npos); - test(S(""), "qkamfogpnljdcshbreti", S::npos); - test(S("nhmko"), "", 4); - test(S("lahfb"), "irkhs", 4); - test(S("gmfhd"), "kantesmpgj", 4); - test(S("odaft"), "oknlrstdpiqmjbaghcfe", S::npos); - test(S("eolhfgpjqk"), "", 9); - test(S("nbatdlmekr"), "bnrpe", 8); - test(S("jdmciepkaq"), "jtdaefblso", 9); - test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", S::npos); - test(S("gprdcokbnjhlsfmtieqa"), "", 19); - test(S("qjghlnftcaismkropdeb"), "bjaht", 18); - test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 17); - test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_last_not_of( "", 0) == SV::npos, "" ); - static_assert (sv1.find_last_not_of( "irkhs", 5) == SV::npos, "" ); - static_assert (sv2.find_last_not_of( "", 0) == 0, "" ); - static_assert (sv2.find_last_not_of( "gfsrt", 5) == 4, "" ); - static_assert (sv2.find_last_not_of( "lecar", 5) == 3, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp deleted file mode 100644 index 8a591ccbe..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type n, typename S::size_type x) -{ - assert(s.find_last_not_of(str, pos, n) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, 0, S::npos); - test(S(""), "irkhs", 0, 0, S::npos); - test(S(""), "kante", 0, 1, S::npos); - test(S(""), "oknlr", 0, 2, S::npos); - test(S(""), "pcdro", 0, 4, S::npos); - test(S(""), "bnrpe", 0, 5, S::npos); - test(S(""), "jtdaefblso", 0, 0, S::npos); - test(S(""), "oselktgbca", 0, 1, S::npos); - test(S(""), "eqgaplhckj", 0, 5, S::npos); - test(S(""), "bjahtcmnlp", 0, 9, S::npos); - test(S(""), "hjlcmgpket", 0, 10, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos); - test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos); - test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos); - test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos); - test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos); - test(S(""), "", 1, 0, S::npos); - test(S(""), "lbtqd", 1, 0, S::npos); - test(S(""), "tboim", 1, 1, S::npos); - test(S(""), "slcer", 1, 2, S::npos); - test(S(""), "cbjfs", 1, 4, S::npos); - test(S(""), "aqibs", 1, 5, S::npos); - test(S(""), "gtfblmqinc", 1, 0, S::npos); - test(S(""), "mkqpbtdalg", 1, 1, S::npos); - test(S(""), "kphatlimcd", 1, 5, S::npos); - test(S(""), "pblasqogic", 1, 9, S::npos); - test(S(""), "arosdhcfme", 1, 10, S::npos); - test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos); - test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos); - test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos); - test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos); - test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos); - test(S("eaint"), "", 0, 0, 0); - test(S("binja"), "gfsrt", 0, 0, 0); - test(S("latkm"), "pfsoc", 0, 1, 0); - test(S("lecfr"), "tpflm", 0, 2, 0); - test(S("eqkst"), "sgkec", 0, 4, S::npos); - test(S("cdafr"), "romds", 0, 5, 0); - test(S("prbhe"), "qhjistlgmr", 0, 0, 0); - test(S("lbisk"), "pedfirsglo", 0, 1, 0); - test(S("hrlpd"), "aqcoslgrmk", 0, 5, 0); - test(S("ehmja"), "dabckmepqj", 0, 9, S::npos); - test(S("mhqgd"), "pqscrjthli", 0, 10, 0); - test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, 0); - test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, 0); - test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, 0); - test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, S::npos); - test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, S::npos); - test(S("clrgb"), "", 1, 0, 1); - test(S("tjmek"), "osmia", 1, 0, 1); - test(S("bgstp"), "ckonl", 1, 1, 1); - test(S("hstrk"), "ilcaj", 1, 2, 1); - test(S("kmspj"), "lasiq", 1, 4, 1); - test(S("tjboh"), "kfqmr", 1, 5, 1); - test(S("ilbcj"), "klnitfaobg", 1, 0, 1); - test(S("jkngf"), "gjhmdlqikp", 1, 1, 1); - test(S("gfcql"), "skbgtahqej", 1, 5, 1); - test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 1); - test(S("bthpg"), "bjgfmnlkio", 1, 10, 1); - test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, 1); - test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, 1); - test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, S::npos); - test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, S::npos); - test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, S::npos); - test(S("ndrhl"), "", 2, 0, 2); - test(S("mrecp"), "otkgb", 2, 0, 2); - test(S("qlasf"), "cqsjl", 2, 1, 2); - test(S("smaqd"), "dpifl", 2, 2, 2); - test(S("hjeni"), "oapht", 2, 4, 2); - test(S("ocmfj"), "cifts", 2, 5, 2); - test(S("hmftq"), "nmsckbgalo", 2, 0, 2); - test(S("fklad"), "tpksqhamle", 2, 1, 2); - test(S("dirnm"), "tpdrchmkji", 2, 5, 1); - test(S("hrgdc"), "ijagfkblst", 2, 9, 1); - test(S("ifakg"), "kpocsignjb", 2, 10, 2); - test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, 2); - test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, 2); - test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 2); - test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, S::npos); - test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, S::npos); - test(S("cjgao"), "", 4, 0, 4); - test(S("kjplq"), "mabns", 4, 0, 4); - test(S("herni"), "bdnrp", 4, 1, 4); - test(S("tadrb"), "scidp", 4, 2, 4); - test(S("pkfeo"), "agbjl", 4, 4, 4); - test(S("hoser"), "jfmpr", 4, 5, 3); - test(S("kgrsp"), "rbpefghsmj", 4, 0, 4); - test(S("pgejb"), "apsfntdoqc", 4, 1, 4); - test(S("thlnq"), "ndkjeisgcl", 4, 5, 4); - test(S("nbmit"), "rnfpqatdeo", 4, 9, 3); - test(S("jgmib"), "bntjlqrfik", 4, 10, 2); - test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, 4); - test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, 4); - test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, 3); - test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, 2); - test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, S::npos); - test(S("klopi"), "", 5, 0, 4); - test(S("dajhn"), "psthd", 5, 0, 4); - test(S("jbgno"), "rpmjd", 5, 1, 4); - test(S("hkjae"), "dfsmk", 5, 2, 4); -} - -template -void test1() -{ - test(S("gbhqo"), "skqne", 5, 4, 4); - test(S("ktdor"), "kipnf", 5, 5, 4); - test(S("ldprn"), "hmrnqdgifl", 5, 0, 4); - test(S("egmjk"), "fsmjcdairn", 5, 1, 4); - test(S("armql"), "pcdgltbrfj", 5, 5, 3); - test(S("cdhjo"), "aekfctpirg", 5, 9, 4); - test(S("jcons"), "ledihrsgpf", 5, 10, 3); - test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, 4); - test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, 4); - test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, 1); - test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, 2); - test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, S::npos); - test(S("gajqn"), "", 6, 0, 4); - test(S("stedk"), "hrnat", 6, 0, 4); - test(S("tjkaf"), "gsqdt", 6, 1, 4); - test(S("dthpe"), "bspkd", 6, 2, 4); - test(S("klhde"), "ohcmb", 6, 4, 4); - test(S("bhlki"), "heatr", 6, 5, 4); - test(S("lqmoh"), "pmblckedfn", 6, 0, 4); - test(S("mtqin"), "aceqmsrbik", 6, 1, 4); - test(S("dpqbr"), "lmbtdehjrn", 6, 5, 4); - test(S("kdhmo"), "teqmcrlgib", 6, 9, 4); - test(S("jblqp"), "njolbmspac", 6, 10, 3); - test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, 4); - test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, 4); - test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, 1); - test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, S::npos); - test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, S::npos); - test(S("jnkrfhotgl"), "", 0, 0, 0); - test(S("dltjfngbko"), "rqegt", 0, 0, 0); - test(S("bmjlpkiqde"), "dashm", 0, 1, 0); - test(S("skrflobnqm"), "jqirk", 0, 2, 0); - test(S("jkpldtshrm"), "rckeg", 0, 4, 0); - test(S("ghasdbnjqo"), "jscie", 0, 5, 0); - test(S("igrkhpbqjt"), "efsphndliq", 0, 0, 0); - test(S("ikthdgcamf"), "gdicosleja", 0, 1, 0); - test(S("pcofgeniam"), "qcpjibosfl", 0, 5, S::npos); - test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, S::npos); - test(S("itphbqsker"), "dtablcrseo", 0, 10, 0); - test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, 0); - test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, 0); - test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, 0); - test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, S::npos); - test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, S::npos); - test(S("shbcqnmoar"), "", 1, 0, 1); - test(S("bdoshlmfin"), "ontrs", 1, 0, 1); - test(S("khfrebnsgq"), "pfkna", 1, 1, 1); - test(S("getcrsaoji"), "ekosa", 1, 2, 0); - test(S("fjiknedcpq"), "anqhk", 1, 4, 1); - test(S("tkejgnafrm"), "jekca", 1, 5, 0); - test(S("jnakolqrde"), "ikemsjgacf", 1, 0, 1); - test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, 1); - test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 0); - test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 1); - test(S("cigfqkated"), "sqcflrgtim", 1, 10, S::npos); - test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, 1); - test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, 1); - test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, S::npos); - test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, S::npos); - test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, S::npos); - test(S("ectnhskflp"), "", 5, 0, 5); - test(S("fgtianblpq"), "pijag", 5, 0, 5); - test(S("mfeqklirnh"), "jrckd", 5, 1, 5); - test(S("astedncjhk"), "qcloh", 5, 2, 5); - test(S("fhlqgcajbr"), "thlmp", 5, 4, 5); - test(S("epfhocmdng"), "qidmo", 5, 5, 5); - test(S("apcnsibger"), "lnegpsjqrd", 5, 0, 5); - test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 4); - test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, 5); - test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 3); - test(S("jbhcfposld"), "trfqgmckbe", 5, 10, 5); - test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, 5); - test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, 5); - test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 1); - test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, S::npos); - test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, S::npos); - test(S("shoiedtcjb"), "", 9, 0, 9); - test(S("ebcinjgads"), "tqbnh", 9, 0, 9); - test(S("dqmregkcfl"), "akmle", 9, 1, 9); - test(S("ngcrieqajf"), "iqfkm", 9, 2, 9); - test(S("qosmilgnjb"), "tqjsr", 9, 4, 9); - test(S("ikabsjtdfl"), "jplqg", 9, 5, 8); - test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, 9); - test(S("fdnplotmgh"), "morkglpesn", 9, 1, 9); - test(S("fdbicojerm"), "dmicerngat", 9, 5, 8); - test(S("mbtafndjcq"), "radgeskbtc", 9, 9, 9); - test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, 9); - test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, 9); - test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, 9); - test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, 9); - test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, 3); - test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, S::npos); - test(S("ncjpmaekbs"), "", 10, 0, 9); - test(S("hlbosgmrak"), "hpmsd", 10, 0, 9); - test(S("pqfhsgilen"), "qnpor", 10, 1, 9); - test(S("gqtjsbdckh"), "otdma", 10, 2, 9); - test(S("cfkqpjlegi"), "efhjg", 10, 4, 9); - test(S("beanrfodgj"), "odpte", 10, 5, 9); - test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, 9); - test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 9); -} - -template -void test2() -{ - test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 8); - test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, 9); - test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, 8); - test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, 9); - test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, 9); - test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, 7); - test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, 5); - test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, S::npos); - test(S("cqjohampgd"), "", 11, 0, 9); - test(S("hobitmpsan"), "aocjb", 11, 0, 9); - test(S("tjehkpsalm"), "jbrnk", 11, 1, 9); - test(S("ngfbojitcl"), "tqedg", 11, 2, 9); - test(S("rcfkdbhgjo"), "nqskp", 11, 4, 9); - test(S("qghptonrea"), "eaqkl", 11, 5, 7); - test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, 9); - test(S("hlmgabenti"), "lsftgajqpm", 11, 1, 9); - test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, 9); - test(S("jqedtkornm"), "shkncmiaqj", 11, 9, 7); - test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, 8); - test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, 9); - test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, 9); - test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, 8); - test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, S::npos); - test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, S::npos); - test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, 0); - test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, 0); - test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, 0); - test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, 0); - test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, 0); - test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, 0); - test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, 0); - test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, 0); - test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, 0); - test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, 0); - test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, 0); - test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, 0); - test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, 0); - test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, 0); - test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, S::npos); - test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, S::npos); - test(S("febhmqtjanokscdirpgl"), "", 1, 0, 1); - test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, 1); - test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, 1); - test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 0); - test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 0); - test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, 1); - test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, 1); - test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, 1); - test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, 1); - test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 0); - test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 0); - test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, 1); - test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, 1); - test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 0); - test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, S::npos); - test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, S::npos); - test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, 10); - test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, 10); - test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, 10); - test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, 10); - test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 9); - test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 10); - test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, 10); - test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, 10); - test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 10); - test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 8); - test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 10); - test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, 10); - test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, 10); - test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 8); - test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, S::npos); - test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, S::npos); - test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, 19); - test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, 19); - test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, 19); - test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, 19); - test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, 19); - test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, 17); - test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, 19); - test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, 19); - test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, 19); - test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, 19); - test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, 19); - test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, 19); - test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, 19); - test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, 18); - test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, 7); - test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, S::npos); - test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, 19); - test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, 19); - test(S("grkpahljcftesdmonqib"), "odife", 20, 1, 19); - test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, 19); - test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, 18); - test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, 18); - test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, 19); - test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, 19); - test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, 18); - test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, 18); - test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, 17); - test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, 19); -} - -template -void test3() -{ - test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 19); - test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, 19); - test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, 1); - test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, S::npos); - test(S("ecgdanriptblhjfqskom"), "", 21, 0, 19); - test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, 19); - test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, 19); - test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, 19); - test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, 19); - test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, 19); - test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, 19); - test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, 19); - test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, 18); - test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, 19); - test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, 19); - test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, 19); - test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, 19); - test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, 19); - test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, 7); - test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - test2(); - test3(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_last_not_of( "", 0, 0) == SV::npos, "" ); - static_assert (sv1.find_last_not_of( "irkhs", 0, 5) == SV::npos, "" ); - static_assert (sv2.find_last_not_of( "", 0, 0) == 0, "" ); - static_assert (sv2.find_last_not_of( "gfsrt", 5, 0) == 4, "" ); - static_assert (sv2.find_last_not_of( "lecar", 5, 0) == 4, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp deleted file mode 100644 index 40c867d6b..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// size_type find_last_not_of(const basic_string& str, size_type pos = npos) const; - -#include -#include - -template -void -test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) -{ - assert(s.find_last_not_of(str, pos) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void -test(const S& s, const S& str, typename S::size_type x) -{ - assert(s.find_last_not_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), S(""), 0, S::npos); - test(S(""), S("laenf"), 0, S::npos); - test(S(""), S("pqlnkmbdjo"), 0, S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos); - test(S(""), S(""), 1, S::npos); - test(S(""), S("bjaht"), 1, S::npos); - test(S(""), S("hjlcmgpket"), 1, S::npos); - test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos); - test(S("fodgq"), S(""), 0, 0); - test(S("qanej"), S("dfkap"), 0, 0); - test(S("clbao"), S("ihqrfebgad"), 0, 0); - test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, S::npos); - test(S("srdfq"), S(""), 1, 1); - test(S("oemth"), S("ikcrq"), 1, 1); - test(S("cdaih"), S("dmajblfhsg"), 1, 0); - test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, S::npos); - test(S("cshmd"), S(""), 2, 2); - test(S("lhcdo"), S("oebqi"), 2, 2); - test(S("qnsoh"), S("kojhpmbsfe"), 2, 1); - test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, S::npos); - test(S("fmtsp"), S(""), 4, 4); - test(S("khbpm"), S("aobjd"), 4, 4); - test(S("pbsji"), S("pcbahntsje"), 4, 4); - test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, S::npos); - test(S("eqmpa"), S(""), 5, 4); - test(S("omigs"), S("kocgb"), 5, 4); - test(S("onmje"), S("fbslrjiqkm"), 5, 4); - test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, S::npos); - test(S("schfa"), S(""), 6, 4); - test(S("igdsc"), S("qngpd"), 6, 4); - test(S("brqgo"), S("rodhqklgmb"), 6, S::npos); - test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, S::npos); - test(S("hcjitbfapl"), S(""), 0, 0); - test(S("daiprenocl"), S("ashjd"), 0, S::npos); - test(S("litpcfdghe"), S("mgojkldsqh"), 0, S::npos); - test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, S::npos); - test(S("qpghtfbaji"), S(""), 1, 1); - test(S("gfshlcmdjr"), S("nadkh"), 1, 1); - test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 0); - test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, S::npos); - test(S("crnklpmegd"), S(""), 5, 5); - test(S("jsbtafedoc"), S("prqgn"), 5, 5); - test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 4); - test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, S::npos); - test(S("lmofqdhpki"), S(""), 9, 9); - test(S("hnefkqimca"), S("rtjpa"), 9, 8); - test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, 9); - test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, S::npos); - test(S("elgofjmbrq"), S(""), 10, 9); - test(S("mjqdgalkpc"), S("dplqa"), 10, 9); - test(S("kthqnfcerm"), S("dkacjoptns"), 10, 9); - test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, S::npos); - test(S("eqsgalomhb"), S(""), 11, 9); - test(S("akiteljmoh"), S("lofbc"), 11, 9); - test(S("hlbdfreqjo"), S("astoegbfpn"), 11, 8); - test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, S::npos); - test(S("snafbdlghrjkpqtoceim"), S(""), 0, 0); - test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, 0); - test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, S::npos); - test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, S::npos); - test(S("jlnkraeodhcspfgbqitm"), S(""), 1, 1); - test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, 1); - test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 0); - test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, S::npos); - test(S("hdpkobnsalmcfijregtq"), S(""), 10, 10); - test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 9); - test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 9); - test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, S::npos); - test(S("niptglfbosehkamrdqcj"), S(""), 19, 19); - test(S("copqdhstbingamjfkler"), S("djkqc"), 19, 19); - test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, 16); - test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, S::npos); - test(S("eaintpchlqsbdgrkjofm"), S(""), 20, 19); - test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, 18); - test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, 19); - test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, S::npos); - test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, 19); - test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, 19); - test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, 19); - test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); -} - -template -void test1() -{ - test(S(""), S(""), S::npos); - test(S(""), S("laenf"), S::npos); - test(S(""), S("pqlnkmbdjo"), S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), S::npos); - test(S("nhmko"), S(""), 4); - test(S("lahfb"), S("irkhs"), 4); - test(S("gmfhd"), S("kantesmpgj"), 4); - test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), S::npos); - test(S("eolhfgpjqk"), S(""), 9); - test(S("nbatdlmekr"), S("bnrpe"), 8); - test(S("jdmciepkaq"), S("jtdaefblso"), 9); - test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), S::npos); - test(S("gprdcokbnjhlsfmtieqa"), S(""), 19); - test(S("qjghlnftcaismkropdeb"), S("bjaht"), 18); - test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 17); - test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp deleted file mode 100644 index b949eec1b..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_last_of(charT c, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, typename S::value_type c, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_last_of(c, pos) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void -test(const S& s, typename S::value_type c, typename S::size_type x) -{ - assert(s.find_last_of(c) == x); - if (x != S::npos) - assert(x < s.size()); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), 'm', 0, S::npos); - test(S(""), 'm', 1, S::npos); - test(S("kitcj"), 'm', 0, S::npos); - test(S("qkamf"), 'm', 1, S::npos); - test(S("nhmko"), 'm', 2, 2); - test(S("tpsaf"), 'm', 4, S::npos); - test(S("lahfb"), 'm', 5, S::npos); - test(S("irkhs"), 'm', 6, S::npos); - test(S("gmfhdaipsr"), 'm', 0, S::npos); - test(S("kantesmpgj"), 'm', 1, S::npos); - test(S("odaftiegpm"), 'm', 5, S::npos); - test(S("oknlrstdpi"), 'm', 9, S::npos); - test(S("eolhfgpjqk"), 'm', 10, S::npos); - test(S("pcdrofikas"), 'm', 11, S::npos); - test(S("nbatdlmekrgcfqsophij"), 'm', 0, S::npos); - test(S("bnrpehidofmqtcksjgla"), 'm', 1, S::npos); - test(S("jdmciepkaqgotsrfnhlb"), 'm', 10, 2); - test(S("jtdaefblsokrmhpgcnqi"), 'm', 19, 12); - test(S("hkbgspofltajcnedqmri"), 'm', 20, 17); - test(S("oselktgbcapndfjihrmq"), 'm', 21, 18); - - test(S(""), 'm', S::npos); - test(S("csope"), 'm', S::npos); - test(S("gfsmthlkon"), 'm', 3); - test(S("laenfsbridchgotmkqpj"), 'm', 15); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_last_of( 'i', 0 ) == SV::npos, "" ); - static_assert (sv1.find_last_of( 'i', 1 ) == SV::npos, "" ); - static_assert (sv2.find_last_of( 'a', 0 ) == 0, "" ); - static_assert (sv2.find_last_of( 'a', 1 ) == 0, "" ); - static_assert (sv2.find_last_of( 'e', 5 ) == 4, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp deleted file mode 100644 index 3755b2653..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp +++ /dev/null @@ -1,166 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_last_of(const charT* s, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find_last_of(str, pos) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type x) -{ - assert(s.find_last_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, S::npos); - test(S(""), "laenf", 0, S::npos); - test(S(""), "pqlnkmbdjo", 0, S::npos); - test(S(""), "qkamfogpnljdcshbreti", 0, S::npos); - test(S(""), "", 1, S::npos); - test(S(""), "bjaht", 1, S::npos); - test(S(""), "hjlcmgpket", 1, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos); - test(S("fodgq"), "", 0, S::npos); - test(S("qanej"), "dfkap", 0, S::npos); - test(S("clbao"), "ihqrfebgad", 0, S::npos); - test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, 0); - test(S("srdfq"), "", 1, S::npos); - test(S("oemth"), "ikcrq", 1, S::npos); - test(S("cdaih"), "dmajblfhsg", 1, 1); - test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, 1); - test(S("cshmd"), "", 2, S::npos); - test(S("lhcdo"), "oebqi", 2, S::npos); - test(S("qnsoh"), "kojhpmbsfe", 2, 2); - test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, 2); - test(S("fmtsp"), "", 4, S::npos); - test(S("khbpm"), "aobjd", 4, 2); - test(S("pbsji"), "pcbahntsje", 4, 3); - test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, 4); - test(S("eqmpa"), "", 5, S::npos); - test(S("omigs"), "kocgb", 5, 3); - test(S("onmje"), "fbslrjiqkm", 5, 3); - test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, 4); - test(S("schfa"), "", 6, S::npos); - test(S("igdsc"), "qngpd", 6, 2); - test(S("brqgo"), "rodhqklgmb", 6, 4); - test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, 4); - test(S("hcjitbfapl"), "", 0, S::npos); - test(S("daiprenocl"), "ashjd", 0, 0); - test(S("litpcfdghe"), "mgojkldsqh", 0, 0); - test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, 0); - test(S("qpghtfbaji"), "", 1, S::npos); - test(S("gfshlcmdjr"), "nadkh", 1, S::npos); - test(S("nkodajteqp"), "ofdrqmkebl", 1, 1); - test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, 1); - test(S("crnklpmegd"), "", 5, S::npos); - test(S("jsbtafedoc"), "prqgn", 5, S::npos); - test(S("qnmodrtkeb"), "pejafmnokr", 5, 5); - test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, 5); - test(S("lmofqdhpki"), "", 9, S::npos); - test(S("hnefkqimca"), "rtjpa", 9, 9); - test(S("drtasbgmfp"), "ktsrmnqagd", 9, 7); - test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, 9); - test(S("elgofjmbrq"), "", 10, S::npos); - test(S("mjqdgalkpc"), "dplqa", 10, 8); - test(S("kthqnfcerm"), "dkacjoptns", 10, 6); - test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, 9); - test(S("eqsgalomhb"), "", 11, S::npos); - test(S("akiteljmoh"), "lofbc", 11, 8); - test(S("hlbdfreqjo"), "astoegbfpn", 11, 9); - test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, 9); - test(S("snafbdlghrjkpqtoceim"), "", 0, S::npos); - test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, S::npos); - test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, 0); - test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, 0); - test(S("jlnkraeodhcspfgbqitm"), "", 1, S::npos); - test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, S::npos); - test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 1); - test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, 1); - test(S("hdpkobnsalmcfijregtq"), "", 10, S::npos); - test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 10); - test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 10); - test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, 10); - test(S("niptglfbosehkamrdqcj"), "", 19, S::npos); - test(S("copqdhstbingamjfkler"), "djkqc", 19, 16); - test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, 19); - test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, 19); - test(S("eaintpchlqsbdgrkjofm"), "", 20, S::npos); - test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, 19); - test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, 18); - test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, 19); - test(S("liatsqdoegkmfcnbhrpj"), "", 21, S::npos); - test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, 12); - test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, 17); - test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, 19); -} - -template -void test1() -{ - test(S(""), "", S::npos); - test(S(""), "laenf", S::npos); - test(S(""), "pqlnkmbdjo", S::npos); - test(S(""), "qkamfogpnljdcshbreti", S::npos); - test(S("nhmko"), "", S::npos); - test(S("lahfb"), "irkhs", 2); - test(S("gmfhd"), "kantesmpgj", 1); - test(S("odaft"), "oknlrstdpiqmjbaghcfe", 4); - test(S("eolhfgpjqk"), "", S::npos); - test(S("nbatdlmekr"), "bnrpe", 9); - test(S("jdmciepkaq"), "jtdaefblso", 8); - test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", 9); - test(S("gprdcokbnjhlsfmtieqa"), "", S::npos); - test(S("qjghlnftcaismkropdeb"), "bjaht", 19); - test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 19); - test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 19); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_last_of( "", 0) == SV::npos, "" ); - static_assert (sv1.find_last_of( "irkhs", 5) == SV::npos, "" ); - static_assert (sv2.find_last_of( "", 0) == SV::npos, "" ); - static_assert (sv2.find_last_of( "gfsrt", 5) == SV::npos, "" ); - static_assert (sv2.find_last_of( "lecar", 5) == 4, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp deleted file mode 100644 index 64b29ec7d..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type n, typename S::size_type x) -{ - assert(s.find_last_of(str, pos, n) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, 0, S::npos); - test(S(""), "irkhs", 0, 0, S::npos); - test(S(""), "kante", 0, 1, S::npos); - test(S(""), "oknlr", 0, 2, S::npos); - test(S(""), "pcdro", 0, 4, S::npos); - test(S(""), "bnrpe", 0, 5, S::npos); - test(S(""), "jtdaefblso", 0, 0, S::npos); - test(S(""), "oselktgbca", 0, 1, S::npos); - test(S(""), "eqgaplhckj", 0, 5, S::npos); - test(S(""), "bjahtcmnlp", 0, 9, S::npos); - test(S(""), "hjlcmgpket", 0, 10, S::npos); - test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos); - test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos); - test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos); - test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos); - test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos); - test(S(""), "", 1, 0, S::npos); - test(S(""), "lbtqd", 1, 0, S::npos); - test(S(""), "tboim", 1, 1, S::npos); - test(S(""), "slcer", 1, 2, S::npos); - test(S(""), "cbjfs", 1, 4, S::npos); - test(S(""), "aqibs", 1, 5, S::npos); - test(S(""), "gtfblmqinc", 1, 0, S::npos); - test(S(""), "mkqpbtdalg", 1, 1, S::npos); - test(S(""), "kphatlimcd", 1, 5, S::npos); - test(S(""), "pblasqogic", 1, 9, S::npos); - test(S(""), "arosdhcfme", 1, 10, S::npos); - test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos); - test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos); - test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos); - test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos); - test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos); - test(S("eaint"), "", 0, 0, S::npos); - test(S("binja"), "gfsrt", 0, 0, S::npos); - test(S("latkm"), "pfsoc", 0, 1, S::npos); - test(S("lecfr"), "tpflm", 0, 2, S::npos); - test(S("eqkst"), "sgkec", 0, 4, 0); - test(S("cdafr"), "romds", 0, 5, S::npos); - test(S("prbhe"), "qhjistlgmr", 0, 0, S::npos); - test(S("lbisk"), "pedfirsglo", 0, 1, S::npos); - test(S("hrlpd"), "aqcoslgrmk", 0, 5, S::npos); - test(S("ehmja"), "dabckmepqj", 0, 9, 0); - test(S("mhqgd"), "pqscrjthli", 0, 10, S::npos); - test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, S::npos); - test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, S::npos); - test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, S::npos); - test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, 0); - test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, 0); - test(S("clrgb"), "", 1, 0, S::npos); - test(S("tjmek"), "osmia", 1, 0, S::npos); - test(S("bgstp"), "ckonl", 1, 1, S::npos); - test(S("hstrk"), "ilcaj", 1, 2, S::npos); - test(S("kmspj"), "lasiq", 1, 4, S::npos); - test(S("tjboh"), "kfqmr", 1, 5, S::npos); - test(S("ilbcj"), "klnitfaobg", 1, 0, S::npos); - test(S("jkngf"), "gjhmdlqikp", 1, 1, S::npos); - test(S("gfcql"), "skbgtahqej", 1, 5, 0); - test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 0); - test(S("bthpg"), "bjgfmnlkio", 1, 10, 0); - test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, S::npos); - test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, S::npos); - test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, 1); - test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, 1); - test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, 1); - test(S("ndrhl"), "", 2, 0, S::npos); - test(S("mrecp"), "otkgb", 2, 0, S::npos); - test(S("qlasf"), "cqsjl", 2, 1, S::npos); - test(S("smaqd"), "dpifl", 2, 2, S::npos); - test(S("hjeni"), "oapht", 2, 4, 0); - test(S("ocmfj"), "cifts", 2, 5, 1); - test(S("hmftq"), "nmsckbgalo", 2, 0, S::npos); - test(S("fklad"), "tpksqhamle", 2, 1, S::npos); - test(S("dirnm"), "tpdrchmkji", 2, 5, 2); - test(S("hrgdc"), "ijagfkblst", 2, 9, 2); - test(S("ifakg"), "kpocsignjb", 2, 10, 0); - test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, S::npos); - test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, S::npos); - test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 1); - test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, 2); - test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, 2); - test(S("cjgao"), "", 4, 0, S::npos); - test(S("kjplq"), "mabns", 4, 0, S::npos); - test(S("herni"), "bdnrp", 4, 1, S::npos); - test(S("tadrb"), "scidp", 4, 2, S::npos); - test(S("pkfeo"), "agbjl", 4, 4, S::npos); - test(S("hoser"), "jfmpr", 4, 5, 4); - test(S("kgrsp"), "rbpefghsmj", 4, 0, S::npos); - test(S("pgejb"), "apsfntdoqc", 4, 1, S::npos); - test(S("thlnq"), "ndkjeisgcl", 4, 5, 3); - test(S("nbmit"), "rnfpqatdeo", 4, 9, 4); - test(S("jgmib"), "bntjlqrfik", 4, 10, 4); - test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, S::npos); - test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, S::npos); - test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, 4); - test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, 4); - test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, 4); - test(S("klopi"), "", 5, 0, S::npos); - test(S("dajhn"), "psthd", 5, 0, S::npos); - test(S("jbgno"), "rpmjd", 5, 1, S::npos); - test(S("hkjae"), "dfsmk", 5, 2, S::npos); -} - -template -void test1() -{ - test(S("gbhqo"), "skqne", 5, 4, 3); - test(S("ktdor"), "kipnf", 5, 5, 0); - test(S("ldprn"), "hmrnqdgifl", 5, 0, S::npos); - test(S("egmjk"), "fsmjcdairn", 5, 1, S::npos); - test(S("armql"), "pcdgltbrfj", 5, 5, 4); - test(S("cdhjo"), "aekfctpirg", 5, 9, 0); - test(S("jcons"), "ledihrsgpf", 5, 10, 4); - test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, S::npos); - test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, S::npos); - test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, 4); - test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, 4); - test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, 4); - test(S("gajqn"), "", 6, 0, S::npos); - test(S("stedk"), "hrnat", 6, 0, S::npos); - test(S("tjkaf"), "gsqdt", 6, 1, S::npos); - test(S("dthpe"), "bspkd", 6, 2, S::npos); - test(S("klhde"), "ohcmb", 6, 4, 2); - test(S("bhlki"), "heatr", 6, 5, 1); - test(S("lqmoh"), "pmblckedfn", 6, 0, S::npos); - test(S("mtqin"), "aceqmsrbik", 6, 1, S::npos); - test(S("dpqbr"), "lmbtdehjrn", 6, 5, 3); - test(S("kdhmo"), "teqmcrlgib", 6, 9, 3); - test(S("jblqp"), "njolbmspac", 6, 10, 4); - test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, S::npos); - test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, S::npos); - test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, 4); - test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, 4); - test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, 4); - test(S("jnkrfhotgl"), "", 0, 0, S::npos); - test(S("dltjfngbko"), "rqegt", 0, 0, S::npos); - test(S("bmjlpkiqde"), "dashm", 0, 1, S::npos); - test(S("skrflobnqm"), "jqirk", 0, 2, S::npos); - test(S("jkpldtshrm"), "rckeg", 0, 4, S::npos); - test(S("ghasdbnjqo"), "jscie", 0, 5, S::npos); - test(S("igrkhpbqjt"), "efsphndliq", 0, 0, S::npos); - test(S("ikthdgcamf"), "gdicosleja", 0, 1, S::npos); - test(S("pcofgeniam"), "qcpjibosfl", 0, 5, 0); - test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, 0); - test(S("itphbqsker"), "dtablcrseo", 0, 10, S::npos); - test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, S::npos); - test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, S::npos); - test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, S::npos); - test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, 0); - test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, 0); - test(S("shbcqnmoar"), "", 1, 0, S::npos); - test(S("bdoshlmfin"), "ontrs", 1, 0, S::npos); - test(S("khfrebnsgq"), "pfkna", 1, 1, S::npos); - test(S("getcrsaoji"), "ekosa", 1, 2, 1); - test(S("fjiknedcpq"), "anqhk", 1, 4, S::npos); - test(S("tkejgnafrm"), "jekca", 1, 5, 1); - test(S("jnakolqrde"), "ikemsjgacf", 1, 0, S::npos); - test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, S::npos); - test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 1); - test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 0); - test(S("cigfqkated"), "sqcflrgtim", 1, 10, 1); - test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, S::npos); - test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, S::npos); - test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, 1); - test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, 1); - test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, 1); - test(S("ectnhskflp"), "", 5, 0, S::npos); - test(S("fgtianblpq"), "pijag", 5, 0, S::npos); - test(S("mfeqklirnh"), "jrckd", 5, 1, S::npos); - test(S("astedncjhk"), "qcloh", 5, 2, S::npos); - test(S("fhlqgcajbr"), "thlmp", 5, 4, 2); - test(S("epfhocmdng"), "qidmo", 5, 5, 4); - test(S("apcnsibger"), "lnegpsjqrd", 5, 0, S::npos); - test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 5); - test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, S::npos); - test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 5); - test(S("jbhcfposld"), "trfqgmckbe", 5, 10, 4); - test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, S::npos); - test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, S::npos); - test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 5); - test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, 5); - test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, 5); - test(S("shoiedtcjb"), "", 9, 0, S::npos); - test(S("ebcinjgads"), "tqbnh", 9, 0, S::npos); - test(S("dqmregkcfl"), "akmle", 9, 1, S::npos); - test(S("ngcrieqajf"), "iqfkm", 9, 2, 6); - test(S("qosmilgnjb"), "tqjsr", 9, 4, 8); - test(S("ikabsjtdfl"), "jplqg", 9, 5, 9); - test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, S::npos); - test(S("fdnplotmgh"), "morkglpesn", 9, 1, 7); - test(S("fdbicojerm"), "dmicerngat", 9, 5, 9); - test(S("mbtafndjcq"), "radgeskbtc", 9, 9, 6); - test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, 5); - test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, S::npos); - test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, 6); - test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, 7); - test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, 9); - test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, 9); - test(S("ncjpmaekbs"), "", 10, 0, S::npos); - test(S("hlbosgmrak"), "hpmsd", 10, 0, S::npos); - test(S("pqfhsgilen"), "qnpor", 10, 1, 1); - test(S("gqtjsbdckh"), "otdma", 10, 2, 2); - test(S("cfkqpjlegi"), "efhjg", 10, 4, 7); - test(S("beanrfodgj"), "odpte", 10, 5, 7); - test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, S::npos); - test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 1); -} - -template -void test2() -{ - test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 9); - test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, 8); - test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, 9); - test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, S::npos); - test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, 8); - test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, 9); - test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, 9); - test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, 9); - test(S("cqjohampgd"), "", 11, 0, S::npos); - test(S("hobitmpsan"), "aocjb", 11, 0, S::npos); - test(S("tjehkpsalm"), "jbrnk", 11, 1, 1); - test(S("ngfbojitcl"), "tqedg", 11, 2, 7); - test(S("rcfkdbhgjo"), "nqskp", 11, 4, 3); - test(S("qghptonrea"), "eaqkl", 11, 5, 9); - test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, S::npos); - test(S("hlmgabenti"), "lsftgajqpm", 11, 1, 1); - test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, 7); - test(S("jqedtkornm"), "shkncmiaqj", 11, 9, 9); - test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, 9); - test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, S::npos); - test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, S::npos); - test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, 9); - test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, 9); - test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, 9); - test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, S::npos); - test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, S::npos); - test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, S::npos); - test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, S::npos); - test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, S::npos); - test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, S::npos); - test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, S::npos); - test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, S::npos); - test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, S::npos); - test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, S::npos); - test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, S::npos); - test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, S::npos); - test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, S::npos); - test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, S::npos); - test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, 0); - test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, 0); - test(S("febhmqtjanokscdirpgl"), "", 1, 0, S::npos); - test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, S::npos); - test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, S::npos); - test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 1); - test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 1); - test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, S::npos); - test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, S::npos); - test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, S::npos); - test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, S::npos); - test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 1); - test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 1); - test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, S::npos); - test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, S::npos); - test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 1); - test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, 1); - test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, 1); - test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, S::npos); - test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, S::npos); - test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, S::npos); - test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, 7); - test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 10); - test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 6); - test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, S::npos); - test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, 9); - test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 5); - test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 10); - test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 9); - test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, S::npos); - test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, S::npos); - test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 10); - test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, 10); - test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, 10); - test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, S::npos); - test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, S::npos); - test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, 16); - test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, 7); - test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, 16); - test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, 19); - test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, S::npos); - test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, 15); - test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, 17); - test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, 16); - test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, 16); - test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, S::npos); - test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, 10); - test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, 19); - test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, 19); - test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, 19); - test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, S::npos); - test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, S::npos); - test(S("grkpahljcftesdmonqib"), "odife", 20, 1, 15); - test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, 12); - test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, 19); - test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, 19); - test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, S::npos); - test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, 3); - test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, 19); - test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, 19); - test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, 19); - test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); -} - -template -void test3() -{ - test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 4); - test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, 17); - test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, 19); - test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, 19); - test(S("ecgdanriptblhjfqskom"), "", 21, 0, S::npos); - test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, S::npos); - test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, 6); - test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, 13); - test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, 10); - test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, 17); - test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, S::npos); - test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, 14); - test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, 19); - test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, 14); - test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, 16); - test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, S::npos); - test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, 17); - test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, 17); - test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, 19); - test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, 19); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - test2(); - test3(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find_last_of( "", 0, 0) == SV::npos, "" ); - static_assert (sv1.find_last_of( "irkhs", 0, 5) == SV::npos, "" ); - static_assert (sv2.find_last_of( "", 0, 0) == SV::npos, "" ); - static_assert (sv2.find_last_of( "gfsrt", 5, 5) == SV::npos, "" ); - static_assert (sv2.find_last_of( "lecar", 5, 5) == 4, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_string_view_size.pass.cpp deleted file mode 100644 index 6fd3772fc..000000000 --- a/test/std/experimental/string.view/string.view.find/find_last_of_string_view_size.pass.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// size_type find_last_of(const basic_string& str, size_type pos = npos) const; - -#include -#include - -template -void -test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) -{ - assert(s.find_last_of(str, pos) == x); - if (x != S::npos) - assert(x <= pos && x < s.size()); -} - -template -void -test(const S& s, const S& str, typename S::size_type x) -{ - assert(s.find_last_of(str) == x); - if (x != S::npos) - assert(x < s.size()); -} - -template -void test0() -{ - test(S(""), S(""), 0, S::npos); - test(S(""), S("laenf"), 0, S::npos); - test(S(""), S("pqlnkmbdjo"), 0, S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos); - test(S(""), S(""), 1, S::npos); - test(S(""), S("bjaht"), 1, S::npos); - test(S(""), S("hjlcmgpket"), 1, S::npos); - test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos); - test(S("fodgq"), S(""), 0, S::npos); - test(S("qanej"), S("dfkap"), 0, S::npos); - test(S("clbao"), S("ihqrfebgad"), 0, S::npos); - test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, 0); - test(S("srdfq"), S(""), 1, S::npos); - test(S("oemth"), S("ikcrq"), 1, S::npos); - test(S("cdaih"), S("dmajblfhsg"), 1, 1); - test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, 1); - test(S("cshmd"), S(""), 2, S::npos); - test(S("lhcdo"), S("oebqi"), 2, S::npos); - test(S("qnsoh"), S("kojhpmbsfe"), 2, 2); - test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, 2); - test(S("fmtsp"), S(""), 4, S::npos); - test(S("khbpm"), S("aobjd"), 4, 2); - test(S("pbsji"), S("pcbahntsje"), 4, 3); - test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, 4); - test(S("eqmpa"), S(""), 5, S::npos); - test(S("omigs"), S("kocgb"), 5, 3); - test(S("onmje"), S("fbslrjiqkm"), 5, 3); - test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, 4); - test(S("schfa"), S(""), 6, S::npos); - test(S("igdsc"), S("qngpd"), 6, 2); - test(S("brqgo"), S("rodhqklgmb"), 6, 4); - test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, 4); - test(S("hcjitbfapl"), S(""), 0, S::npos); - test(S("daiprenocl"), S("ashjd"), 0, 0); - test(S("litpcfdghe"), S("mgojkldsqh"), 0, 0); - test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, 0); - test(S("qpghtfbaji"), S(""), 1, S::npos); - test(S("gfshlcmdjr"), S("nadkh"), 1, S::npos); - test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 1); - test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, 1); - test(S("crnklpmegd"), S(""), 5, S::npos); - test(S("jsbtafedoc"), S("prqgn"), 5, S::npos); - test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 5); - test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, 5); - test(S("lmofqdhpki"), S(""), 9, S::npos); - test(S("hnefkqimca"), S("rtjpa"), 9, 9); - test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, 7); - test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, 9); - test(S("elgofjmbrq"), S(""), 10, S::npos); - test(S("mjqdgalkpc"), S("dplqa"), 10, 8); - test(S("kthqnfcerm"), S("dkacjoptns"), 10, 6); - test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, 9); - test(S("eqsgalomhb"), S(""), 11, S::npos); - test(S("akiteljmoh"), S("lofbc"), 11, 8); - test(S("hlbdfreqjo"), S("astoegbfpn"), 11, 9); - test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, 9); - test(S("snafbdlghrjkpqtoceim"), S(""), 0, S::npos); - test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, S::npos); - test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, 0); - test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, 0); - test(S("jlnkraeodhcspfgbqitm"), S(""), 1, S::npos); - test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, S::npos); - test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 1); - test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, 1); - test(S("hdpkobnsalmcfijregtq"), S(""), 10, S::npos); - test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 10); - test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 10); - test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, 10); - test(S("niptglfbosehkamrdqcj"), S(""), 19, S::npos); - test(S("copqdhstbingamjfkler"), S("djkqc"), 19, 16); - test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, 19); - test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, 19); - test(S("eaintpchlqsbdgrkjofm"), S(""), 20, S::npos); - test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, 19); - test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, 18); - test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, 19); - test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, S::npos); - test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, 12); - test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, 17); - test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, 19); -} - -template -void test1() -{ - test(S(""), S(""), S::npos); - test(S(""), S("laenf"), S::npos); - test(S(""), S("pqlnkmbdjo"), S::npos); - test(S(""), S("qkamfogpnljdcshbreti"), S::npos); - test(S("nhmko"), S(""), S::npos); - test(S("lahfb"), S("irkhs"), 2); - test(S("gmfhd"), S("kantesmpgj"), 1); - test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), 4); - test(S("eolhfgpjqk"), S(""), S::npos); - test(S("nbatdlmekr"), S("bnrpe"), 9); - test(S("jdmciepkaq"), S("jtdaefblso"), 8); - test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), 9); - test(S("gprdcokbnjhlsfmtieqa"), S(""), S::npos); - test(S("qjghlnftcaismkropdeb"), S("bjaht"), 19); - test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 19); - test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 19); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } -} diff --git a/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp deleted file mode 100644 index bdccb2f22..000000000 --- a/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp +++ /dev/null @@ -1,172 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find(const charT* s, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.find(str, pos) == x); - if (x != S::npos) - { - typename S::size_type n = S::traits_type::length(str); - assert(pos <= x && x + n <= s.size()); - } -} - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type x) -{ - assert(s.find(str) == x); - if (x != S::npos) - { - typename S::size_type n = S::traits_type::length(str); - assert(0 <= x && x + n <= s.size()); - } -} - -template -void test0() -{ - test(S(""), "", 0, 0); - test(S(""), "abcde", 0, S::npos); - test(S(""), "abcdeabcde", 0, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, S::npos); - test(S(""), "", 1, S::npos); - test(S(""), "abcde", 1, S::npos); - test(S(""), "abcdeabcde", 1, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcde"), "", 0, 0); - test(S("abcde"), "abcde", 0, 0); - test(S("abcde"), "abcdeabcde", 0, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, S::npos); - test(S("abcde"), "", 1, 1); - test(S("abcde"), "abcde", 1, S::npos); - test(S("abcde"), "abcdeabcde", 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcde"), "", 2, 2); - test(S("abcde"), "abcde", 2, S::npos); - test(S("abcde"), "abcdeabcde", 2, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, S::npos); - test(S("abcde"), "", 4, 4); - test(S("abcde"), "abcde", 4, S::npos); - test(S("abcde"), "abcdeabcde", 4, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, S::npos); - test(S("abcde"), "", 5, 5); - test(S("abcde"), "abcde", 5, S::npos); - test(S("abcde"), "abcdeabcde", 5, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, S::npos); - test(S("abcde"), "", 6, S::npos); - test(S("abcde"), "abcde", 6, S::npos); - test(S("abcde"), "abcdeabcde", 6, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, S::npos); - test(S("abcdeabcde"), "", 0, 0); - test(S("abcdeabcde"), "abcde", 0, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, S::npos); - test(S("abcdeabcde"), "", 1, 1); - test(S("abcdeabcde"), "abcde", 1, 5); - test(S("abcdeabcde"), "abcdeabcde", 1, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcdeabcde"), "", 5, 5); - test(S("abcdeabcde"), "abcde", 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, S::npos); - test(S("abcdeabcde"), "", 9, 9); - test(S("abcdeabcde"), "abcde", 9, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 9, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, S::npos); - test(S("abcdeabcde"), "", 10, 10); - test(S("abcdeabcde"), "abcde", 10, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos); - test(S("abcdeabcde"), "", 11, S::npos); - test(S("abcdeabcde"), "abcde", 11, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 11, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "", 1, 1); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 19, 19); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 20, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 21, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, S::npos); -} - -template -void test1() -{ - test(S(""), "", 0); - test(S(""), "abcde", S::npos); - test(S(""), "abcdeabcde", S::npos); - test(S(""), "abcdeabcdeabcdeabcde", S::npos); - test(S("abcde"), "", 0); - test(S("abcde"), "abcde", 0); - test(S("abcde"), "abcdeabcde", S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", S::npos); - test(S("abcdeabcde"), "", 0); - test(S("abcdeabcde"), "abcde", 0); - test(S("abcdeabcde"), "abcdeabcde", 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find( "") == 0, "" ); - static_assert (sv1.find( "abcde") == SV::npos, "" ); - static_assert (sv2.find( "") == 0, "" ); - static_assert (sv2.find( "abcde") == 0, "" ); - static_assert (sv2.find( "abcde", 1) == SV::npos, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp deleted file mode 100644 index 856dc4a3a..000000000 --- a/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp +++ /dev/null @@ -1,394 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find(const charT* s, size_type pos, size_type n) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type n, typename S::size_type x) -{ - assert(s.find(str, pos, n) == x); - if (x != S::npos) - assert(pos <= x && x + n <= s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, 0, 0); - test(S(""), "abcde", 0, 0, 0); - test(S(""), "abcde", 0, 1, S::npos); - test(S(""), "abcde", 0, 2, S::npos); - test(S(""), "abcde", 0, 4, S::npos); - test(S(""), "abcde", 0, 5, S::npos); - test(S(""), "abcdeabcde", 0, 0, 0); - test(S(""), "abcdeabcde", 0, 1, S::npos); - test(S(""), "abcdeabcde", 0, 5, S::npos); - test(S(""), "abcdeabcde", 0, 9, S::npos); - test(S(""), "abcdeabcde", 0, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S(""), "abcdeabcdeabcdeabcde", 0, 1, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 19, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 20, S::npos); - test(S(""), "", 1, 0, S::npos); - test(S(""), "abcde", 1, 0, S::npos); - test(S(""), "abcde", 1, 1, S::npos); - test(S(""), "abcde", 1, 2, S::npos); - test(S(""), "abcde", 1, 4, S::npos); - test(S(""), "abcde", 1, 5, S::npos); - test(S(""), "abcdeabcde", 1, 0, S::npos); - test(S(""), "abcdeabcde", 1, 1, S::npos); - test(S(""), "abcdeabcde", 1, 5, S::npos); - test(S(""), "abcdeabcde", 1, 9, S::npos); - test(S(""), "abcdeabcde", 1, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 0, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 1, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcde"), "", 0, 0, 0); - test(S("abcde"), "abcde", 0, 0, 0); - test(S("abcde"), "abcde", 0, 1, 0); - test(S("abcde"), "abcde", 0, 2, 0); - test(S("abcde"), "abcde", 0, 4, 0); - test(S("abcde"), "abcde", 0, 5, 0); - test(S("abcde"), "abcdeabcde", 0, 0, 0); - test(S("abcde"), "abcdeabcde", 0, 1, 0); - test(S("abcde"), "abcdeabcde", 0, 5, 0); - test(S("abcde"), "abcdeabcde", 0, 9, S::npos); - test(S("abcde"), "abcdeabcde", 0, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos); - test(S("abcde"), "", 1, 0, 1); - test(S("abcde"), "abcde", 1, 0, 1); - test(S("abcde"), "abcde", 1, 1, S::npos); - test(S("abcde"), "abcde", 1, 2, S::npos); - test(S("abcde"), "abcde", 1, 4, S::npos); - test(S("abcde"), "abcde", 1, 5, S::npos); - test(S("abcde"), "abcdeabcde", 1, 0, 1); - test(S("abcde"), "abcdeabcde", 1, 1, S::npos); - test(S("abcde"), "abcdeabcde", 1, 5, S::npos); - test(S("abcde"), "abcdeabcde", 1, 9, S::npos); - test(S("abcde"), "abcdeabcde", 1, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 0, 1); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcde"), "", 2, 0, 2); - test(S("abcde"), "abcde", 2, 0, 2); - test(S("abcde"), "abcde", 2, 1, S::npos); - test(S("abcde"), "abcde", 2, 2, S::npos); - test(S("abcde"), "abcde", 2, 4, S::npos); - test(S("abcde"), "abcde", 2, 5, S::npos); - test(S("abcde"), "abcdeabcde", 2, 0, 2); - test(S("abcde"), "abcdeabcde", 2, 1, S::npos); - test(S("abcde"), "abcdeabcde", 2, 5, S::npos); - test(S("abcde"), "abcdeabcde", 2, 9, S::npos); - test(S("abcde"), "abcdeabcde", 2, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 0, 2); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 20, S::npos); - test(S("abcde"), "", 4, 0, 4); - test(S("abcde"), "abcde", 4, 0, 4); - test(S("abcde"), "abcde", 4, 1, S::npos); - test(S("abcde"), "abcde", 4, 2, S::npos); - test(S("abcde"), "abcde", 4, 4, S::npos); - test(S("abcde"), "abcde", 4, 5, S::npos); - test(S("abcde"), "abcdeabcde", 4, 0, 4); - test(S("abcde"), "abcdeabcde", 4, 1, S::npos); - test(S("abcde"), "abcdeabcde", 4, 5, S::npos); - test(S("abcde"), "abcdeabcde", 4, 9, S::npos); - test(S("abcde"), "abcdeabcde", 4, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 0, 4); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 20, S::npos); - test(S("abcde"), "", 5, 0, 5); - test(S("abcde"), "abcde", 5, 0, 5); - test(S("abcde"), "abcde", 5, 1, S::npos); - test(S("abcde"), "abcde", 5, 2, S::npos); -} - -template -void test1() -{ - test(S("abcde"), "abcde", 5, 4, S::npos); - test(S("abcde"), "abcde", 5, 5, S::npos); - test(S("abcde"), "abcdeabcde", 5, 0, 5); - test(S("abcde"), "abcdeabcde", 5, 1, S::npos); - test(S("abcde"), "abcdeabcde", 5, 5, S::npos); - test(S("abcde"), "abcdeabcde", 5, 9, S::npos); - test(S("abcde"), "abcdeabcde", 5, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 0, 5); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos); - test(S("abcde"), "", 6, 0, S::npos); - test(S("abcde"), "abcde", 6, 0, S::npos); - test(S("abcde"), "abcde", 6, 1, S::npos); - test(S("abcde"), "abcde", 6, 2, S::npos); - test(S("abcde"), "abcde", 6, 4, S::npos); - test(S("abcde"), "abcde", 6, 5, S::npos); - test(S("abcde"), "abcdeabcde", 6, 0, S::npos); - test(S("abcde"), "abcdeabcde", 6, 1, S::npos); - test(S("abcde"), "abcdeabcde", 6, 5, S::npos); - test(S("abcde"), "abcdeabcde", 6, 9, S::npos); - test(S("abcde"), "abcdeabcde", 6, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 0, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 20, S::npos); - test(S("abcdeabcde"), "", 0, 0, 0); - test(S("abcdeabcde"), "abcde", 0, 0, 0); - test(S("abcdeabcde"), "abcde", 0, 1, 0); - test(S("abcdeabcde"), "abcde", 0, 2, 0); - test(S("abcdeabcde"), "abcde", 0, 4, 0); - test(S("abcdeabcde"), "abcde", 0, 5, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 0, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 1, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 5, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos); - test(S("abcdeabcde"), "", 1, 0, 1); - test(S("abcdeabcde"), "abcde", 1, 0, 1); - test(S("abcdeabcde"), "abcde", 1, 1, 5); - test(S("abcdeabcde"), "abcde", 1, 2, 5); - test(S("abcdeabcde"), "abcde", 1, 4, 5); - test(S("abcdeabcde"), "abcde", 1, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 1, 0, 1); - test(S("abcdeabcde"), "abcdeabcde", 1, 1, 5); - test(S("abcdeabcde"), "abcdeabcde", 1, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 1, 9, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 1, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcdeabcde"), "", 5, 0, 5); - test(S("abcdeabcde"), "abcde", 5, 0, 5); - test(S("abcdeabcde"), "abcde", 5, 1, 5); - test(S("abcdeabcde"), "abcde", 5, 2, 5); - test(S("abcdeabcde"), "abcde", 5, 4, 5); - test(S("abcdeabcde"), "abcde", 5, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 0, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 1, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 9, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 5, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 0, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 1, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos); - test(S("abcdeabcde"), "", 9, 0, 9); - test(S("abcdeabcde"), "abcde", 9, 0, 9); - test(S("abcdeabcde"), "abcde", 9, 1, S::npos); - test(S("abcdeabcde"), "abcde", 9, 2, S::npos); - test(S("abcdeabcde"), "abcde", 9, 4, S::npos); - test(S("abcdeabcde"), "abcde", 9, 5, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 9, 0, 9); - test(S("abcdeabcde"), "abcdeabcde", 9, 1, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 9, 5, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 9, 9, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 9, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 0, 9); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 1, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 20, S::npos); - test(S("abcdeabcde"), "", 10, 0, 10); - test(S("abcdeabcde"), "abcde", 10, 0, 10); - test(S("abcdeabcde"), "abcde", 10, 1, S::npos); - test(S("abcdeabcde"), "abcde", 10, 2, S::npos); - test(S("abcdeabcde"), "abcde", 10, 4, S::npos); - test(S("abcdeabcde"), "abcde", 10, 5, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 10, 0, 10); - test(S("abcdeabcde"), "abcdeabcde", 10, 1, S::npos); -} - -template -void test2() -{ - test(S("abcdeabcde"), "abcdeabcde", 10, 5, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 10, 9, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 10, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, S::npos); - test(S("abcdeabcde"), "", 11, 0, S::npos); - test(S("abcdeabcde"), "abcde", 11, 0, S::npos); - test(S("abcdeabcde"), "abcde", 11, 1, S::npos); - test(S("abcdeabcde"), "abcde", 11, 2, S::npos); - test(S("abcdeabcde"), "abcde", 11, 4, S::npos); - test(S("abcdeabcde"), "abcde", 11, 5, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 11, 0, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 11, 1, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 11, 5, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 11, 9, S::npos); - test(S("abcdeabcde"), "abcdeabcde", 11, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 0, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 1, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 10, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 2, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 4, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 5, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 5, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 9, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 10, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 1, 5); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 2, 5); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 4, 5); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 1, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 9, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 10, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, 5); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 1, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 2, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 4, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 5, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 1, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 5, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 9, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 2, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 4, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 5, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 5, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 9, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 20, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 2, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 4, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 5, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 5, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 9, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20); -} - -template -void test3() -{ - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 21, 0, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 0, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 2, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 4, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 5, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 0, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 5, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 9, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, S::npos); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - test2(); - test3(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find( "", 0, 0 ) == 0, "" ); - static_assert (sv1.find( "abcde", 0, 0 ) == 0, "" ); - static_assert (sv1.find( "abcde", 0, 1 ) == SV::npos, "" ); - static_assert (sv2.find( "", 0, 0 ) == 0, "" ); - static_assert (sv2.find( "abcde", 0, 0 ) == 0, "" ); - static_assert (sv2.find( "abcde", 0, 1 ) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp deleted file mode 100644 index f25efdd02..000000000 --- a/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp +++ /dev/null @@ -1,165 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type find(const basic_string_view& str, size_type pos = 0) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) -{ - assert(s.find(str, pos) == x); - if (x != S::npos) - assert(pos <= x && x + str.size() <= s.size()); -} - -template -void -test(const S& s, const S& str, typename S::size_type x) -{ - assert(s.find(str) == x); - if (x != S::npos) - assert(0 <= x && x + str.size() <= s.size()); -} - -template -void test0() -{ - test(S(""), S(""), 0, 0); - test(S(""), S("abcde"), 0, S::npos); - test(S(""), S("abcdeabcde"), 0, S::npos); - test(S(""), S("abcdeabcdeabcdeabcde"), 0, S::npos); - test(S(""), S(""), 1, S::npos); - test(S(""), S("abcde"), 1, S::npos); - test(S(""), S("abcdeabcde"), 1, S::npos); - test(S(""), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcde"), S(""), 0, 0); - test(S("abcde"), S("abcde"), 0, 0); - test(S("abcde"), S("abcdeabcde"), 0, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos); - test(S("abcde"), S(""), 1, 1); - test(S("abcde"), S("abcde"), 1, S::npos); - test(S("abcde"), S("abcdeabcde"), 1, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcde"), S(""), 2, 2); - test(S("abcde"), S("abcde"), 2, S::npos); - test(S("abcde"), S("abcdeabcde"), 2, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 2, S::npos); - test(S("abcde"), S(""), 4, 4); - test(S("abcde"), S("abcde"), 4, S::npos); - test(S("abcde"), S("abcdeabcde"), 4, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 4, S::npos); - test(S("abcde"), S(""), 5, 5); - test(S("abcde"), S("abcde"), 5, S::npos); - test(S("abcde"), S("abcdeabcde"), 5, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos); - test(S("abcde"), S(""), 6, S::npos); - test(S("abcde"), S("abcde"), 6, S::npos); - test(S("abcde"), S("abcdeabcde"), 6, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 6, S::npos); - test(S("abcdeabcde"), S(""), 0, 0); - test(S("abcdeabcde"), S("abcde"), 0, 0); - test(S("abcdeabcde"), S("abcdeabcde"), 0, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos); - test(S("abcdeabcde"), S(""), 1, 1); - test(S("abcdeabcde"), S("abcde"), 1, 5); - test(S("abcdeabcde"), S("abcdeabcde"), 1, S::npos); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcdeabcde"), S(""), 5, 5); - test(S("abcdeabcde"), S("abcde"), 5, 5); - test(S("abcdeabcde"), S("abcdeabcde"), 5, S::npos); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos); - test(S("abcdeabcde"), S(""), 9, 9); - test(S("abcdeabcde"), S("abcde"), 9, S::npos); - test(S("abcdeabcde"), S("abcdeabcde"), 9, S::npos); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 9, S::npos); - test(S("abcdeabcde"), S(""), 10, 10); - test(S("abcdeabcde"), S("abcde"), 10, S::npos); - test(S("abcdeabcde"), S("abcdeabcde"), 10, S::npos); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, S::npos); - test(S("abcdeabcde"), S(""), 11, S::npos); - test(S("abcdeabcde"), S("abcde"), 11, S::npos); - test(S("abcdeabcde"), S("abcdeabcde"), 11, S::npos); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 11, S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S(""), 1, 1); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 1, 5); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 1, 5); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 10, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 10, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 10, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 19, 19); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 19, S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 20, 20); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 21, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 21, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 21, S::npos); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, S::npos); -} - -template -void test1() -{ - test(S(""), S(""), 0); - test(S(""), S("abcde"), S::npos); - test(S(""), S("abcdeabcde"), S::npos); - test(S(""), S("abcdeabcdeabcdeabcde"), S::npos); - test(S("abcde"), S(""), 0); - test(S("abcde"), S("abcde"), 0); - test(S("abcde"), S("abcdeabcde"), S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), S::npos); - test(S("abcdeabcde"), S(""), 0); - test(S("abcdeabcde"), S("abcde"), 0); - test(S("abcdeabcde"), S("abcdeabcde"), 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 0); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.find(sv1) == 0, "" ); - static_assert (sv1.find(sv2) == SV::npos, "" ); - static_assert (sv2.find(sv1) == 0, "" ); - static_assert (sv2.find(sv2) == 0, "" ); - static_assert (sv2.find(sv2, 1 ) == SV::npos, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp deleted file mode 100644 index f07071101..000000000 --- a/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// -// constexpr size_type rfind(charT c, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, typename S::value_type c, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.rfind(c, pos) == x); - if (x != S::npos) - assert(x <= pos && x + 1 <= s.size()); -} - -template -void -test(const S& s, typename S::value_type c, typename S::size_type x) -{ - assert(s.rfind(c) == x); - if (x != S::npos) - assert(x + 1 <= s.size()); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test(S(""), 'b', 0, S::npos); - test(S(""), 'b', 1, S::npos); - test(S("abcde"), 'b', 0, S::npos); - test(S("abcde"), 'b', 1, 1); - test(S("abcde"), 'b', 2, 1); - test(S("abcde"), 'b', 4, 1); - test(S("abcde"), 'b', 5, 1); - test(S("abcde"), 'b', 6, 1); - test(S("abcdeabcde"), 'b', 0, S::npos); - test(S("abcdeabcde"), 'b', 1, 1); - test(S("abcdeabcde"), 'b', 5, 1); - test(S("abcdeabcde"), 'b', 9, 6); - test(S("abcdeabcde"), 'b', 10, 6); - test(S("abcdeabcde"), 'b', 11, 6); - test(S("abcdeabcdeabcdeabcde"), 'b', 0, S::npos); - test(S("abcdeabcdeabcdeabcde"), 'b', 1, 1); - test(S("abcdeabcdeabcdeabcde"), 'b', 10, 6); - test(S("abcdeabcdeabcdeabcde"), 'b', 19, 16); - test(S("abcdeabcdeabcdeabcde"), 'b', 20, 16); - test(S("abcdeabcdeabcdeabcde"), 'b', 21, 16); - - test(S(""), 'b', S::npos); - test(S("abcde"), 'b', 1); - test(S("abcdeabcde"), 'b', 6); - test(S("abcdeabcdeabcdeabcde"), 'b', 16); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.rfind( 'b', 0 ) == SV::npos, "" ); - static_assert (sv1.rfind( 'b', 1 ) == SV::npos, "" ); - static_assert (sv2.rfind( 'b', 0 ) == SV::npos, "" ); - static_assert (sv2.rfind( 'b', 1 ) == 1, "" ); - static_assert (sv2.rfind( 'b', 2 ) == 1, "" ); - static_assert (sv2.rfind( 'b', 3 ) == 1, "" ); - static_assert (sv2.rfind( 'b', 4 ) == 1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp deleted file mode 100644 index 7a8795be0..000000000 --- a/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp +++ /dev/null @@ -1,172 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// -// constexpr size_type rfind(const charT* s, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type x) -{ - assert(s.rfind(str, pos) == x); - if (x != S::npos) - { - typename S::size_type n = S::traits_type::length(str); - assert(x <= pos && x + n <= s.size()); - } -} - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type x) -{ - assert(s.rfind(str) == x); - if (x != S::npos) - { - typename S::size_type pos = s.size(); - typename S::size_type n = S::traits_type::length(str); - assert(x <= pos && x + n <= s.size()); - } -} - -template -void test0() -{ - test(S(""), "", 0, 0); - test(S(""), "abcde", 0, S::npos); - test(S(""), "abcdeabcde", 0, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, S::npos); - test(S(""), "", 1, 0); - test(S(""), "abcde", 1, S::npos); - test(S(""), "abcdeabcde", 1, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcde"), "", 0, 0); - test(S("abcde"), "abcde", 0, 0); - test(S("abcde"), "abcdeabcde", 0, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, S::npos); - test(S("abcde"), "", 1, 1); - test(S("abcde"), "abcde", 1, 0); - test(S("abcde"), "abcdeabcde", 1, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcde"), "", 2, 2); - test(S("abcde"), "abcde", 2, 0); - test(S("abcde"), "abcdeabcde", 2, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, S::npos); - test(S("abcde"), "", 4, 4); - test(S("abcde"), "abcde", 4, 0); - test(S("abcde"), "abcdeabcde", 4, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, S::npos); - test(S("abcde"), "", 5, 5); - test(S("abcde"), "abcde", 5, 0); - test(S("abcde"), "abcdeabcde", 5, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, S::npos); - test(S("abcde"), "", 6, 5); - test(S("abcde"), "abcde", 6, 0); - test(S("abcde"), "abcdeabcde", 6, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, S::npos); - test(S("abcdeabcde"), "", 0, 0); - test(S("abcdeabcde"), "abcde", 0, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, S::npos); - test(S("abcdeabcde"), "", 1, 1); - test(S("abcdeabcde"), "abcde", 1, 0); - test(S("abcdeabcde"), "abcdeabcde", 1, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos); - test(S("abcdeabcde"), "", 5, 5); - test(S("abcdeabcde"), "abcde", 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, S::npos); - test(S("abcdeabcde"), "", 9, 9); - test(S("abcdeabcde"), "abcde", 9, 5); - test(S("abcdeabcde"), "abcdeabcde", 9, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, S::npos); - test(S("abcdeabcde"), "", 10, 10); - test(S("abcdeabcde"), "abcde", 10, 5); - test(S("abcdeabcde"), "abcdeabcde", 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos); - test(S("abcdeabcde"), "", 11, 10); - test(S("abcdeabcde"), "abcde", 11, 5); - test(S("abcdeabcde"), "abcdeabcde", 11, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0); - test(S("abcdeabcdeabcdeabcde"), "", 1, 1); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0); - test(S("abcdeabcdeabcdeabcde"), "", 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0); - test(S("abcdeabcdeabcdeabcde"), "", 19, 19); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 0); - test(S("abcdeabcdeabcdeabcde"), "", 20, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 21, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0); -} - -template -void test1() -{ - test(S(""), "", 0); - test(S(""), "abcde", S::npos); - test(S(""), "abcdeabcde", S::npos); - test(S(""), "abcdeabcdeabcdeabcde", S::npos); - test(S("abcde"), "", 5); - test(S("abcde"), "abcde", 0); - test(S("abcde"), "abcdeabcde", S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", S::npos); - test(S("abcdeabcde"), "", 10); - test(S("abcdeabcde"), "abcde", 5); - test(S("abcdeabcde"), "abcdeabcde", 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.rfind( "") == 0, "" ); - static_assert (sv1.rfind( "abcde") == SV::npos, "" ); - static_assert (sv2.rfind( "") == 5, "" ); - static_assert (sv2.rfind( "abcde") == 0, "" ); - static_assert (sv2.rfind( "abcde", 1) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp deleted file mode 100644 index 2755d2c56..000000000 --- a/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// -// constexpr size_type rfind(const charT* s, size_type pos, size_type n) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const typename S::value_type* str, typename S::size_type pos, - typename S::size_type n, typename S::size_type x) -{ - assert(s.rfind(str, pos, n) == x); - if (x != S::npos) - assert(x <= pos && x + n <= s.size()); -} - -template -void test0() -{ - test(S(""), "", 0, 0, 0); - test(S(""), "abcde", 0, 0, 0); - test(S(""), "abcde", 0, 1, S::npos); - test(S(""), "abcde", 0, 2, S::npos); - test(S(""), "abcde", 0, 4, S::npos); - test(S(""), "abcde", 0, 5, S::npos); - test(S(""), "abcdeabcde", 0, 0, 0); - test(S(""), "abcdeabcde", 0, 1, S::npos); - test(S(""), "abcdeabcde", 0, 5, S::npos); - test(S(""), "abcdeabcde", 0, 9, S::npos); - test(S(""), "abcdeabcde", 0, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S(""), "abcdeabcdeabcdeabcde", 0, 1, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 19, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 0, 20, S::npos); - test(S(""), "", 1, 0, 0); - test(S(""), "abcde", 1, 0, 0); - test(S(""), "abcde", 1, 1, S::npos); - test(S(""), "abcde", 1, 2, S::npos); - test(S(""), "abcde", 1, 4, S::npos); - test(S(""), "abcde", 1, 5, S::npos); - test(S(""), "abcdeabcde", 1, 0, 0); - test(S(""), "abcdeabcde", 1, 1, S::npos); - test(S(""), "abcdeabcde", 1, 5, S::npos); - test(S(""), "abcdeabcde", 1, 9, S::npos); - test(S(""), "abcdeabcde", 1, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 0, 0); - test(S(""), "abcdeabcdeabcdeabcde", 1, 1, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 10, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S(""), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcde"), "", 0, 0, 0); - test(S("abcde"), "abcde", 0, 0, 0); - test(S("abcde"), "abcde", 0, 1, 0); - test(S("abcde"), "abcde", 0, 2, 0); - test(S("abcde"), "abcde", 0, 4, 0); - test(S("abcde"), "abcde", 0, 5, 0); - test(S("abcde"), "abcdeabcde", 0, 0, 0); - test(S("abcde"), "abcdeabcde", 0, 1, 0); - test(S("abcde"), "abcdeabcde", 0, 5, 0); - test(S("abcde"), "abcdeabcde", 0, 9, S::npos); - test(S("abcde"), "abcdeabcde", 0, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos); - test(S("abcde"), "", 1, 0, 1); - test(S("abcde"), "abcde", 1, 0, 1); - test(S("abcde"), "abcde", 1, 1, 0); - test(S("abcde"), "abcde", 1, 2, 0); - test(S("abcde"), "abcde", 1, 4, 0); - test(S("abcde"), "abcde", 1, 5, 0); - test(S("abcde"), "abcdeabcde", 1, 0, 1); - test(S("abcde"), "abcdeabcde", 1, 1, 0); - test(S("abcde"), "abcdeabcde", 1, 5, 0); - test(S("abcde"), "abcdeabcde", 1, 9, S::npos); - test(S("abcde"), "abcdeabcde", 1, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 0, 1); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcde"), "", 2, 0, 2); - test(S("abcde"), "abcde", 2, 0, 2); - test(S("abcde"), "abcde", 2, 1, 0); - test(S("abcde"), "abcde", 2, 2, 0); - test(S("abcde"), "abcde", 2, 4, 0); - test(S("abcde"), "abcde", 2, 5, 0); - test(S("abcde"), "abcdeabcde", 2, 0, 2); - test(S("abcde"), "abcdeabcde", 2, 1, 0); - test(S("abcde"), "abcdeabcde", 2, 5, 0); - test(S("abcde"), "abcdeabcde", 2, 9, S::npos); - test(S("abcde"), "abcdeabcde", 2, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 0, 2); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 20, S::npos); - test(S("abcde"), "", 4, 0, 4); - test(S("abcde"), "abcde", 4, 0, 4); - test(S("abcde"), "abcde", 4, 1, 0); - test(S("abcde"), "abcde", 4, 2, 0); - test(S("abcde"), "abcde", 4, 4, 0); - test(S("abcde"), "abcde", 4, 5, 0); - test(S("abcde"), "abcdeabcde", 4, 0, 4); - test(S("abcde"), "abcdeabcde", 4, 1, 0); - test(S("abcde"), "abcdeabcde", 4, 5, 0); - test(S("abcde"), "abcdeabcde", 4, 9, S::npos); - test(S("abcde"), "abcdeabcde", 4, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 0, 4); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 20, S::npos); - test(S("abcde"), "", 5, 0, 5); - test(S("abcde"), "abcde", 5, 0, 5); - test(S("abcde"), "abcde", 5, 1, 0); - test(S("abcde"), "abcde", 5, 2, 0); -} - -template -void test1() -{ - test(S("abcde"), "abcde", 5, 4, 0); - test(S("abcde"), "abcde", 5, 5, 0); - test(S("abcde"), "abcdeabcde", 5, 0, 5); - test(S("abcde"), "abcdeabcde", 5, 1, 0); - test(S("abcde"), "abcdeabcde", 5, 5, 0); - test(S("abcde"), "abcdeabcde", 5, 9, S::npos); - test(S("abcde"), "abcdeabcde", 5, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 0, 5); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos); - test(S("abcde"), "", 6, 0, 5); - test(S("abcde"), "abcde", 6, 0, 5); - test(S("abcde"), "abcde", 6, 1, 0); - test(S("abcde"), "abcde", 6, 2, 0); - test(S("abcde"), "abcde", 6, 4, 0); - test(S("abcde"), "abcde", 6, 5, 0); - test(S("abcde"), "abcdeabcde", 6, 0, 5); - test(S("abcde"), "abcdeabcde", 6, 1, 0); - test(S("abcde"), "abcdeabcde", 6, 5, 0); - test(S("abcde"), "abcdeabcde", 6, 9, S::npos); - test(S("abcde"), "abcdeabcde", 6, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 0, 5); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 1, 0); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 10, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 19, S::npos); - test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 20, S::npos); - test(S("abcdeabcde"), "", 0, 0, 0); - test(S("abcdeabcde"), "abcde", 0, 0, 0); - test(S("abcdeabcde"), "abcde", 0, 1, 0); - test(S("abcdeabcde"), "abcde", 0, 2, 0); - test(S("abcdeabcde"), "abcde", 0, 4, 0); - test(S("abcdeabcde"), "abcde", 0, 5, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 0, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 1, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 5, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 0, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos); - test(S("abcdeabcde"), "", 1, 0, 1); - test(S("abcdeabcde"), "abcde", 1, 0, 1); - test(S("abcdeabcde"), "abcde", 1, 1, 0); - test(S("abcdeabcde"), "abcde", 1, 2, 0); - test(S("abcdeabcde"), "abcde", 1, 4, 0); - test(S("abcdeabcde"), "abcde", 1, 5, 0); - test(S("abcdeabcde"), "abcdeabcde", 1, 0, 1); - test(S("abcdeabcde"), "abcdeabcde", 1, 1, 0); - test(S("abcdeabcde"), "abcdeabcde", 1, 5, 0); - test(S("abcdeabcde"), "abcdeabcde", 1, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 1, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos); - test(S("abcdeabcde"), "", 5, 0, 5); - test(S("abcdeabcde"), "abcde", 5, 0, 5); - test(S("abcdeabcde"), "abcde", 5, 1, 5); - test(S("abcdeabcde"), "abcde", 5, 2, 5); - test(S("abcdeabcde"), "abcde", 5, 4, 5); - test(S("abcdeabcde"), "abcde", 5, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 0, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 1, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 5, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 5, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 0, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 1, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos); - test(S("abcdeabcde"), "", 9, 0, 9); - test(S("abcdeabcde"), "abcde", 9, 0, 9); - test(S("abcdeabcde"), "abcde", 9, 1, 5); - test(S("abcdeabcde"), "abcde", 9, 2, 5); - test(S("abcdeabcde"), "abcde", 9, 4, 5); - test(S("abcdeabcde"), "abcde", 9, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 9, 0, 9); - test(S("abcdeabcde"), "abcdeabcde", 9, 1, 5); - test(S("abcdeabcde"), "abcdeabcde", 9, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 9, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 9, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 0, 9); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 1, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 20, S::npos); - test(S("abcdeabcde"), "", 10, 0, 10); - test(S("abcdeabcde"), "abcde", 10, 0, 10); - test(S("abcdeabcde"), "abcde", 10, 1, 5); - test(S("abcdeabcde"), "abcde", 10, 2, 5); - test(S("abcdeabcde"), "abcde", 10, 4, 5); - test(S("abcdeabcde"), "abcde", 10, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 10, 0, 10); - test(S("abcdeabcde"), "abcdeabcde", 10, 1, 5); -} - -template -void test2() -{ - test(S("abcdeabcde"), "abcdeabcde", 10, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 10, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 10, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, S::npos); - test(S("abcdeabcde"), "", 11, 0, 10); - test(S("abcdeabcde"), "abcde", 11, 0, 10); - test(S("abcdeabcde"), "abcde", 11, 1, 5); - test(S("abcdeabcde"), "abcde", 11, 2, 5); - test(S("abcdeabcde"), "abcde", 11, 4, 5); - test(S("abcdeabcde"), "abcde", 11, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 11, 0, 10); - test(S("abcdeabcde"), "abcdeabcde", 11, 1, 5); - test(S("abcdeabcde"), "abcdeabcde", 11, 5, 5); - test(S("abcdeabcde"), "abcdeabcde", 11, 9, 0); - test(S("abcdeabcde"), "abcdeabcde", 11, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 0, 10); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 1, 5); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 10, 0); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 19, S::npos); - test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 20, S::npos); - test(S("abcdeabcdeabcdeabcde"), "", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 2, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 4, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 5, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 5, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 9, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 10, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 2, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 4, 0); - test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 9, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 10, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 1, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 2, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 4, 10); - test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 5, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 1, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 5, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 9, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 2, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 4, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 5, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 5, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 9, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 0, 19); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 20, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 2, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 4, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 5, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 5, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 9, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20); -} - -template -void test3() -{ - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 20, 0); - test(S("abcdeabcdeabcdeabcde"), "", 21, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 2, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 4, 15); - test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 5, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 5, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 9, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0, 20); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 1, 15); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 10, 10); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 19, 0); - test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - test2(); - test3(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.rfind( "", 0, 0 ) == 0, "" ); - static_assert (sv1.rfind( "abcde", 0, 0 ) == 0, "" ); - static_assert (sv1.rfind( "abcde", 0, 1 ) == SV::npos, "" ); - static_assert (sv2.rfind( "", 0, 0 ) == 0, "" ); - static_assert (sv2.rfind( "abcde", 0, 0 ) == 0, "" ); - static_assert (sv2.rfind( "abcde", 0, 1 ) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp deleted file mode 100644 index e77d668d7..000000000 --- a/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp +++ /dev/null @@ -1,165 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr size_type rfind(const basic_string& str, size_type pos = npos) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template -void -test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) -{ - assert(s.rfind(str, pos) == x); - if (x != S::npos) - assert(x <= pos && x + str.size() <= s.size()); -} - -template -void -test(const S& s, const S& str, typename S::size_type x) -{ - assert(s.rfind(str) == x); - if (x != S::npos) - assert(0 <= x && x + str.size() <= s.size()); -} - -template -void test0() -{ - test(S(""), S(""), 0, 0); - test(S(""), S("abcde"), 0, S::npos); - test(S(""), S("abcdeabcde"), 0, S::npos); - test(S(""), S("abcdeabcdeabcdeabcde"), 0, S::npos); - test(S(""), S(""), 1, 0); - test(S(""), S("abcde"), 1, S::npos); - test(S(""), S("abcdeabcde"), 1, S::npos); - test(S(""), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcde"), S(""), 0, 0); - test(S("abcde"), S("abcde"), 0, 0); - test(S("abcde"), S("abcdeabcde"), 0, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos); - test(S("abcde"), S(""), 1, 1); - test(S("abcde"), S("abcde"), 1, 0); - test(S("abcde"), S("abcdeabcde"), 1, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcde"), S(""), 2, 2); - test(S("abcde"), S("abcde"), 2, 0); - test(S("abcde"), S("abcdeabcde"), 2, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 2, S::npos); - test(S("abcde"), S(""), 4, 4); - test(S("abcde"), S("abcde"), 4, 0); - test(S("abcde"), S("abcdeabcde"), 4, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 4, S::npos); - test(S("abcde"), S(""), 5, 5); - test(S("abcde"), S("abcde"), 5, 0); - test(S("abcde"), S("abcdeabcde"), 5, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos); - test(S("abcde"), S(""), 6, 5); - test(S("abcde"), S("abcde"), 6, 0); - test(S("abcde"), S("abcdeabcde"), 6, S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), 6, S::npos); - test(S("abcdeabcde"), S(""), 0, 0); - test(S("abcdeabcde"), S("abcde"), 0, 0); - test(S("abcdeabcde"), S("abcdeabcde"), 0, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos); - test(S("abcdeabcde"), S(""), 1, 1); - test(S("abcdeabcde"), S("abcde"), 1, 0); - test(S("abcdeabcde"), S("abcdeabcde"), 1, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos); - test(S("abcdeabcde"), S(""), 5, 5); - test(S("abcdeabcde"), S("abcde"), 5, 5); - test(S("abcdeabcde"), S("abcdeabcde"), 5, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos); - test(S("abcdeabcde"), S(""), 9, 9); - test(S("abcdeabcde"), S("abcde"), 9, 5); - test(S("abcdeabcde"), S("abcdeabcde"), 9, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 9, S::npos); - test(S("abcdeabcde"), S(""), 10, 10); - test(S("abcdeabcde"), S("abcde"), 10, 5); - test(S("abcdeabcde"), S("abcdeabcde"), 10, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, S::npos); - test(S("abcdeabcde"), S(""), 11, 10); - test(S("abcdeabcde"), S("abcde"), 11, 5); - test(S("abcdeabcde"), S("abcdeabcde"), 11, 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 11, S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, 0); - test(S("abcdeabcdeabcdeabcde"), S(""), 1, 1); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 1, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 1, 0); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, 0); - test(S("abcdeabcdeabcdeabcde"), S(""), 10, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 10, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 10, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, 0); - test(S("abcdeabcdeabcdeabcde"), S(""), 19, 19); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 19, 15); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 19, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 19, 0); - test(S("abcdeabcdeabcdeabcde"), S(""), 20, 20); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 20, 15); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 20, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 20, 0); - test(S("abcdeabcdeabcdeabcde"), S(""), 21, 20); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 21, 15); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 21, 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, 0); -} - -template -void test1() -{ - test(S(""), S(""), 0); - test(S(""), S("abcde"), S::npos); - test(S(""), S("abcdeabcde"), S::npos); - test(S(""), S("abcdeabcdeabcdeabcde"), S::npos); - test(S("abcde"), S(""), 5); - test(S("abcde"), S("abcde"), 0); - test(S("abcde"), S("abcdeabcde"), S::npos); - test(S("abcde"), S("abcdeabcdeabcdeabcde"), S::npos); - test(S("abcdeabcde"), S(""), 10); - test(S("abcdeabcde"), S("abcde"), 5); - test(S("abcdeabcde"), S("abcdeabcde"), 0); - test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), S::npos); - test(S("abcdeabcdeabcdeabcde"), S(""), 20); - test(S("abcdeabcdeabcdeabcde"), S("abcde"), 15); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 10); - test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0); -} - -int main() -{ - { - typedef std::experimental::string_view S; - test0(); - test1(); - } - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - - static_assert (sv1.rfind(sv1) == 0, "" ); - static_assert (sv1.rfind(sv2) == SV::npos, "" ); - static_assert (sv2.rfind(sv1) == 5, "" ); - static_assert (sv2.rfind(sv2) == 0, "" ); - static_assert (sv2.rfind(sv2, 1) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp b/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp deleted file mode 100644 index 6b16971bf..000000000 --- a/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// struct hash -// : public unary_function -// { -// size_t operator()(T val) const; -// }; - -// Not very portable - -#include -#include -#include - -using std::experimental::string_view; - -template -void -test() -{ - typedef std::hash H; - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); - H h; -// std::string g1 = "1234567890"; -// std::string g2 = "1234567891"; - typedef typename T::value_type char_type; - char_type g1 [ 10 ]; - char_type g2 [ 10 ]; - for ( int i = 0; i < 10; ++i ) - g1[i] = g2[9-i] = '0' + i; - T s1(g1, 10); - T s2(g2, 10); - assert(h(s1) != h(s2)); -} - -int main() -{ - test(); -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - test(); - test(); -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - test(); -} diff --git a/test/std/experimental/string.view/string.view.io/stream_insert.pass.cpp b/test/std/experimental/string.view/string.view.io/stream_insert.pass.cpp deleted file mode 100644 index 4f3f962a3..000000000 --- a/test/std/experimental/string.view/string.view.io/stream_insert.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// basic_ostream& -// operator<<(basic_ostream& os, -// const basic_string_view str); - -#include -#include -#include - -using std::experimental::string_view; -using std::experimental::wstring_view; - -int main() -{ - { - std::ostringstream out; - string_view sv("some text"); - out << sv; - assert(out.good()); - assert(sv == out.str()); - } - { - std::ostringstream out; - std::string s("some text"); - string_view sv(s); - out.width(12); - out << sv; - assert(out.good()); - assert(" " + s == out.str()); - } - { - std::wostringstream out; - wstring_view sv(L"some text"); - out << sv; - assert(out.good()); - assert(sv == out.str()); - } - { - std::wostringstream out; - std::wstring s(L"some text"); - wstring_view sv(s); - out.width(12); - out << sv; - assert(out.good()); - assert(L" " + s == out.str()); - } -} diff --git a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp deleted file mode 100644 index 5f28f63f8..000000000 --- a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr const_iterator begin() const; - -#include -#include - -#include "test_macros.h" - -template -void -test(S s) -{ - const S& cs = s; - typename S::iterator b = s.begin(); - typename S::const_iterator cb1 = cs.begin(); - typename S::const_iterator cb2 = s.cbegin(); - if (!s.empty()) - { - assert( *b == s[0]); - assert( &*b == &s[0]); - assert( *cb1 == s[0]); - assert(&*cb1 == &s[0]); - assert( *cb2 == s[0]); - assert(&*cb2 == &s[0]); - - } - assert( b == cb1); - assert( b == cb2); - assert(cb1 == cb2); -} - - -int main() -{ - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test(string_view ()); - test(u16string_view()); - test(u32string_view()); - test(wstring_view ()); - test(string_view ( "123")); - test(wstring_view (L"123")); -#if TEST_STD_VER >= 11 - test(u16string_view{u"123"}); - test(u32string_view{U"123"}); -#endif - -#if TEST_STD_VER > 11 - { - constexpr string_view sv { "123", 3 }; - constexpr u16string_view u16sv {u"123", 3 }; - constexpr u32string_view u32sv {U"123", 3 }; - constexpr wstring_view wsv {L"123", 3 }; - - static_assert ( *sv.begin() == sv[0], "" ); - static_assert ( *u16sv.begin() == u16sv[0], "" ); - static_assert ( *u32sv.begin() == u32sv[0], "" ); - static_assert ( *wsv.begin() == wsv[0], "" ); - - static_assert ( *sv.cbegin() == sv[0], "" ); - static_assert ( *u16sv.cbegin() == u16sv[0], "" ); - static_assert ( *u32sv.cbegin() == u32sv[0], "" ); - static_assert ( *wsv.cbegin() == wsv[0], "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp deleted file mode 100644 index 1f22b3fbe..000000000 --- a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr const_iterator end() const; - -#include -#include -#include - -#include "test_macros.h" - -template -void -test(S s) -{ - const S& cs = s; - typename S::iterator e = s.end(); - typename S::const_iterator ce1 = cs.end(); - typename S::const_iterator ce2 = s.cend(); - - if (s.empty()) - { - assert( e == s.begin()); - assert(ce1 == cs.begin()); - assert(ce2 == s.begin()); - } - else - { - assert( e != s.begin()); - assert(ce1 != cs.begin()); - assert(ce2 != s.begin()); - } - - assert( e - s.begin() == static_cast(s.size())); - assert(ce1 - cs.begin() == static_cast(cs.size())); - assert(ce2 - s.cbegin() == static_cast(s.size())); - - assert( e == ce1); - assert( e == ce2); - assert(ce1 == ce2); -} - - -int main() -{ - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test(string_view ()); - test(u16string_view()); - test(u32string_view()); - test(wstring_view ()); - test(string_view ( "123")); - test(wstring_view (L"123")); -#if TEST_STD_VER >= 11 - test(u16string_view{u"123"}); - test(u32string_view{U"123"}); -#endif - -#if TEST_STD_VER > 11 - { - constexpr string_view sv { "123", 3 }; - constexpr u16string_view u16sv {u"123", 3 }; - constexpr u32string_view u32sv {U"123", 3 }; - constexpr wstring_view wsv {L"123", 3 }; - - static_assert ( sv.begin() != sv.end(), "" ); - static_assert ( u16sv.begin() != u16sv.end(), "" ); - static_assert ( u32sv.begin() != u32sv.end(), "" ); - static_assert ( wsv.begin() != wsv.end(), "" ); - - static_assert ( sv.begin() != sv.cend(), "" ); - static_assert ( u16sv.begin() != u16sv.cend(), "" ); - static_assert ( u32sv.begin() != u32sv.cend(), "" ); - static_assert ( wsv.begin() != wsv.cend(), "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp b/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp deleted file mode 100644 index 068557e39..000000000 --- a/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// const_iterator rbegin() const; - -#include -#include - -#include "test_macros.h" - -template -void -test(S s) -{ - const S& cs = s; - typename S::reverse_iterator b = s.rbegin(); - typename S::const_reverse_iterator cb1 = cs.rbegin(); - typename S::const_reverse_iterator cb2 = s.crbegin(); - if (!s.empty()) - { - const size_t last = s.size() - 1; - assert( *b == s[last]); - assert( &*b == &s[last]); - assert( *cb1 == s[last]); - assert(&*cb1 == &s[last]); - assert( *cb2 == s[last]); - assert(&*cb2 == &s[last]); - - } - assert( b == cb1); - assert( b == cb2); - assert(cb1 == cb2); -} - - -int main() -{ - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test(string_view ()); - test(u16string_view()); - test(u32string_view()); - test(wstring_view ()); - test(string_view ( "123")); - test(wstring_view (L"123")); -#if TEST_STD_VER >= 11 - test(u16string_view{u"123"}); - test(u32string_view{U"123"}); -#endif -} diff --git a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp deleted file mode 100644 index bd24c327e..000000000 --- a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr const_iterator rend() const; - -#include -#include -#include - -#include "test_macros.h" - -template -void -test(S s) -{ - const S& cs = s; - typename S::reverse_iterator e = s.rend(); - typename S::const_reverse_iterator ce1 = cs.rend(); - typename S::const_reverse_iterator ce2 = s.crend(); - - if (s.empty()) - { - assert( e == s.rbegin()); - assert(ce1 == cs.rbegin()); - assert(ce2 == s.rbegin()); - } - else - { - assert( e != s.rbegin()); - assert(ce1 != cs.rbegin()); - assert(ce2 != s.rbegin()); - } - - assert( e - s.rbegin() == static_cast(s.size())); - assert(ce1 - cs.rbegin() == static_cast(cs.size())); - assert(ce2 - s.crbegin() == static_cast(s.size())); - - assert( e == ce1); - assert( e == ce2); - assert(ce1 == ce2); -} - - -int main() -{ - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test(string_view ()); - test(u16string_view()); - test(u32string_view()); - test(wstring_view ()); - test(string_view ( "123")); - test(wstring_view (L"123")); -#if TEST_STD_VER >= 11 - test(u16string_view{u"123"}); - test(u32string_view{U"123"}); -#endif -} diff --git a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp deleted file mode 100644 index 00b0661d8..000000000 --- a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// void clear() noexcept - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - typedef std::experimental::basic_string_view SV; - { - SV sv1 ( s ); - assert ( sv1.size() == len ); - assert ( sv1.data() == s ); - - sv1.clear (); - assert ( sv1.data() == nullptr ); - assert ( sv1.size() == 0 ); - assert ( sv1 == SV()); - } -} - -#if TEST_STD_VER > 11 -constexpr size_t test_ce ( size_t n ) { - typedef std::experimental::basic_string_view SV; - SV sv1{ "ABCDEFGHIJKL", n }; - sv1.clear(); - return sv1.size(); -} -#endif - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - test ( "", 0 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - test ( L"", 0 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - test ( u"", 0 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); - test ( U"", 0 ); -#endif - -#if TEST_STD_VER > 11 - static_assert ( test_ce (5) == 0, "" ); -#endif - -} diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp deleted file mode 100644 index 03484a0b5..000000000 --- a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// void remove_prefix(size_type _n) - -#include -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - typedef std::experimental::basic_string_view SV; - { - SV sv1 ( s ); - assert ( sv1.size() == len ); - assert ( sv1.data() == s ); - - if ( len > 0 ) { - sv1.remove_prefix ( 1 ); - assert ( sv1.size() == (len - 1)); - assert ( sv1.data() == (s + 1)); - sv1.remove_prefix ( len - 1 ); - } - - assert ( sv1.size() == 0 ); - sv1.remove_prefix ( 0 ); - assert ( sv1.size() == 0 ); - } -} - -#if TEST_STD_VER > 11 -constexpr size_t test_ce ( size_t n, size_t k ) { - typedef std::experimental::basic_string_view SV; - SV sv1{ "ABCDEFGHIJKL", n }; - sv1.remove_prefix ( k ); - return sv1.size(); -} -#endif - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - test ( "", 0 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - test ( L"", 0 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - test ( u"", 0 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); - test ( U"", 0 ); -#endif - -#if TEST_STD_VER > 11 - { - static_assert ( test_ce ( 5, 0 ) == 5, "" ); - static_assert ( test_ce ( 5, 1 ) == 4, "" ); - static_assert ( test_ce ( 5, 5 ) == 0, "" ); - static_assert ( test_ce ( 9, 3 ) == 6, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp deleted file mode 100644 index 6b632d0ef..000000000 --- a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// void remove_suffix(size_type _n) - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - typedef std::experimental::basic_string_view SV; - { - SV sv1 ( s ); - assert ( sv1.size() == len ); - assert ( sv1.data() == s ); - - if ( len > 0 ) { - sv1.remove_suffix ( 1 ); - assert ( sv1.size() == (len - 1)); - assert ( sv1.data() == s); - sv1.remove_suffix ( len - 1 ); - } - - assert ( sv1.size() == 0 ); - sv1.remove_suffix ( 0 ); - assert ( sv1.size() == 0 ); - } - -} - -#if TEST_STD_VER > 11 -constexpr size_t test_ce ( size_t n, size_t k ) { - typedef std::experimental::basic_string_view SV; - SV sv1{ "ABCDEFGHIJKL", n }; - sv1.remove_suffix ( k ); - return sv1.size(); -} -#endif - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - test ( "", 0 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - test ( L"", 0 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - test ( u"", 0 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); - test ( U"", 0 ); -#endif - -#if TEST_STD_VER > 11 - { - static_assert ( test_ce ( 5, 0 ) == 5, "" ); - static_assert ( test_ce ( 5, 1 ) == 4, "" ); - static_assert ( test_ce ( 5, 5 ) == 0, "" ); - static_assert ( test_ce ( 9, 3 ) == 6, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp deleted file mode 100644 index 2912fd8b9..000000000 --- a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// void swap(basic_string_view& _other) noexcept - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - typedef std::experimental::basic_string_view SV; - { - SV sv1(s); - SV sv2; - - assert ( sv1.size() == len ); - assert ( sv1.data() == s ); - assert ( sv2.size() == 0 ); - - sv1.swap ( sv2 ); - assert ( sv1.size() == 0 ); - assert ( sv2.size() == len ); - assert ( sv2.data() == s ); - } - -} - -#if TEST_STD_VER > 11 -constexpr size_t test_ce ( size_t n, size_t k ) { - typedef std::experimental::basic_string_view SV; - SV sv1{ "ABCDEFGHIJKL", n }; - SV sv2 { sv1.data(), k }; - sv1.swap ( sv2 ); - return sv1.size(); -} -#endif - - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - test ( "", 0 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - test ( L"", 0 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - test ( u"", 0 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); - test ( U"", 0 ); -#endif - -#if TEST_STD_VER > 11 - { - static_assert ( test_ce (2, 3) == 3, "" ); - static_assert ( test_ce (5, 3) == 3, "" ); - static_assert ( test_ce (0, 1) == 1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp deleted file mode 100644 index 202e9ced4..000000000 --- a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp +++ /dev/null @@ -1,214 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// quoted - -#include -#include -#include -#include - -#include "test_macros.h" - -#if TEST_STD_VER > 11 -// quoted is C++14 only - -bool is_skipws ( const std::istream *is ) { - return ( is->flags() & std::ios_base::skipws ) != 0; - } - - -bool is_skipws ( const std::wistream *is ) { - return ( is->flags() & std::ios_base::skipws ) != 0; - } - -void round_trip ( const char *p ) { - std::stringstream ss; - bool skippingws = is_skipws ( &ss ); - std::experimental::string_view sv {p}; - - ss << std::quoted(sv); - std::string s; - ss >> std::quoted(s); - assert ( s == sv ); - assert ( skippingws == is_skipws ( &ss )); - } - -void round_trip_ws ( const char *p ) { - std::stringstream ss; - std::noskipws ( ss ); - bool skippingws = is_skipws ( &ss ); - std::experimental::string_view sv {p}; - - ss << std::quoted(sv); - std::string s; - ss >> std::quoted(s); - assert ( s == sv ); - assert ( skippingws == is_skipws ( &ss )); - } - -void round_trip_d ( const char *p, char delim ) { - std::stringstream ss; - std::experimental::string_view sv {p}; - - ss << std::quoted(sv, delim); - std::string s; - ss >> std::quoted(s, delim); - assert ( s == sv ); - } - -void round_trip_e ( const char *p, char escape ) { - std::stringstream ss; - std::experimental::string_view sv {p}; - - ss << std::quoted(sv, '"', escape ); - std::string s; - ss >> std::quoted(s, '"', escape ); - assert ( s == sv ); - } - - - -std::string quote ( const char *p, char delim='"', char escape='\\' ) { - std::stringstream ss; - ss << std::quoted(p, delim, escape); - std::string s; - ss >> s; // no quote - return s; -} - -std::string unquote ( const char *p, char delim='"', char escape='\\' ) { - std::stringstream ss; - ss << p; - std::string s; - ss >> std::quoted(s, delim, escape); - return s; -} - - -void round_trip ( const wchar_t *p ) { - std::wstringstream ss; - bool skippingws = is_skipws ( &ss ); - std::experimental::wstring_view sv {p}; - - ss << std::quoted(sv); - std::wstring s; - ss >> std::quoted(s); - assert ( s == sv ); - assert ( skippingws == is_skipws ( &ss )); - } - - -void round_trip_ws ( const wchar_t *p ) { - std::wstringstream ss; - std::noskipws ( ss ); - bool skippingws = is_skipws ( &ss ); - std::experimental::wstring_view sv {p}; - - ss << std::quoted(sv); - std::wstring s; - ss >> std::quoted(s); - assert ( s == sv ); - assert ( skippingws == is_skipws ( &ss )); - } - -void round_trip_d ( const wchar_t *p, wchar_t delim ) { - std::wstringstream ss; - std::experimental::wstring_view sv {p}; - - ss << std::quoted(sv, delim); - std::wstring s; - ss >> std::quoted(s, delim); - assert ( s == sv ); - } - -void round_trip_e ( const wchar_t *p, wchar_t escape ) { - std::wstringstream ss; - std::experimental::wstring_view sv {p}; - - ss << std::quoted(sv, wchar_t('"'), escape ); - std::wstring s; - ss >> std::quoted(s, wchar_t('"'), escape ); - assert ( s == sv ); - } - - -std::wstring quote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) { - std::wstringstream ss; - std::experimental::wstring_view sv {p}; - - ss << std::quoted(sv, delim, escape); - std::wstring s; - ss >> s; // no quote - return s; -} - -std::wstring unquote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) { - std::wstringstream ss; - std::experimental::wstring_view sv {p}; - - ss << sv; - std::wstring s; - ss >> std::quoted(s, delim, escape); - return s; -} - -int main() -{ - round_trip ( "" ); - round_trip_ws ( "" ); - round_trip_d ( "", 'q' ); - round_trip_e ( "", 'q' ); - - round_trip ( L"" ); - round_trip_ws ( L"" ); - round_trip_d ( L"", 'q' ); - round_trip_e ( L"", 'q' ); - - round_trip ( "Hi" ); - round_trip_ws ( "Hi" ); - round_trip_d ( "Hi", '!' ); - round_trip_e ( "Hi", '!' ); - assert ( quote ( "Hi", '!' ) == "!Hi!" ); - assert ( quote ( "Hi!", '!' ) == R"(!Hi\!!)" ); - - round_trip ( L"Hi" ); - round_trip_ws ( L"Hi" ); - round_trip_d ( L"Hi", '!' ); - round_trip_e ( L"Hi", '!' ); - assert ( quote ( L"Hi", '!' ) == L"!Hi!" ); - assert ( quote ( L"Hi!", '!' ) == LR"(!Hi\!!)" ); - - round_trip ( "Hi Mom" ); - round_trip_ws ( "Hi Mom" ); - round_trip ( L"Hi Mom" ); - round_trip_ws ( L"Hi Mom" ); - - assert ( quote ( "" ) == "\"\"" ); - assert ( quote ( L"" ) == L"\"\"" ); - assert ( quote ( "a" ) == "\"a\"" ); - assert ( quote ( L"a" ) == L"\"a\"" ); - -// missing end quote - must not hang - assert ( unquote ( "\"abc" ) == "abc" ); - assert ( unquote ( L"\"abc" ) == L"abc" ); - - assert ( unquote ( "abc" ) == "abc" ); // no delimiter - assert ( unquote ( L"abc" ) == L"abc" ); // no delimiter - assert ( unquote ( "abc def" ) == "abc" ); // no delimiter - assert ( unquote ( L"abc def" ) == L"abc" ); // no delimiter - - assert ( unquote ( "" ) == "" ); // nothing there - assert ( unquote ( L"" ) == L"" ); // nothing there - } -#else -int main() {} -#endif diff --git a/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp b/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp deleted file mode 100644 index a29bb15f5..000000000 --- a/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// template -// explicit operator basic_string<_CharT, _Traits, _Allocator>() const - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s ) { - typedef std::experimental::basic_string_view string_view_t; - typedef std::basic_string string_t; - - { - string_view_t sv1 ( s ); - string_t str = (string_t) sv1; - - assert ( sv1.size() == str.size ()); - assert ( std::char_traits::compare ( sv1.data(), str.data(), sv1.size()) == 0 ); - } - - { - string_view_t sv1; - string_t str = (string_t) sv1; - - assert ( sv1.size() == 0); - assert ( sv1.size() == str.size ()); - } -} - -int main () { - test ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( "ABCDE"); - test ( "a" ); - test ( "" ); - - test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( L"ABCDE" ); - test ( L"a" ); - test ( L"" ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( u"ABCDE" ); - test ( u"a" ); - test ( u"" ); - - test ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( U"ABCDE" ); - test ( U"a" ); - test ( U"" ); -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp deleted file mode 100644 index 93014ea11..000000000 --- a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr int compare(const charT* s) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); } - -template -void test1 ( std::experimental::basic_string_view sv1, const CharT *s, int expected ) { - assert ( sign( sv1.compare(s)) == sign(expected)); -} - -template -void -test( const CharT *s1, const CharT *s2, int expected) -{ - typedef std::experimental::basic_string_view string_view_t; - string_view_t sv1 ( s1 ); - test1 ( sv1, s2, expected ); -} - -int main() -{ - { - test("", "", 0); - test("", "abcde", -5); - test("", "abcdefghij", -10); - test("", "abcdefghijklmnopqrst", -20); - test("abcde", "", 5); - test("abcde", "abcde", 0); - test("abcde", "abcdefghij", -5); - test("abcde", "abcdefghijklmnopqrst", -15); - test("abcdefghij", "", 10); - test("abcdefghij", "abcde", 5); - test("abcdefghij", "abcdefghij", 0); - test("abcdefghij", "abcdefghijklmnopqrst", -10); - test("abcdefghijklmnopqrst", "", 20); - test("abcdefghijklmnopqrst", "abcde", 15); - test("abcdefghijklmnopqrst", "abcdefghij", 10); - test("abcdefghijklmnopqrst", "abcdefghijklmnopqrst", 0); - } - - { - test(L"", L"", 0); - test(L"", L"abcde", -5); - test(L"", L"abcdefghij", -10); - test(L"", L"abcdefghijklmnopqrst", -20); - test(L"abcde", L"", 5); - test(L"abcde", L"abcde", 0); - test(L"abcde", L"abcdefghij", -5); - test(L"abcde", L"abcdefghijklmnopqrst", -15); - test(L"abcdefghij", L"", 10); - test(L"abcdefghij", L"abcde", 5); - test(L"abcdefghij", L"abcdefghij", 0); - test(L"abcdefghij", L"abcdefghijklmnopqrst", -10); - test(L"abcdefghijklmnopqrst", L"", 20); - test(L"abcdefghijklmnopqrst", L"abcde", 15); - test(L"abcdefghijklmnopqrst", L"abcdefghij", 10); - test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0); - } - -#if TEST_STD_VER >= 11 - { - test(U"", U"", 0); - test(U"", U"abcde", -5); - test(U"", U"abcdefghij", -10); - test(U"", U"abcdefghijklmnopqrst", -20); - test(U"abcde", U"", 5); - test(U"abcde", U"abcde", 0); - test(U"abcde", U"abcdefghij", -5); - test(U"abcde", U"abcdefghijklmnopqrst", -15); - test(U"abcdefghij", U"", 10); - test(U"abcdefghij", U"abcde", 5); - test(U"abcdefghij", U"abcdefghij", 0); - test(U"abcdefghij", U"abcdefghijklmnopqrst", -10); - test(U"abcdefghijklmnopqrst", U"", 20); - test(U"abcdefghijklmnopqrst", U"abcde", 15); - test(U"abcdefghijklmnopqrst", U"abcdefghij", 10); - test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0); - } - - { - test(u"", u"", 0); - test(u"", u"abcde", -5); - test(u"", u"abcdefghij", -10); - test(u"", u"abcdefghijklmnopqrst", -20); - test(u"abcde", u"", 5); - test(u"abcde", u"abcde", 0); - test(u"abcde", u"abcdefghij", -5); - test(u"abcde", u"abcdefghijklmnopqrst", -15); - test(u"abcdefghij", u"", 10); - test(u"abcdefghij", u"abcde", 5); - test(u"abcdefghij", u"abcdefghij", 0); - test(u"abcdefghij", u"abcdefghijklmnopqrst", -10); - test(u"abcdefghijklmnopqrst", u"", 20); - test(u"abcdefghijklmnopqrst", u"abcde", 15); - test(u"abcdefghijklmnopqrst", u"abcdefghij", 10); - test(u"abcdefghijklmnopqrst", u"abcdefghijklmnopqrst", 0); - } -#endif - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - static_assert ( sv1.compare("") == 0, "" ); - static_assert ( sv1.compare("abcde") == -1, "" ); - static_assert ( sv2.compare("") == 1, "" ); - static_assert ( sv2.compare("abcde") == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp deleted file mode 100644 index cfe35fcb4..000000000 --- a/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp +++ /dev/null @@ -1,453 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr int compare(size_type pos1, size_type n1, const charT* s) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); } - -template -void test1 ( std::experimental::basic_string_view sv1, - size_t pos1, size_t n1, const CharT *s, int expected ) { - if (pos1 > sv1.size()) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - sv1.compare(pos1, n1, s); - assert(false); - } catch (const std::out_of_range&) { - } catch (...) { - assert(false); - } -#endif - } else { - assert(sign(sv1.compare(pos1, n1, s)) == sign(expected)); - } -} - -template -void -test( const CharT *s1, size_t pos1, size_t n1, const CharT *s2, int expected) -{ - typedef std::experimental::basic_string_view string_view_t; - string_view_t sv1 ( s1 ); - test1 ( sv1, pos1, n1, s2, expected ); -} - -void test0() -{ - test("", 0, 0, "", 0); - test("", 0, 0, "abcde", -5); - test("", 0, 0, "abcdefghij", -10); - test("", 0, 0, "abcdefghijklmnopqrst", -20); - test("", 0, 1, "", 0); - test("", 0, 1, "abcde", -5); - test("", 0, 1, "abcdefghij", -10); - test("", 0, 1, "abcdefghijklmnopqrst", -20); - test("", 1, 0, "", 0); - test("", 1, 0, "abcde", 0); - test("", 1, 0, "abcdefghij", 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0); - test("abcde", 0, 0, "", 0); - test("abcde", 0, 0, "abcde", -5); - test("abcde", 0, 0, "abcdefghij", -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 0, 1, "", 1); - test("abcde", 0, 1, "abcde", -4); - test("abcde", 0, 1, "abcdefghij", -9); - test("abcde", 0, 1, "abcdefghijklmnopqrst", -19); - test("abcde", 0, 2, "", 2); - test("abcde", 0, 2, "abcde", -3); - test("abcde", 0, 2, "abcdefghij", -8); - test("abcde", 0, 2, "abcdefghijklmnopqrst", -18); - test("abcde", 0, 4, "", 4); - test("abcde", 0, 4, "abcde", -1); - test("abcde", 0, 4, "abcdefghij", -6); - test("abcde", 0, 4, "abcdefghijklmnopqrst", -16); - test("abcde", 0, 5, "", 5); - test("abcde", 0, 5, "abcde", 0); - test("abcde", 0, 5, "abcdefghij", -5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", -15); - test("abcde", 0, 6, "", 5); - test("abcde", 0, 6, "abcde", 0); - test("abcde", 0, 6, "abcdefghij", -5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", -15); - test("abcde", 1, 0, "", 0); - test("abcde", 1, 0, "abcde", -5); - test("abcde", 1, 0, "abcdefghij", -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 1, 1, "", 1); - test("abcde", 1, 1, "abcde", 1); - test("abcde", 1, 1, "abcdefghij", 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 2, "", 2); - test("abcde", 1, 2, "abcde", 1); - test("abcde", 1, 2, "abcdefghij", 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 3, "", 3); - test("abcde", 1, 3, "abcde", 1); - test("abcde", 1, 3, "abcdefghij", 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 4, "", 4); - test("abcde", 1, 4, "abcde", 1); - test("abcde", 1, 4, "abcdefghij", 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 5, "", 4); - test("abcde", 1, 5, "abcde", 1); - test("abcde", 1, 5, "abcdefghij", 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1); - test("abcde", 2, 0, "", 0); - test("abcde", 2, 0, "abcde", -5); - test("abcde", 2, 0, "abcdefghij", -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 2, 1, "", 1); - test("abcde", 2, 1, "abcde", 2); - test("abcde", 2, 1, "abcdefghij", 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 2); - test("abcde", 2, 2, "", 2); - test("abcde", 2, 2, "abcde", 2); - test("abcde", 2, 2, "abcdefghij", 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 2); - test("abcde", 2, 3, "", 3); - test("abcde", 2, 3, "abcde", 2); - test("abcde", 2, 3, "abcdefghij", 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 2); - test("abcde", 2, 4, "", 3); - test("abcde", 2, 4, "abcde", 2); - test("abcde", 2, 4, "abcdefghij", 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 2); - test("abcde", 4, 0, "", 0); - test("abcde", 4, 0, "abcde", -5); - test("abcde", 4, 0, "abcdefghij", -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 4, 1, "", 1); - test("abcde", 4, 1, "abcde", 4); - test("abcde", 4, 1, "abcdefghij", 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 4); - test("abcde", 4, 2, "", 1); - test("abcde", 4, 2, "abcde", 4); - test("abcde", 4, 2, "abcdefghij", 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 4); - test("abcde", 5, 0, "", 0); - test("abcde", 5, 0, "abcde", -5); - test("abcde", 5, 0, "abcdefghij", -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 5, 1, "", 0); - test("abcde", 5, 1, "abcde", -5); - test("abcde", 5, 1, "abcdefghij", -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", -20); -} - -void test1() -{ - test("abcde", 6, 0, "", 0); - test("abcde", 6, 0, "abcde", 0); - test("abcde", 6, 0, "abcdefghij", 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0); - test("abcdefghij", 0, 0, "", 0); - test("abcdefghij", 0, 0, "abcde", -5); - test("abcdefghij", 0, 0, "abcdefghij", -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 0, 1, "", 1); - test("abcdefghij", 0, 1, "abcde", -4); - test("abcdefghij", 0, 1, "abcdefghij", -9); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", -19); - test("abcdefghij", 0, 5, "", 5); - test("abcdefghij", 0, 5, "abcde", 0); - test("abcdefghij", 0, 5, "abcdefghij", -5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", -15); - test("abcdefghij", 0, 9, "", 9); - test("abcdefghij", 0, 9, "abcde", 4); - test("abcdefghij", 0, 9, "abcdefghij", -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", -11); - test("abcdefghij", 0, 10, "", 10); - test("abcdefghij", 0, 10, "abcde", 5); - test("abcdefghij", 0, 10, "abcdefghij", 0); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", -10); - test("abcdefghij", 0, 11, "", 10); - test("abcdefghij", 0, 11, "abcde", 5); - test("abcdefghij", 0, 11, "abcdefghij", 0); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", -10); - test("abcdefghij", 1, 0, "", 0); - test("abcdefghij", 1, 0, "abcde", -5); - test("abcdefghij", 1, 0, "abcdefghij", -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 1, 1, "", 1); - test("abcdefghij", 1, 1, "abcde", 1); - test("abcdefghij", 1, 1, "abcdefghij", 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 4, "", 4); - test("abcdefghij", 1, 4, "abcde", 1); - test("abcdefghij", 1, 4, "abcdefghij", 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 8, "", 8); - test("abcdefghij", 1, 8, "abcde", 1); - test("abcdefghij", 1, 8, "abcdefghij", 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 9, "", 9); - test("abcdefghij", 1, 9, "abcde", 1); - test("abcdefghij", 1, 9, "abcdefghij", 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 10, "", 9); - test("abcdefghij", 1, 10, "abcde", 1); - test("abcdefghij", 1, 10, "abcdefghij", 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 5, 0, "", 0); - test("abcdefghij", 5, 0, "abcde", -5); - test("abcdefghij", 5, 0, "abcdefghij", -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 5, 1, "", 1); - test("abcdefghij", 5, 1, "abcde", 5); - test("abcdefghij", 5, 1, "abcdefghij", 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 2, "", 2); - test("abcdefghij", 5, 2, "abcde", 5); - test("abcdefghij", 5, 2, "abcdefghij", 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 4, "", 4); - test("abcdefghij", 5, 4, "abcde", 5); - test("abcdefghij", 5, 4, "abcdefghij", 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 5, "", 5); - test("abcdefghij", 5, 5, "abcde", 5); - test("abcdefghij", 5, 5, "abcdefghij", 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 6, "", 5); - test("abcdefghij", 5, 6, "abcde", 5); - test("abcdefghij", 5, 6, "abcdefghij", 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 9, 0, "", 0); - test("abcdefghij", 9, 0, "abcde", -5); - test("abcdefghij", 9, 0, "abcdefghij", -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 9, 1, "", 1); - test("abcdefghij", 9, 1, "abcde", 9); - test("abcdefghij", 9, 1, "abcdefghij", 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 9); - test("abcdefghij", 9, 2, "", 1); - test("abcdefghij", 9, 2, "abcde", 9); - test("abcdefghij", 9, 2, "abcdefghij", 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 9); - test("abcdefghij", 10, 0, "", 0); - test("abcdefghij", 10, 0, "abcde", -5); - test("abcdefghij", 10, 0, "abcdefghij", -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 10, 1, "", 0); - test("abcdefghij", 10, 1, "abcde", -5); - test("abcdefghij", 10, 1, "abcdefghij", -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 11, 0, "", 0); - test("abcdefghij", 11, 0, "abcde", 0); - test("abcdefghij", 11, 0, "abcdefghij", 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0); -} - -void test2() -{ - test("abcdefghijklmnopqrst", 0, 0, "", 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 0, 1, "", 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", -4); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", -19); - test("abcdefghijklmnopqrst", 0, 10, "", 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", -10); - test("abcdefghijklmnopqrst", 0, 19, "", 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 14); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", -1); - test("abcdefghijklmnopqrst", 0, 20, "", 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 15); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0); - test("abcdefghijklmnopqrst", 0, 21, "", 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 15); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0); - test("abcdefghijklmnopqrst", 1, 0, "", 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 1, 1, "", 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 9, "", 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 18, "", 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 19, "", 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 20, "", 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 10, 0, "", 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 10, 1, "", 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 5, "", 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 9, "", 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 10, "", 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 11, "", 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 19, 0, "", 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 19, 1, "", 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19); - test("abcdefghijklmnopqrst", 19, 2, "", 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19); - test("abcdefghijklmnopqrst", 20, 0, "", 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 20, 1, "", 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 21, 0, "", 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0); -} - - -int main() -{ - test0(); - test1(); - test2(); - - { - test("", 0, 0, "", 0); - test("", 0, 0, "abcde", -5); - test("", 0, 0, "abcdefghij", -10); - test("", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 0, 2, "", 5); - test("abcde", 0, 6,"abcde", 0); - test("abcde", 0, 6, "abcdefghij", -5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", -15); - test("abcdefghij", 3, 3, "", 10); - test("abcdefghij", 3, 3,"abcde", 5); - test("abcdefghij", 3, 3, "def", 0); - test("abcdefghij", 0, 4, "abcdefghijklmnopqrst", -10); - test("abcdefghijklmnopqrst", 5, 5, "", 20); - test("abcdefghijklmnopqrst", 0, 8, "abcde", 15); - test("abcdefghijklmnopqrst", 0, 12, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 0, -1, "abcdefghijklmnopqrst", 0); - } - - { - test(L"", 0, 0, L"", 0); - test(L"", 0, 0, L"abcde", -5); - test(L"", 0, 0, L"abcdefghij", -10); - test(L"", 0, 0, L"abcdefghijklmnopqrst", -20); - test(L"abcde", 0, 2, L"", 5); - test(L"abcde", 0, 6, L"abcde", 0); - test(L"abcde", 0, 6, L"abcdefghij", -5); - test(L"abcde", 0, 6, L"abcdefghijklmnopqrst", -15); - test(L"abcdefghij", 3, 3, L"", 10); - test(L"abcdefghij", 3, 3, L"abcde", 5); - test(L"abcdefghij", 3, 3, L"def", 0); - test(L"abcdefghij", 0, 4, L"abcdefghijklmnopqrst", -10); - test(L"abcdefghijklmnopqrst", 5, 5, L"", 20); - test(L"abcdefghijklmnopqrst", 0, 8, L"abcde", 15); - test(L"abcdefghijklmnopqrst", 0, 12, L"abcdefghij", 10); - test(L"abcdefghijklmnopqrst", 0, -1, L"abcdefghijklmnopqrst", 0); - } - -#if TEST_STD_VER >= 11 - { - test(U"", 0, 0, U"", 0); - test(U"", 0, 0, U"abcde", -5); - test(U"", 0, 0, U"abcdefghij", -10); - test(U"", 0, 0, U"abcdefghijklmnopqrst", -20); - test(U"abcde", 0, 2, U"", 5); - test(U"abcde", 0, 6, U"abcde", 0); - test(U"abcde", 0, 6, U"abcdefghij", -5); - test(U"abcde", 0, 6, U"abcdefghijklmnopqrst", -15); - test(U"abcdefghij", 3, 3, U"", 10); - test(U"abcdefghij", 3, 3, U"abcde", 5); - test(U"abcdefghij", 3, 3, U"def", 0); - test(U"abcdefghij", 0, 4, U"abcdefghijklmnopqrst", -10); - test(U"abcdefghijklmnopqrst", 5, 5, U"", 20); - test(U"abcdefghijklmnopqrst", 0, 8, U"abcde", 15); - test(U"abcdefghijklmnopqrst", 0, 12, U"abcdefghij", 10); - test(U"abcdefghijklmnopqrst", 0, -1, U"abcdefghijklmnopqrst", 0); - } - - { - test(u"", 0, 0, u"", 0); - test(u"", 0, 0, u"abcde", -5); - test(u"", 0, 0, u"abcdefghij", -10); - test(u"", 0, 0, u"abcdefghijklmnopqrst", -20); - test(u"abcde", 0, 2, u"", 5); - test(u"abcde", 0, 6, u"abcde", 0); - test(u"abcde", 0, 6, u"abcdefghij", -5); - test(u"abcde", 0, 6, u"abcdefghijklmnopqrst", -15); - test(u"abcdefghij", 3, 3, u"", 10); - test(u"abcdefghij", 3, 3, u"abcde", 5); - test(u"abcdefghij", 3, 3, u"def", 0); - test(u"abcdefghij", 0, 4, u"abcdefghijklmnopqrst", -10); - test(u"abcdefghijklmnopqrst", 5, 5, u"", 20); - test(u"abcdefghijklmnopqrst", 0, 8, u"abcde", 15); - test(u"abcdefghijklmnopqrst", 0, 12, u"abcdefghij", 10); - test(u"abcdefghijklmnopqrst", 0, -1, u"abcdefghijklmnopqrst", 0); - } -#endif - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcde", 5 }; - static_assert ( sv1.compare(0, 0, "") == 0, "" ); - static_assert ( sv1.compare(0, 0, "abcde") == -1, "" ); - static_assert ( sv2.compare(0, 2, "") == 1, "" ); - static_assert ( sv2.compare(0, 6, "abcde") == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp deleted file mode 100644 index 2684d9034..000000000 --- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp +++ /dev/null @@ -1,403 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr int compare(size_type pos1, size_type n1, basic_string_view str) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); } - -template -void test1 ( std::experimental::basic_string_view sv1, size_t pos1, size_t n1, - std::experimental::basic_string_view sv2, int expected ) { - - if (pos1 > sv1.size()) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - sv1.compare(pos1, n1, sv2); - assert(false); - } catch (const std::out_of_range&) { - } catch (...) { - assert(false); - } -#endif - } else { - assert ( sign( sv1.compare(pos1, n1, sv2)) == sign(expected)); - } -} - - -template -void test ( const CharT *s1, size_t pos1, size_t n1, const CharT *s2, int expected ) { - typedef std::experimental::basic_string_view string_view_t; - string_view_t sv1 ( s1 ); - string_view_t sv2 ( s2 ); - test1(sv1, pos1, n1, sv2, expected); -} - -void test0() -{ - test("", 0, 0, "", 0); - test("", 0, 0, "abcde", -5); - test("", 0, 0, "abcdefghij", -10); - test("", 0, 0, "abcdefghijklmnopqrst", -20); - test("", 0, 1, "", 0); - test("", 0, 1, "abcde", -5); - test("", 0, 1, "abcdefghij", -10); - test("", 0, 1, "abcdefghijklmnopqrst", -20); - test("", 1, 0, "", 0); - test("", 1, 0, "abcde", 0); - test("", 1, 0, "abcdefghij", 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0); - test("abcde", 0, 0, "", 0); - test("abcde", 0, 0, "abcde", -5); - test("abcde", 0, 0, "abcdefghij", -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 0, 1, "", 1); - test("abcde", 0, 1, "abcde", -4); - test("abcde", 0, 1, "abcdefghij", -9); - test("abcde", 0, 1, "abcdefghijklmnopqrst", -19); - test("abcde", 0, 2, "", 2); - test("abcde", 0, 2, "abcde", -3); - test("abcde", 0, 2, "abcdefghij", -8); - test("abcde", 0, 2, "abcdefghijklmnopqrst", -18); - test("abcde", 0, 4, "", 4); - test("abcde", 0, 4, "abcde", -1); - test("abcde", 0, 4, "abcdefghij", -6); - test("abcde", 0, 4, "abcdefghijklmnopqrst", -16); - test("abcde", 0, 5, "", 5); - test("abcde", 0, 5, "abcde", 0); - test("abcde", 0, 5, "abcdefghij", -5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", -15); - test("abcde", 0, 6, "", 5); - test("abcde", 0, 6, "abcde", 0); - test("abcde", 0, 6, "abcdefghij", -5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", -15); - test("abcde", 1, 0, "", 0); - test("abcde", 1, 0, "abcde", -5); - test("abcde", 1, 0, "abcdefghij", -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 1, 1, "", 1); - test("abcde", 1, 1, "abcde", 1); - test("abcde", 1, 1, "abcdefghij", 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 2, "", 2); - test("abcde", 1, 2, "abcde", 1); - test("abcde", 1, 2, "abcdefghij", 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 3, "", 3); - test("abcde", 1, 3, "abcde", 1); - test("abcde", 1, 3, "abcdefghij", 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 4, "", 4); - test("abcde", 1, 4, "abcde", 1); - test("abcde", 1, 4, "abcdefghij", 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1); - test("abcde", 1, 5, "", 4); - test("abcde", 1, 5, "abcde", 1); - test("abcde", 1, 5, "abcdefghij", 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1); - test("abcde", 2, 0, "", 0); - test("abcde", 2, 0, "abcde", -5); - test("abcde", 2, 0, "abcdefghij", -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 2, 1, "", 1); - test("abcde", 2, 1, "abcde", 2); - test("abcde", 2, 1, "abcdefghij", 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 2); - test("abcde", 2, 2, "", 2); - test("abcde", 2, 2, "abcde", 2); - test("abcde", 2, 2, "abcdefghij", 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 2); - test("abcde", 2, 3, "", 3); - test("abcde", 2, 3, "abcde", 2); - test("abcde", 2, 3, "abcdefghij", 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 2); - test("abcde", 2, 4, "", 3); - test("abcde", 2, 4, "abcde", 2); - test("abcde", 2, 4, "abcdefghij", 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 2); - test("abcde", 4, 0, "", 0); - test("abcde", 4, 0, "abcde", -5); - test("abcde", 4, 0, "abcdefghij", -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 4, 1, "", 1); - test("abcde", 4, 1, "abcde", 4); - test("abcde", 4, 1, "abcdefghij", 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 4); - test("abcde", 4, 2, "", 1); - test("abcde", 4, 2, "abcde", 4); - test("abcde", 4, 2, "abcdefghij", 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 4); - test("abcde", 5, 0, "", 0); - test("abcde", 5, 0, "abcde", -5); - test("abcde", 5, 0, "abcdefghij", -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", -20); - test("abcde", 5, 1, "", 0); - test("abcde", 5, 1, "abcde", -5); - test("abcde", 5, 1, "abcdefghij", -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", -20); -} - -void test1() -{ - test("abcde", 6, 0, "", 0); - test("abcde", 6, 0, "abcde", 0); - test("abcde", 6, 0, "abcdefghij", 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0); - test("abcdefghij", 0, 0, "", 0); - test("abcdefghij", 0, 0, "abcde", -5); - test("abcdefghij", 0, 0, "abcdefghij", -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 0, 1, "", 1); - test("abcdefghij", 0, 1, "abcde", -4); - test("abcdefghij", 0, 1, "abcdefghij", -9); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", -19); - test("abcdefghij", 0, 5, "", 5); - test("abcdefghij", 0, 5, "abcde", 0); - test("abcdefghij", 0, 5, "abcdefghij", -5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", -15); - test("abcdefghij", 0, 9, "", 9); - test("abcdefghij", 0, 9, "abcde", 4); - test("abcdefghij", 0, 9, "abcdefghij", -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", -11); - test("abcdefghij", 0, 10, "", 10); - test("abcdefghij", 0, 10, "abcde", 5); - test("abcdefghij", 0, 10, "abcdefghij", 0); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", -10); - test("abcdefghij", 0, 11, "", 10); - test("abcdefghij", 0, 11, "abcde", 5); - test("abcdefghij", 0, 11, "abcdefghij", 0); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", -10); - test("abcdefghij", 1, 0, "", 0); - test("abcdefghij", 1, 0, "abcde", -5); - test("abcdefghij", 1, 0, "abcdefghij", -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 1, 1, "", 1); - test("abcdefghij", 1, 1, "abcde", 1); - test("abcdefghij", 1, 1, "abcdefghij", 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 4, "", 4); - test("abcdefghij", 1, 4, "abcde", 1); - test("abcdefghij", 1, 4, "abcdefghij", 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 8, "", 8); - test("abcdefghij", 1, 8, "abcde", 1); - test("abcdefghij", 1, 8, "abcdefghij", 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 9, "", 9); - test("abcdefghij", 1, 9, "abcde", 1); - test("abcdefghij", 1, 9, "abcdefghij", 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 1, 10, "", 9); - test("abcdefghij", 1, 10, "abcde", 1); - test("abcdefghij", 1, 10, "abcdefghij", 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1); - test("abcdefghij", 5, 0, "", 0); - test("abcdefghij", 5, 0, "abcde", -5); - test("abcdefghij", 5, 0, "abcdefghij", -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 5, 1, "", 1); - test("abcdefghij", 5, 1, "abcde", 5); - test("abcdefghij", 5, 1, "abcdefghij", 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 2, "", 2); - test("abcdefghij", 5, 2, "abcde", 5); - test("abcdefghij", 5, 2, "abcdefghij", 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 4, "", 4); - test("abcdefghij", 5, 4, "abcde", 5); - test("abcdefghij", 5, 4, "abcdefghij", 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 5, "", 5); - test("abcdefghij", 5, 5, "abcde", 5); - test("abcdefghij", 5, 5, "abcdefghij", 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 5, 6, "", 5); - test("abcdefghij", 5, 6, "abcde", 5); - test("abcdefghij", 5, 6, "abcdefghij", 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 5); - test("abcdefghij", 9, 0, "", 0); - test("abcdefghij", 9, 0, "abcde", -5); - test("abcdefghij", 9, 0, "abcdefghij", -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 9, 1, "", 1); - test("abcdefghij", 9, 1, "abcde", 9); - test("abcdefghij", 9, 1, "abcdefghij", 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 9); - test("abcdefghij", 9, 2, "", 1); - test("abcdefghij", 9, 2, "abcde", 9); - test("abcdefghij", 9, 2, "abcdefghij", 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 9); - test("abcdefghij", 10, 0, "", 0); - test("abcdefghij", 10, 0, "abcde", -5); - test("abcdefghij", 10, 0, "abcdefghij", -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 10, 1, "", 0); - test("abcdefghij", 10, 1, "abcde", -5); - test("abcdefghij", 10, 1, "abcdefghij", -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", -20); - test("abcdefghij", 11, 0, "", 0); - test("abcdefghij", 11, 0, "abcde", 0); - test("abcdefghij", 11, 0, "abcdefghij", 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0); -} - -void test2() -{ - test("abcdefghijklmnopqrst", 0, 0, "", 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 0, 1, "", 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", -4); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", -19); - test("abcdefghijklmnopqrst", 0, 10, "", 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", -10); - test("abcdefghijklmnopqrst", 0, 19, "", 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 14); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", -1); - test("abcdefghijklmnopqrst", 0, 20, "", 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 15); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0); - test("abcdefghijklmnopqrst", 0, 21, "", 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 15); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0); - test("abcdefghijklmnopqrst", 1, 0, "", 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 1, 1, "", 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 9, "", 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 18, "", 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 19, "", 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 1, 20, "", 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1); - test("abcdefghijklmnopqrst", 10, 0, "", 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 10, 1, "", 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 5, "", 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 9, "", 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 10, "", 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 10, 11, "", 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10); - test("abcdefghijklmnopqrst", 19, 0, "", 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 19, 1, "", 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19); - test("abcdefghijklmnopqrst", 19, 2, "", 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19); - test("abcdefghijklmnopqrst", 20, 0, "", 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 20, 1, "", 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", -20); - test("abcdefghijklmnopqrst", 21, 0, "", 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0); -} - - -int main () { - test0(); - test1(); - test2(); - - { - test("abcde", 5, 1, "", 0); - test("abcde", 2, 4, "", 3); - test("abcde", 2, 4, "abcde", 2); - test("ABCde", 2, 4, "abcde", -1); - } - - { - test(L"abcde", 5, 1, L"", 0); - test(L"abcde", 2, 4, L"", 3); - test(L"abcde", 2, 4, L"abcde", 2); - test(L"ABCde", 2, 4, L"abcde", -1); - } - -#if TEST_STD_VER >= 11 - { - test(u"abcde", 5, 1, u"", 0); - test(u"abcde", 2, 4, u"", 3); - test(u"abcde", 2, 4, u"abcde", 2); - test(u"ABCde", 2, 4, u"abcde", -1); - } - - { - test(U"abcde", 5, 1, U"", 0); - test(U"abcde", 2, 4, U"", 3); - test(U"abcde", 2, 4, U"abcde", 2); - test(U"ABCde", 2, 4, U"abcde", -1); - } -#endif - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1 { "abcde", 5 }; - constexpr SV sv2 { "abcde", 0 }; - static_assert ( sv1.compare(5, 1, sv2) == 0, "" ); - static_assert ( sv1.compare(2, 4, sv2) == 1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp deleted file mode 100644 index 69de6335f..000000000 --- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp +++ /dev/null @@ -1,1356 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr int compare(size_type pos1, size_type n1, -// const charT* s, size_type n2) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); } - -template -void test1 ( std::experimental::basic_string_view sv1, size_t pos1, size_t n1, - const CharT *s2, size_t n2, - int expected ) { - if (pos1 > sv1.size()) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - sv1.compare(pos1, n1, s2, n2); - assert(false); - } catch (const std::out_of_range&) { - return; - } catch (...) { - assert(false); - } -#endif - } else { - assert(sign(sv1.compare(pos1, n1, s2, n2)) == sign(expected)); - } - -} - - -template -void test ( const CharT *s1, size_t pos1, size_t n1, - const CharT *s2, size_t n2, - int expected ) { - typedef std::experimental::basic_string_view string_view_t; - string_view_t sv1 ( s1 ); - test1 (sv1, pos1, n1, s2, n2, expected); -} - - -void test0() -{ - test("", 0, 0, "", 0, 0); - test("", 0, 0, "abcde", 0, 0); - test("", 0, 0, "abcde", 1, -1); - test("", 0, 0, "abcde", 2, -2); - test("", 0, 0, "abcde", 4, -4); - test("", 0, 0, "abcde", 5, -5); - test("", 0, 0, "abcdefghij", 0, 0); - test("", 0, 0, "abcdefghij", 1, -1); - test("", 0, 0, "abcdefghij", 5, -5); - test("", 0, 0, "abcdefghij", 9, -9); - test("", 0, 0, "abcdefghij", 10, -10); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 1, -1); - test("", 0, 0, "abcdefghijklmnopqrst", 10, -10); - test("", 0, 0, "abcdefghijklmnopqrst", 19, -19); - test("", 0, 0, "abcdefghijklmnopqrst", 20, -20); - test("", 0, 1, "", 0, 0); - test("", 0, 1, "abcde", 0, 0); - test("", 0, 1, "abcde", 1, -1); - test("", 0, 1, "abcde", 2, -2); - test("", 0, 1, "abcde", 4, -4); - test("", 0, 1, "abcde", 5, -5); - test("", 0, 1, "abcdefghij", 0, 0); - test("", 0, 1, "abcdefghij", 1, -1); - test("", 0, 1, "abcdefghij", 5, -5); - test("", 0, 1, "abcdefghij", 9, -9); - test("", 0, 1, "abcdefghij", 10, -10); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 1, -1); - test("", 0, 1, "abcdefghijklmnopqrst", 10, -10); - test("", 0, 1, "abcdefghijklmnopqrst", 19, -19); - test("", 0, 1, "abcdefghijklmnopqrst", 20, -20); - test("", 1, 0, "", 0, 0); - test("", 1, 0, "abcde", 0, 0); - test("", 1, 0, "abcde", 1, 0); - test("", 1, 0, "abcde", 2, 0); - test("", 1, 0, "abcde", 4, 0); - test("", 1, 0, "abcde", 5, 0); - test("", 1, 0, "abcdefghij", 0, 0); - test("", 1, 0, "abcdefghij", 1, 0); - test("", 1, 0, "abcdefghij", 5, 0); - test("", 1, 0, "abcdefghij", 9, 0); - test("", 1, 0, "abcdefghij", 10, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 19, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 20, 0); - test("abcde", 0, 0, "", 0, 0); - test("abcde", 0, 0, "abcde", 0, 0); - test("abcde", 0, 0, "abcde", 1, -1); - test("abcde", 0, 0, "abcde", 2, -2); - test("abcde", 0, 0, "abcde", 4, -4); - test("abcde", 0, 0, "abcde", 5, -5); - test("abcde", 0, 0, "abcdefghij", 0, 0); - test("abcde", 0, 0, "abcdefghij", 1, -1); - test("abcde", 0, 0, "abcdefghij", 5, -5); - test("abcde", 0, 0, "abcdefghij", 9, -9); - test("abcde", 0, 0, "abcdefghij", 10, -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcde", 0, 1, "", 0, 1); - test("abcde", 0, 1, "abcde", 0, 1); - test("abcde", 0, 1, "abcde", 1, 0); - test("abcde", 0, 1, "abcde", 2, -1); - test("abcde", 0, 1, "abcde", 4, -3); - test("abcde", 0, 1, "abcde", 5, -4); - test("abcde", 0, 1, "abcdefghij", 0, 1); - test("abcde", 0, 1, "abcdefghij", 1, 0); - test("abcde", 0, 1, "abcdefghij", 5, -4); - test("abcde", 0, 1, "abcdefghij", 9, -8); - test("abcde", 0, 1, "abcdefghij", 10, -9); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 0); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, -9); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, -18); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 20, -19); - test("abcde", 0, 2, "", 0, 2); - test("abcde", 0, 2, "abcde", 0, 2); - test("abcde", 0, 2, "abcde", 1, 1); - test("abcde", 0, 2, "abcde", 2, 0); - test("abcde", 0, 2, "abcde", 4, -2); - test("abcde", 0, 2, "abcde", 5, -3); - test("abcde", 0, 2, "abcdefghij", 0, 2); - test("abcde", 0, 2, "abcdefghij", 1, 1); - test("abcde", 0, 2, "abcdefghij", 5, -3); - test("abcde", 0, 2, "abcdefghij", 9, -7); - test("abcde", 0, 2, "abcdefghij", 10, -8); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, -8); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, -17); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 20, -18); - test("abcde", 0, 4, "", 0, 4); - test("abcde", 0, 4, "abcde", 0, 4); - test("abcde", 0, 4, "abcde", 1, 3); - test("abcde", 0, 4, "abcde", 2, 2); -} - - -void test1() -{ - test("abcde", 0, 4, "abcde", 4, 0); - test("abcde", 0, 4, "abcde", 5, -1); - test("abcde", 0, 4, "abcdefghij", 0, 4); - test("abcde", 0, 4, "abcdefghij", 1, 3); - test("abcde", 0, 4, "abcdefghij", 5, -1); - test("abcde", 0, 4, "abcdefghij", 9, -5); - test("abcde", 0, 4, "abcdefghij", 10, -6); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 3); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, -6); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, -15); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 20, -16); - test("abcde", 0, 5, "", 0, 5); - test("abcde", 0, 5, "abcde", 0, 5); - test("abcde", 0, 5, "abcde", 1, 4); - test("abcde", 0, 5, "abcde", 2, 3); - test("abcde", 0, 5, "abcde", 4, 1); - test("abcde", 0, 5, "abcde", 5, 0); - test("abcde", 0, 5, "abcdefghij", 0, 5); - test("abcde", 0, 5, "abcdefghij", 1, 4); - test("abcde", 0, 5, "abcdefghij", 5, 0); - test("abcde", 0, 5, "abcdefghij", 9, -4); - test("abcde", 0, 5, "abcdefghij", 10, -5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 4); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, -5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, -14); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 20, -15); - test("abcde", 0, 6, "", 0, 5); - test("abcde", 0, 6, "abcde", 0, 5); - test("abcde", 0, 6, "abcde", 1, 4); - test("abcde", 0, 6, "abcde", 2, 3); - test("abcde", 0, 6, "abcde", 4, 1); - test("abcde", 0, 6, "abcde", 5, 0); - test("abcde", 0, 6, "abcdefghij", 0, 5); - test("abcde", 0, 6, "abcdefghij", 1, 4); - test("abcde", 0, 6, "abcdefghij", 5, 0); - test("abcde", 0, 6, "abcdefghij", 9, -4); - test("abcde", 0, 6, "abcdefghij", 10, -5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 4); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, -5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, -14); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 20, -15); - test("abcde", 1, 0, "", 0, 0); - test("abcde", 1, 0, "abcde", 0, 0); - test("abcde", 1, 0, "abcde", 1, -1); - test("abcde", 1, 0, "abcde", 2, -2); - test("abcde", 1, 0, "abcde", 4, -4); - test("abcde", 1, 0, "abcde", 5, -5); - test("abcde", 1, 0, "abcdefghij", 0, 0); - test("abcde", 1, 0, "abcdefghij", 1, -1); - test("abcde", 1, 0, "abcdefghij", 5, -5); - test("abcde", 1, 0, "abcdefghij", 9, -9); - test("abcde", 1, 0, "abcdefghij", 10, -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcde", 1, 1, "", 0, 1); - test("abcde", 1, 1, "abcde", 0, 1); - test("abcde", 1, 1, "abcde", 1, 1); - test("abcde", 1, 1, "abcde", 2, 1); - test("abcde", 1, 1, "abcde", 4, 1); - test("abcde", 1, 1, "abcde", 5, 1); - test("abcde", 1, 1, "abcdefghij", 0, 1); - test("abcde", 1, 1, "abcdefghij", 1, 1); - test("abcde", 1, 1, "abcdefghij", 5, 1); - test("abcde", 1, 1, "abcdefghij", 9, 1); - test("abcde", 1, 1, "abcdefghij", 10, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 20, 1); - test("abcde", 1, 2, "", 0, 2); - test("abcde", 1, 2, "abcde", 0, 2); - test("abcde", 1, 2, "abcde", 1, 1); - test("abcde", 1, 2, "abcde", 2, 1); - test("abcde", 1, 2, "abcde", 4, 1); - test("abcde", 1, 2, "abcde", 5, 1); - test("abcde", 1, 2, "abcdefghij", 0, 2); - test("abcde", 1, 2, "abcdefghij", 1, 1); - test("abcde", 1, 2, "abcdefghij", 5, 1); - test("abcde", 1, 2, "abcdefghij", 9, 1); - test("abcde", 1, 2, "abcdefghij", 10, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 20, 1); - test("abcde", 1, 3, "", 0, 3); - test("abcde", 1, 3, "abcde", 0, 3); - test("abcde", 1, 3, "abcde", 1, 1); - test("abcde", 1, 3, "abcde", 2, 1); - test("abcde", 1, 3, "abcde", 4, 1); - test("abcde", 1, 3, "abcde", 5, 1); - test("abcde", 1, 3, "abcdefghij", 0, 3); - test("abcde", 1, 3, "abcdefghij", 1, 1); -} - - -void test2() -{ - test("abcde", 1, 3, "abcdefghij", 5, 1); - test("abcde", 1, 3, "abcdefghij", 9, 1); - test("abcde", 1, 3, "abcdefghij", 10, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 20, 1); - test("abcde", 1, 4, "", 0, 4); - test("abcde", 1, 4, "abcde", 0, 4); - test("abcde", 1, 4, "abcde", 1, 1); - test("abcde", 1, 4, "abcde", 2, 1); - test("abcde", 1, 4, "abcde", 4, 1); - test("abcde", 1, 4, "abcde", 5, 1); - test("abcde", 1, 4, "abcdefghij", 0, 4); - test("abcde", 1, 4, "abcdefghij", 1, 1); - test("abcde", 1, 4, "abcdefghij", 5, 1); - test("abcde", 1, 4, "abcdefghij", 9, 1); - test("abcde", 1, 4, "abcdefghij", 10, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 20, 1); - test("abcde", 1, 5, "", 0, 4); - test("abcde", 1, 5, "abcde", 0, 4); - test("abcde", 1, 5, "abcde", 1, 1); - test("abcde", 1, 5, "abcde", 2, 1); - test("abcde", 1, 5, "abcde", 4, 1); - test("abcde", 1, 5, "abcde", 5, 1); - test("abcde", 1, 5, "abcdefghij", 0, 4); - test("abcde", 1, 5, "abcdefghij", 1, 1); - test("abcde", 1, 5, "abcdefghij", 5, 1); - test("abcde", 1, 5, "abcdefghij", 9, 1); - test("abcde", 1, 5, "abcdefghij", 10, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 20, 1); - test("abcde", 2, 0, "", 0, 0); - test("abcde", 2, 0, "abcde", 0, 0); - test("abcde", 2, 0, "abcde", 1, -1); - test("abcde", 2, 0, "abcde", 2, -2); - test("abcde", 2, 0, "abcde", 4, -4); - test("abcde", 2, 0, "abcde", 5, -5); - test("abcde", 2, 0, "abcdefghij", 0, 0); - test("abcde", 2, 0, "abcdefghij", 1, -1); - test("abcde", 2, 0, "abcdefghij", 5, -5); - test("abcde", 2, 0, "abcdefghij", 9, -9); - test("abcde", 2, 0, "abcdefghij", 10, -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcde", 2, 1, "", 0, 1); - test("abcde", 2, 1, "abcde", 0, 1); - test("abcde", 2, 1, "abcde", 1, 2); - test("abcde", 2, 1, "abcde", 2, 2); - test("abcde", 2, 1, "abcde", 4, 2); - test("abcde", 2, 1, "abcde", 5, 2); - test("abcde", 2, 1, "abcdefghij", 0, 1); - test("abcde", 2, 1, "abcdefghij", 1, 2); - test("abcde", 2, 1, "abcdefghij", 5, 2); - test("abcde", 2, 1, "abcdefghij", 9, 2); - test("abcde", 2, 1, "abcdefghij", 10, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 20, 2); - test("abcde", 2, 2, "", 0, 2); - test("abcde", 2, 2, "abcde", 0, 2); - test("abcde", 2, 2, "abcde", 1, 2); - test("abcde", 2, 2, "abcde", 2, 2); - test("abcde", 2, 2, "abcde", 4, 2); - test("abcde", 2, 2, "abcde", 5, 2); - test("abcde", 2, 2, "abcdefghij", 0, 2); - test("abcde", 2, 2, "abcdefghij", 1, 2); - test("abcde", 2, 2, "abcdefghij", 5, 2); - test("abcde", 2, 2, "abcdefghij", 9, 2); - test("abcde", 2, 2, "abcdefghij", 10, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 20, 2); - test("abcde", 2, 3, "", 0, 3); - test("abcde", 2, 3, "abcde", 0, 3); - test("abcde", 2, 3, "abcde", 1, 2); - test("abcde", 2, 3, "abcde", 2, 2); - test("abcde", 2, 3, "abcde", 4, 2); - test("abcde", 2, 3, "abcde", 5, 2); - test("abcde", 2, 3, "abcdefghij", 0, 3); - test("abcde", 2, 3, "abcdefghij", 1, 2); - test("abcde", 2, 3, "abcdefghij", 5, 2); - test("abcde", 2, 3, "abcdefghij", 9, 2); - test("abcde", 2, 3, "abcdefghij", 10, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 3); -} - - -void test3() -{ - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 20, 2); - test("abcde", 2, 4, "", 0, 3); - test("abcde", 2, 4, "abcde", 0, 3); - test("abcde", 2, 4, "abcde", 1, 2); - test("abcde", 2, 4, "abcde", 2, 2); - test("abcde", 2, 4, "abcde", 4, 2); - test("abcde", 2, 4, "abcde", 5, 2); - test("abcde", 2, 4, "abcdefghij", 0, 3); - test("abcde", 2, 4, "abcdefghij", 1, 2); - test("abcde", 2, 4, "abcdefghij", 5, 2); - test("abcde", 2, 4, "abcdefghij", 9, 2); - test("abcde", 2, 4, "abcdefghij", 10, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 20, 2); - test("abcde", 4, 0, "", 0, 0); - test("abcde", 4, 0, "abcde", 0, 0); - test("abcde", 4, 0, "abcde", 1, -1); - test("abcde", 4, 0, "abcde", 2, -2); - test("abcde", 4, 0, "abcde", 4, -4); - test("abcde", 4, 0, "abcde", 5, -5); - test("abcde", 4, 0, "abcdefghij", 0, 0); - test("abcde", 4, 0, "abcdefghij", 1, -1); - test("abcde", 4, 0, "abcdefghij", 5, -5); - test("abcde", 4, 0, "abcdefghij", 9, -9); - test("abcde", 4, 0, "abcdefghij", 10, -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcde", 4, 1, "", 0, 1); - test("abcde", 4, 1, "abcde", 0, 1); - test("abcde", 4, 1, "abcde", 1, 4); - test("abcde", 4, 1, "abcde", 2, 4); - test("abcde", 4, 1, "abcde", 4, 4); - test("abcde", 4, 1, "abcde", 5, 4); - test("abcde", 4, 1, "abcdefghij", 0, 1); - test("abcde", 4, 1, "abcdefghij", 1, 4); - test("abcde", 4, 1, "abcdefghij", 5, 4); - test("abcde", 4, 1, "abcdefghij", 9, 4); - test("abcde", 4, 1, "abcdefghij", 10, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 20, 4); - test("abcde", 4, 2, "", 0, 1); - test("abcde", 4, 2, "abcde", 0, 1); - test("abcde", 4, 2, "abcde", 1, 4); - test("abcde", 4, 2, "abcde", 2, 4); - test("abcde", 4, 2, "abcde", 4, 4); - test("abcde", 4, 2, "abcde", 5, 4); - test("abcde", 4, 2, "abcdefghij", 0, 1); - test("abcde", 4, 2, "abcdefghij", 1, 4); - test("abcde", 4, 2, "abcdefghij", 5, 4); - test("abcde", 4, 2, "abcdefghij", 9, 4); - test("abcde", 4, 2, "abcdefghij", 10, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 1); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 20, 4); - test("abcde", 5, 0, "", 0, 0); - test("abcde", 5, 0, "abcde", 0, 0); - test("abcde", 5, 0, "abcde", 1, -1); - test("abcde", 5, 0, "abcde", 2, -2); - test("abcde", 5, 0, "abcde", 4, -4); - test("abcde", 5, 0, "abcde", 5, -5); - test("abcde", 5, 0, "abcdefghij", 0, 0); - test("abcde", 5, 0, "abcdefghij", 1, -1); - test("abcde", 5, 0, "abcdefghij", 5, -5); - test("abcde", 5, 0, "abcdefghij", 9, -9); - test("abcde", 5, 0, "abcdefghij", 10, -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcde", 5, 1, "", 0, 0); - test("abcde", 5, 1, "abcde", 0, 0); - test("abcde", 5, 1, "abcde", 1, -1); - test("abcde", 5, 1, "abcde", 2, -2); - test("abcde", 5, 1, "abcde", 4, -4); - test("abcde", 5, 1, "abcde", 5, -5); - test("abcde", 5, 1, "abcdefghij", 0, 0); - test("abcde", 5, 1, "abcdefghij", 1, -1); - test("abcde", 5, 1, "abcdefghij", 5, -5); - test("abcde", 5, 1, "abcdefghij", 9, -9); - test("abcde", 5, 1, "abcdefghij", 10, -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, -1); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, -19); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 20, -20); -} - - -void test4() -{ - test("abcde", 6, 0, "", 0, 0); - test("abcde", 6, 0, "abcde", 0, 0); - test("abcde", 6, 0, "abcde", 1, 0); - test("abcde", 6, 0, "abcde", 2, 0); - test("abcde", 6, 0, "abcde", 4, 0); - test("abcde", 6, 0, "abcde", 5, 0); - test("abcde", 6, 0, "abcdefghij", 0, 0); - test("abcde", 6, 0, "abcdefghij", 1, 0); - test("abcde", 6, 0, "abcdefghij", 5, 0); - test("abcde", 6, 0, "abcdefghij", 9, 0); - test("abcde", 6, 0, "abcdefghij", 10, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 20, 0); - test("abcdefghij", 0, 0, "", 0, 0); - test("abcdefghij", 0, 0, "abcde", 0, 0); - test("abcdefghij", 0, 0, "abcde", 1, -1); - test("abcdefghij", 0, 0, "abcde", 2, -2); - test("abcdefghij", 0, 0, "abcde", 4, -4); - test("abcdefghij", 0, 0, "abcde", 5, -5); - test("abcdefghij", 0, 0, "abcdefghij", 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 1, -1); - test("abcdefghij", 0, 0, "abcdefghij", 5, -5); - test("abcdefghij", 0, 0, "abcdefghij", 9, -9); - test("abcdefghij", 0, 0, "abcdefghij", 10, -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghij", 0, 1, "", 0, 1); - test("abcdefghij", 0, 1, "abcde", 0, 1); - test("abcdefghij", 0, 1, "abcde", 1, 0); - test("abcdefghij", 0, 1, "abcde", 2, -1); - test("abcdefghij", 0, 1, "abcde", 4, -3); - test("abcdefghij", 0, 1, "abcde", 5, -4); - test("abcdefghij", 0, 1, "abcdefghij", 0, 1); - test("abcdefghij", 0, 1, "abcdefghij", 1, 0); - test("abcdefghij", 0, 1, "abcdefghij", 5, -4); - test("abcdefghij", 0, 1, "abcdefghij", 9, -8); - test("abcdefghij", 0, 1, "abcdefghij", 10, -9); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 0); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, -9); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, -18); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 20, -19); - test("abcdefghij", 0, 5, "", 0, 5); - test("abcdefghij", 0, 5, "abcde", 0, 5); - test("abcdefghij", 0, 5, "abcde", 1, 4); - test("abcdefghij", 0, 5, "abcde", 2, 3); - test("abcdefghij", 0, 5, "abcde", 4, 1); - test("abcdefghij", 0, 5, "abcde", 5, 0); - test("abcdefghij", 0, 5, "abcdefghij", 0, 5); - test("abcdefghij", 0, 5, "abcdefghij", 1, 4); - test("abcdefghij", 0, 5, "abcdefghij", 5, 0); - test("abcdefghij", 0, 5, "abcdefghij", 9, -4); - test("abcdefghij", 0, 5, "abcdefghij", 10, -5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 4); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, -5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, -14); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 20, -15); - test("abcdefghij", 0, 9, "", 0, 9); - test("abcdefghij", 0, 9, "abcde", 0, 9); - test("abcdefghij", 0, 9, "abcde", 1, 8); - test("abcdefghij", 0, 9, "abcde", 2, 7); - test("abcdefghij", 0, 9, "abcde", 4, 5); - test("abcdefghij", 0, 9, "abcde", 5, 4); - test("abcdefghij", 0, 9, "abcdefghij", 0, 9); - test("abcdefghij", 0, 9, "abcdefghij", 1, 8); - test("abcdefghij", 0, 9, "abcdefghij", 5, 4); - test("abcdefghij", 0, 9, "abcdefghij", 9, 0); - test("abcdefghij", 0, 9, "abcdefghij", 10, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 8); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, -10); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 20, -11); - test("abcdefghij", 0, 10, "", 0, 10); - test("abcdefghij", 0, 10, "abcde", 0, 10); - test("abcdefghij", 0, 10, "abcde", 1, 9); - test("abcdefghij", 0, 10, "abcde", 2, 8); - test("abcdefghij", 0, 10, "abcde", 4, 6); - test("abcdefghij", 0, 10, "abcde", 5, 5); - test("abcdefghij", 0, 10, "abcdefghij", 0, 10); - test("abcdefghij", 0, 10, "abcdefghij", 1, 9); - test("abcdefghij", 0, 10, "abcdefghij", 5, 5); - test("abcdefghij", 0, 10, "abcdefghij", 9, 1); - test("abcdefghij", 0, 10, "abcdefghij", 10, 0); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 9); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 0); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, -9); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 20, -10); - test("abcdefghij", 0, 11, "", 0, 10); - test("abcdefghij", 0, 11, "abcde", 0, 10); - test("abcdefghij", 0, 11, "abcde", 1, 9); - test("abcdefghij", 0, 11, "abcde", 2, 8); -} - - -void test5() -{ - test("abcdefghij", 0, 11, "abcde", 4, 6); - test("abcdefghij", 0, 11, "abcde", 5, 5); - test("abcdefghij", 0, 11, "abcdefghij", 0, 10); - test("abcdefghij", 0, 11, "abcdefghij", 1, 9); - test("abcdefghij", 0, 11, "abcdefghij", 5, 5); - test("abcdefghij", 0, 11, "abcdefghij", 9, 1); - test("abcdefghij", 0, 11, "abcdefghij", 10, 0); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 9); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 0); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, -9); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 20, -10); - test("abcdefghij", 1, 0, "", 0, 0); - test("abcdefghij", 1, 0, "abcde", 0, 0); - test("abcdefghij", 1, 0, "abcde", 1, -1); - test("abcdefghij", 1, 0, "abcde", 2, -2); - test("abcdefghij", 1, 0, "abcde", 4, -4); - test("abcdefghij", 1, 0, "abcde", 5, -5); - test("abcdefghij", 1, 0, "abcdefghij", 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 1, -1); - test("abcdefghij", 1, 0, "abcdefghij", 5, -5); - test("abcdefghij", 1, 0, "abcdefghij", 9, -9); - test("abcdefghij", 1, 0, "abcdefghij", 10, -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghij", 1, 1, "", 0, 1); - test("abcdefghij", 1, 1, "abcde", 0, 1); - test("abcdefghij", 1, 1, "abcde", 1, 1); - test("abcdefghij", 1, 1, "abcde", 2, 1); - test("abcdefghij", 1, 1, "abcde", 4, 1); - test("abcdefghij", 1, 1, "abcde", 5, 1); - test("abcdefghij", 1, 1, "abcdefghij", 0, 1); - test("abcdefghij", 1, 1, "abcdefghij", 1, 1); - test("abcdefghij", 1, 1, "abcdefghij", 5, 1); - test("abcdefghij", 1, 1, "abcdefghij", 9, 1); - test("abcdefghij", 1, 1, "abcdefghij", 10, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghij", 1, 4, "", 0, 4); - test("abcdefghij", 1, 4, "abcde", 0, 4); - test("abcdefghij", 1, 4, "abcde", 1, 1); - test("abcdefghij", 1, 4, "abcde", 2, 1); - test("abcdefghij", 1, 4, "abcde", 4, 1); - test("abcdefghij", 1, 4, "abcde", 5, 1); - test("abcdefghij", 1, 4, "abcdefghij", 0, 4); - test("abcdefghij", 1, 4, "abcdefghij", 1, 1); - test("abcdefghij", 1, 4, "abcdefghij", 5, 1); - test("abcdefghij", 1, 4, "abcdefghij", 9, 1); - test("abcdefghij", 1, 4, "abcdefghij", 10, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghij", 1, 8, "", 0, 8); - test("abcdefghij", 1, 8, "abcde", 0, 8); - test("abcdefghij", 1, 8, "abcde", 1, 1); - test("abcdefghij", 1, 8, "abcde", 2, 1); - test("abcdefghij", 1, 8, "abcde", 4, 1); - test("abcdefghij", 1, 8, "abcde", 5, 1); - test("abcdefghij", 1, 8, "abcdefghij", 0, 8); - test("abcdefghij", 1, 8, "abcdefghij", 1, 1); - test("abcdefghij", 1, 8, "abcdefghij", 5, 1); - test("abcdefghij", 1, 8, "abcdefghij", 9, 1); - test("abcdefghij", 1, 8, "abcdefghij", 10, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghij", 1, 9, "", 0, 9); - test("abcdefghij", 1, 9, "abcde", 0, 9); - test("abcdefghij", 1, 9, "abcde", 1, 1); - test("abcdefghij", 1, 9, "abcde", 2, 1); - test("abcdefghij", 1, 9, "abcde", 4, 1); - test("abcdefghij", 1, 9, "abcde", 5, 1); - test("abcdefghij", 1, 9, "abcdefghij", 0, 9); - test("abcdefghij", 1, 9, "abcdefghij", 1, 1); - test("abcdefghij", 1, 9, "abcdefghij", 5, 1); - test("abcdefghij", 1, 9, "abcdefghij", 9, 1); - test("abcdefghij", 1, 9, "abcdefghij", 10, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghij", 1, 10, "", 0, 9); - test("abcdefghij", 1, 10, "abcde", 0, 9); - test("abcdefghij", 1, 10, "abcde", 1, 1); - test("abcdefghij", 1, 10, "abcde", 2, 1); - test("abcdefghij", 1, 10, "abcde", 4, 1); - test("abcdefghij", 1, 10, "abcde", 5, 1); - test("abcdefghij", 1, 10, "abcdefghij", 0, 9); - test("abcdefghij", 1, 10, "abcdefghij", 1, 1); -} - - -void test6() -{ - test("abcdefghij", 1, 10, "abcdefghij", 5, 1); - test("abcdefghij", 1, 10, "abcdefghij", 9, 1); - test("abcdefghij", 1, 10, "abcdefghij", 10, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghij", 5, 0, "", 0, 0); - test("abcdefghij", 5, 0, "abcde", 0, 0); - test("abcdefghij", 5, 0, "abcde", 1, -1); - test("abcdefghij", 5, 0, "abcde", 2, -2); - test("abcdefghij", 5, 0, "abcde", 4, -4); - test("abcdefghij", 5, 0, "abcde", 5, -5); - test("abcdefghij", 5, 0, "abcdefghij", 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 1, -1); - test("abcdefghij", 5, 0, "abcdefghij", 5, -5); - test("abcdefghij", 5, 0, "abcdefghij", 9, -9); - test("abcdefghij", 5, 0, "abcdefghij", 10, -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghij", 5, 1, "", 0, 1); - test("abcdefghij", 5, 1, "abcde", 0, 1); - test("abcdefghij", 5, 1, "abcde", 1, 5); - test("abcdefghij", 5, 1, "abcde", 2, 5); - test("abcdefghij", 5, 1, "abcde", 4, 5); - test("abcdefghij", 5, 1, "abcde", 5, 5); - test("abcdefghij", 5, 1, "abcdefghij", 0, 1); - test("abcdefghij", 5, 1, "abcdefghij", 1, 5); - test("abcdefghij", 5, 1, "abcdefghij", 5, 5); - test("abcdefghij", 5, 1, "abcdefghij", 9, 5); - test("abcdefghij", 5, 1, "abcdefghij", 10, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 20, 5); - test("abcdefghij", 5, 2, "", 0, 2); - test("abcdefghij", 5, 2, "abcde", 0, 2); - test("abcdefghij", 5, 2, "abcde", 1, 5); - test("abcdefghij", 5, 2, "abcde", 2, 5); - test("abcdefghij", 5, 2, "abcde", 4, 5); - test("abcdefghij", 5, 2, "abcde", 5, 5); - test("abcdefghij", 5, 2, "abcdefghij", 0, 2); - test("abcdefghij", 5, 2, "abcdefghij", 1, 5); - test("abcdefghij", 5, 2, "abcdefghij", 5, 5); - test("abcdefghij", 5, 2, "abcdefghij", 9, 5); - test("abcdefghij", 5, 2, "abcdefghij", 10, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 20, 5); - test("abcdefghij", 5, 4, "", 0, 4); - test("abcdefghij", 5, 4, "abcde", 0, 4); - test("abcdefghij", 5, 4, "abcde", 1, 5); - test("abcdefghij", 5, 4, "abcde", 2, 5); - test("abcdefghij", 5, 4, "abcde", 4, 5); - test("abcdefghij", 5, 4, "abcde", 5, 5); - test("abcdefghij", 5, 4, "abcdefghij", 0, 4); - test("abcdefghij", 5, 4, "abcdefghij", 1, 5); - test("abcdefghij", 5, 4, "abcdefghij", 5, 5); - test("abcdefghij", 5, 4, "abcdefghij", 9, 5); - test("abcdefghij", 5, 4, "abcdefghij", 10, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 20, 5); - test("abcdefghij", 5, 5, "", 0, 5); - test("abcdefghij", 5, 5, "abcde", 0, 5); - test("abcdefghij", 5, 5, "abcde", 1, 5); - test("abcdefghij", 5, 5, "abcde", 2, 5); - test("abcdefghij", 5, 5, "abcde", 4, 5); - test("abcdefghij", 5, 5, "abcde", 5, 5); - test("abcdefghij", 5, 5, "abcdefghij", 0, 5); - test("abcdefghij", 5, 5, "abcdefghij", 1, 5); - test("abcdefghij", 5, 5, "abcdefghij", 5, 5); - test("abcdefghij", 5, 5, "abcdefghij", 9, 5); - test("abcdefghij", 5, 5, "abcdefghij", 10, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 20, 5); - test("abcdefghij", 5, 6, "", 0, 5); - test("abcdefghij", 5, 6, "abcde", 0, 5); - test("abcdefghij", 5, 6, "abcde", 1, 5); - test("abcdefghij", 5, 6, "abcde", 2, 5); - test("abcdefghij", 5, 6, "abcde", 4, 5); - test("abcdefghij", 5, 6, "abcde", 5, 5); - test("abcdefghij", 5, 6, "abcdefghij", 0, 5); - test("abcdefghij", 5, 6, "abcdefghij", 1, 5); - test("abcdefghij", 5, 6, "abcdefghij", 5, 5); - test("abcdefghij", 5, 6, "abcdefghij", 9, 5); - test("abcdefghij", 5, 6, "abcdefghij", 10, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 5); -} - - -void test7() -{ - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 20, 5); - test("abcdefghij", 9, 0, "", 0, 0); - test("abcdefghij", 9, 0, "abcde", 0, 0); - test("abcdefghij", 9, 0, "abcde", 1, -1); - test("abcdefghij", 9, 0, "abcde", 2, -2); - test("abcdefghij", 9, 0, "abcde", 4, -4); - test("abcdefghij", 9, 0, "abcde", 5, -5); - test("abcdefghij", 9, 0, "abcdefghij", 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 1, -1); - test("abcdefghij", 9, 0, "abcdefghij", 5, -5); - test("abcdefghij", 9, 0, "abcdefghij", 9, -9); - test("abcdefghij", 9, 0, "abcdefghij", 10, -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghij", 9, 1, "", 0, 1); - test("abcdefghij", 9, 1, "abcde", 0, 1); - test("abcdefghij", 9, 1, "abcde", 1, 9); - test("abcdefghij", 9, 1, "abcde", 2, 9); - test("abcdefghij", 9, 1, "abcde", 4, 9); - test("abcdefghij", 9, 1, "abcde", 5, 9); - test("abcdefghij", 9, 1, "abcdefghij", 0, 1); - test("abcdefghij", 9, 1, "abcdefghij", 1, 9); - test("abcdefghij", 9, 1, "abcdefghij", 5, 9); - test("abcdefghij", 9, 1, "abcdefghij", 9, 9); - test("abcdefghij", 9, 1, "abcdefghij", 10, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 20, 9); - test("abcdefghij", 9, 2, "", 0, 1); - test("abcdefghij", 9, 2, "abcde", 0, 1); - test("abcdefghij", 9, 2, "abcde", 1, 9); - test("abcdefghij", 9, 2, "abcde", 2, 9); - test("abcdefghij", 9, 2, "abcde", 4, 9); - test("abcdefghij", 9, 2, "abcde", 5, 9); - test("abcdefghij", 9, 2, "abcdefghij", 0, 1); - test("abcdefghij", 9, 2, "abcdefghij", 1, 9); - test("abcdefghij", 9, 2, "abcdefghij", 5, 9); - test("abcdefghij", 9, 2, "abcdefghij", 9, 9); - test("abcdefghij", 9, 2, "abcdefghij", 10, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 20, 9); - test("abcdefghij", 10, 0, "", 0, 0); - test("abcdefghij", 10, 0, "abcde", 0, 0); - test("abcdefghij", 10, 0, "abcde", 1, -1); - test("abcdefghij", 10, 0, "abcde", 2, -2); - test("abcdefghij", 10, 0, "abcde", 4, -4); - test("abcdefghij", 10, 0, "abcde", 5, -5); - test("abcdefghij", 10, 0, "abcdefghij", 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 1, -1); - test("abcdefghij", 10, 0, "abcdefghij", 5, -5); - test("abcdefghij", 10, 0, "abcdefghij", 9, -9); - test("abcdefghij", 10, 0, "abcdefghij", 10, -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghij", 10, 1, "", 0, 0); - test("abcdefghij", 10, 1, "abcde", 0, 0); - test("abcdefghij", 10, 1, "abcde", 1, -1); - test("abcdefghij", 10, 1, "abcde", 2, -2); - test("abcdefghij", 10, 1, "abcde", 4, -4); - test("abcdefghij", 10, 1, "abcde", 5, -5); - test("abcdefghij", 10, 1, "abcdefghij", 0, 0); - test("abcdefghij", 10, 1, "abcdefghij", 1, -1); - test("abcdefghij", 10, 1, "abcdefghij", 5, -5); - test("abcdefghij", 10, 1, "abcdefghij", 9, -9); - test("abcdefghij", 10, 1, "abcdefghij", 10, -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghij", 11, 0, "", 0, 0); - test("abcdefghij", 11, 0, "abcde", 0, 0); - test("abcdefghij", 11, 0, "abcde", 1, 0); - test("abcdefghij", 11, 0, "abcde", 2, 0); - test("abcdefghij", 11, 0, "abcde", 4, 0); - test("abcdefghij", 11, 0, "abcde", 5, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 0); - test("abcdefghij", 11, 0, "abcdefghij", 9, 0); - test("abcdefghij", 11, 0, "abcdefghij", 10, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 20, 0); -} - -void test8() -{ - test("abcdefghijklmnopqrst", 0, 0, "", 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, -2); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, -4); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 5, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, -9); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 10, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghijklmnopqrst", 0, 1, "", 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, -3); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 5, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, -8); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 10, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, -18); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 20, -19); - test("abcdefghijklmnopqrst", 0, 10, "", 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 9); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 8); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 6); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 5, 5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 10, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, -9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 20, -10); - test("abcdefghijklmnopqrst", 0, 19, "", 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 18); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 17); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 15); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 5, 14); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 18); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 14); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 10, 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 18); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 0); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 20, -1); - test("abcdefghijklmnopqrst", 0, 20, "", 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 19); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 18); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 16); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 5, 15); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 19); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 15); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 11); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 19); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 20, 0); - test("abcdefghijklmnopqrst", 0, 21, "", 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 19); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 18); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 16); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 5, 15); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 19); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 15); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 11); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 19); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 20, 0); - test("abcdefghijklmnopqrst", 1, 0, "", 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, -2); -} - - -void test9() -{ - test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, -4); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 5, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, -9); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 10, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghijklmnopqrst", 1, 1, "", 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 5, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 10, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghijklmnopqrst", 1, 9, "", 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 5, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 10, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghijklmnopqrst", 1, 18, "", 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 5, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 10, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghijklmnopqrst", 1, 19, "", 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 5, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 10, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghijklmnopqrst", 1, 20, "", 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 5, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 10, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 20, 1); - test("abcdefghijklmnopqrst", 10, 0, "", 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, -2); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, -4); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 5, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, -1); -} - - -void test10() -{ - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, -9); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghijklmnopqrst", 10, 1, "", 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 5, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 20, 10); - test("abcdefghijklmnopqrst", 10, 5, "", 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 5, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 20, 10); - test("abcdefghijklmnopqrst", 10, 9, "", 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 5, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 20, 10); - test("abcdefghijklmnopqrst", 10, 10, "", 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 5, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 20, 10); - test("abcdefghijklmnopqrst", 10, 11, "", 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 5, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 20, 10); - test("abcdefghijklmnopqrst", 19, 0, "", 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, -2); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, -4); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 5, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, -9); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 10, -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 0); -} - - -void test11() -{ - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghijklmnopqrst", 19, 1, "", 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 5, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 10, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 20, 19); - test("abcdefghijklmnopqrst", 19, 2, "", 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 5, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 10, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 20, 19); - test("abcdefghijklmnopqrst", 20, 0, "", 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, -2); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, -4); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 5, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, -9); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 10, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghijklmnopqrst", 20, 1, "", 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, -2); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, -4); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 5, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, -9); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 10, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, -19); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 20, -20); - test("abcdefghijklmnopqrst", 21, 0, "", 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 10, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 20, 0); - } - - -int main () { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - - { - test("", 0, 0, "abcde", 0, 0); - test("", 0, 0, "abcde", 1, -1); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, -10); - } - - { - test(L"", 0, 0, L"abcde", 0, 0); - test(L"", 0, 0, L"abcde", 1, -1); - test(L"abcdefghijklmnopqrst", 21, 0, L"abcde", 0, 0); - test(L"abcdefghijklmnopqrst", 21, 0, L"abcde", 1, 0); - test(L"abcdefghijklmnopqrst", 10, 0, L"abcdefghij", 10, -10); - } - -#if TEST_STD_VER >= 11 - { - test(U"", 0, 0, U"abcde", 0, 0); - test(U"", 0, 0, U"abcde", 1, -1); - test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 0, 0); - test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 1, 0); - test(U"abcdefghijklmnopqrst", 10, 0, U"abcdefghij", 10, -10); - } - - { - test(U"", 0, 0, U"abcde", 0, 0); - test(U"", 0, 0, U"abcde", 1, -1); - test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 0, 0); - test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 1, 0); - test(U"abcdefghijklmnopqrst", 10, 0, U"abcdefghij", 10, -10); - } -#endif - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1; - constexpr SV sv2 { "abcdefghijklmnopqrst", 21 }; - static_assert ( sv1.compare(0, 0, "abcde", 0) == 0, "" ); - static_assert ( sv1.compare(0, 0, "abcde", 1) == -1, "" ); - static_assert ( sv2.compare(0, 0, "abcde", 1, 0) == 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp deleted file mode 100644 index 5d5ccc5b5..000000000 --- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp +++ /dev/null @@ -1,5849 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr int compare(size_type pos1, size_type n1, basic_string_view str, -// size_type pos2, size_type n2) const; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); } - -template -void test1 ( std::experimental::basic_string_view sv1, size_t pos1, size_t n1, - std::experimental::basic_string_view sv2, size_t pos2, size_t n2, - int expected ) { - - if (pos1 > sv1.size() || pos2 > sv2.size()) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - sv1.compare(pos1, n1, sv2, pos2, n2); - assert(false); - } catch (const std::out_of_range&) { - } catch (...) { - assert(false); - } -#endif - } else { - assert (sign( sv1.compare(pos1, n1, sv2, pos2, n2)) == sign(expected)); - } -} - - -template -void test ( const CharT *s1, size_t pos1, size_t n1, - const CharT *s2, size_t pos2, size_t n2, - int expected ) { - typedef std::experimental::basic_string_view string_view_t; - - string_view_t sv1 ( s1 ); - string_view_t sv2 ( s2 ); - test1(sv1, pos1, n1, sv2, pos2, n2, expected); -} - -void test0() -{ - test("", 0, 0, "", 0, 0, 0); - test("", 0, 0, "", 0, 1, 0); - test("", 0, 0, "", 1, 0, 0); - test("", 0, 0, "abcde", 0, 0, 0); - test("", 0, 0, "abcde", 0, 1, -1); - test("", 0, 0, "abcde", 0, 2, -2); - test("", 0, 0, "abcde", 0, 4, -4); - test("", 0, 0, "abcde", 0, 5, -5); - test("", 0, 0, "abcde", 0, 6, -5); - test("", 0, 0, "abcde", 1, 0, 0); - test("", 0, 0, "abcde", 1, 1, -1); - test("", 0, 0, "abcde", 1, 2, -2); - test("", 0, 0, "abcde", 1, 3, -3); - test("", 0, 0, "abcde", 1, 4, -4); - test("", 0, 0, "abcde", 1, 5, -4); - test("", 0, 0, "abcde", 2, 0, 0); - test("", 0, 0, "abcde", 2, 1, -1); - test("", 0, 0, "abcde", 2, 2, -2); - test("", 0, 0, "abcde", 2, 3, -3); - test("", 0, 0, "abcde", 2, 4, -3); - test("", 0, 0, "abcde", 4, 0, 0); - test("", 0, 0, "abcde", 4, 1, -1); - test("", 0, 0, "abcde", 4, 2, -1); - test("", 0, 0, "abcde", 5, 0, 0); - test("", 0, 0, "abcde", 5, 1, 0); - test("", 0, 0, "abcde", 6, 0, 0); - test("", 0, 0, "abcdefghij", 0, 0, 0); - test("", 0, 0, "abcdefghij", 0, 1, -1); - test("", 0, 0, "abcdefghij", 0, 5, -5); - test("", 0, 0, "abcdefghij", 0, 9, -9); - test("", 0, 0, "abcdefghij", 0, 10, -10); - test("", 0, 0, "abcdefghij", 0, 11, -10); - test("", 0, 0, "abcdefghij", 1, 0, 0); - test("", 0, 0, "abcdefghij", 1, 1, -1); - test("", 0, 0, "abcdefghij", 1, 4, -4); - test("", 0, 0, "abcdefghij", 1, 8, -8); - test("", 0, 0, "abcdefghij", 1, 9, -9); - test("", 0, 0, "abcdefghij", 1, 10, -9); - test("", 0, 0, "abcdefghij", 5, 0, 0); - test("", 0, 0, "abcdefghij", 5, 1, -1); - test("", 0, 0, "abcdefghij", 5, 2, -2); - test("", 0, 0, "abcdefghij", 5, 4, -4); - test("", 0, 0, "abcdefghij", 5, 5, -5); - test("", 0, 0, "abcdefghij", 5, 6, -5); - test("", 0, 0, "abcdefghij", 9, 0, 0); - test("", 0, 0, "abcdefghij", 9, 1, -1); - test("", 0, 0, "abcdefghij", 9, 2, -1); - test("", 0, 0, "abcdefghij", 10, 0, 0); - test("", 0, 0, "abcdefghij", 10, 1, 0); - test("", 0, 0, "abcdefghij", 11, 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("", 0, 1, "", 0, 0, 0); - test("", 0, 1, "", 0, 1, 0); - test("", 0, 1, "", 1, 0, 0); - test("", 0, 1, "abcde", 0, 0, 0); - test("", 0, 1, "abcde", 0, 1, -1); - test("", 0, 1, "abcde", 0, 2, -2); - test("", 0, 1, "abcde", 0, 4, -4); - test("", 0, 1, "abcde", 0, 5, -5); - test("", 0, 1, "abcde", 0, 6, -5); - test("", 0, 1, "abcde", 1, 0, 0); - test("", 0, 1, "abcde", 1, 1, -1); - test("", 0, 1, "abcde", 1, 2, -2); - test("", 0, 1, "abcde", 1, 3, -3); - test("", 0, 1, "abcde", 1, 4, -4); - test("", 0, 1, "abcde", 1, 5, -4); - test("", 0, 1, "abcde", 2, 0, 0); - test("", 0, 1, "abcde", 2, 1, -1); - test("", 0, 1, "abcde", 2, 2, -2); - test("", 0, 1, "abcde", 2, 3, -3); - test("", 0, 1, "abcde", 2, 4, -3); - test("", 0, 1, "abcde", 4, 0, 0); - test("", 0, 1, "abcde", 4, 1, -1); - test("", 0, 1, "abcde", 4, 2, -1); - test("", 0, 1, "abcde", 5, 0, 0); - test("", 0, 1, "abcde", 5, 1, 0); - test("", 0, 1, "abcde", 6, 0, 0); -} - -void test1() -{ - test("", 0, 1, "abcdefghij", 0, 0, 0); - test("", 0, 1, "abcdefghij", 0, 1, -1); - test("", 0, 1, "abcdefghij", 0, 5, -5); - test("", 0, 1, "abcdefghij", 0, 9, -9); - test("", 0, 1, "abcdefghij", 0, 10, -10); - test("", 0, 1, "abcdefghij", 0, 11, -10); - test("", 0, 1, "abcdefghij", 1, 0, 0); - test("", 0, 1, "abcdefghij", 1, 1, -1); - test("", 0, 1, "abcdefghij", 1, 4, -4); - test("", 0, 1, "abcdefghij", 1, 8, -8); - test("", 0, 1, "abcdefghij", 1, 9, -9); - test("", 0, 1, "abcdefghij", 1, 10, -9); - test("", 0, 1, "abcdefghij", 5, 0, 0); - test("", 0, 1, "abcdefghij", 5, 1, -1); - test("", 0, 1, "abcdefghij", 5, 2, -2); - test("", 0, 1, "abcdefghij", 5, 4, -4); - test("", 0, 1, "abcdefghij", 5, 5, -5); - test("", 0, 1, "abcdefghij", 5, 6, -5); - test("", 0, 1, "abcdefghij", 9, 0, 0); - test("", 0, 1, "abcdefghij", 9, 1, -1); - test("", 0, 1, "abcdefghij", 9, 2, -1); - test("", 0, 1, "abcdefghij", 10, 0, 0); - test("", 0, 1, "abcdefghij", 10, 1, 0); - test("", 0, 1, "abcdefghij", 11, 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 1, -1); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 10, -10); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 19, -19); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 20, -20); - test("", 0, 1, "abcdefghijklmnopqrst", 0, 21, -20); - test("", 0, 1, "abcdefghijklmnopqrst", 1, 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("", 0, 1, "abcdefghijklmnopqrst", 1, 9, -9); - test("", 0, 1, "abcdefghijklmnopqrst", 1, 18, -18); - test("", 0, 1, "abcdefghijklmnopqrst", 1, 19, -19); - test("", 0, 1, "abcdefghijklmnopqrst", 1, 20, -19); - test("", 0, 1, "abcdefghijklmnopqrst", 10, 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 10, 1, -1); - test("", 0, 1, "abcdefghijklmnopqrst", 10, 5, -5); - test("", 0, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("", 0, 1, "abcdefghijklmnopqrst", 19, 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 19, 1, -1); - test("", 0, 1, "abcdefghijklmnopqrst", 19, 2, -1); - test("", 0, 1, "abcdefghijklmnopqrst", 20, 0, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 20, 1, 0); - test("", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("", 1, 0, "", 0, 0, 0); - test("", 1, 0, "", 0, 1, 0); - test("", 1, 0, "", 1, 0, 0); - test("", 1, 0, "abcde", 0, 0, 0); - test("", 1, 0, "abcde", 0, 1, 0); - test("", 1, 0, "abcde", 0, 2, 0); - test("", 1, 0, "abcde", 0, 4, 0); - test("", 1, 0, "abcde", 0, 5, 0); - test("", 1, 0, "abcde", 0, 6, 0); - test("", 1, 0, "abcde", 1, 0, 0); - test("", 1, 0, "abcde", 1, 1, 0); - test("", 1, 0, "abcde", 1, 2, 0); - test("", 1, 0, "abcde", 1, 3, 0); - test("", 1, 0, "abcde", 1, 4, 0); - test("", 1, 0, "abcde", 1, 5, 0); - test("", 1, 0, "abcde", 2, 0, 0); - test("", 1, 0, "abcde", 2, 1, 0); - test("", 1, 0, "abcde", 2, 2, 0); - test("", 1, 0, "abcde", 2, 3, 0); - test("", 1, 0, "abcde", 2, 4, 0); - test("", 1, 0, "abcde", 4, 0, 0); - test("", 1, 0, "abcde", 4, 1, 0); - test("", 1, 0, "abcde", 4, 2, 0); - test("", 1, 0, "abcde", 5, 0, 0); - test("", 1, 0, "abcde", 5, 1, 0); - test("", 1, 0, "abcde", 6, 0, 0); - test("", 1, 0, "abcdefghij", 0, 0, 0); - test("", 1, 0, "abcdefghij", 0, 1, 0); - test("", 1, 0, "abcdefghij", 0, 5, 0); - test("", 1, 0, "abcdefghij", 0, 9, 0); - test("", 1, 0, "abcdefghij", 0, 10, 0); - test("", 1, 0, "abcdefghij", 0, 11, 0); - test("", 1, 0, "abcdefghij", 1, 0, 0); - test("", 1, 0, "abcdefghij", 1, 1, 0); - test("", 1, 0, "abcdefghij", 1, 4, 0); - test("", 1, 0, "abcdefghij", 1, 8, 0); - test("", 1, 0, "abcdefghij", 1, 9, 0); - test("", 1, 0, "abcdefghij", 1, 10, 0); - test("", 1, 0, "abcdefghij", 5, 0, 0); - test("", 1, 0, "abcdefghij", 5, 1, 0); - test("", 1, 0, "abcdefghij", 5, 2, 0); - test("", 1, 0, "abcdefghij", 5, 4, 0); - test("", 1, 0, "abcdefghij", 5, 5, 0); - test("", 1, 0, "abcdefghij", 5, 6, 0); - test("", 1, 0, "abcdefghij", 9, 0, 0); - test("", 1, 0, "abcdefghij", 9, 1, 0); - test("", 1, 0, "abcdefghij", 9, 2, 0); - test("", 1, 0, "abcdefghij", 10, 0, 0); - test("", 1, 0, "abcdefghij", 10, 1, 0); - test("", 1, 0, "abcdefghij", 11, 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0, 1, 0); -} - -void test2() -{ - test("", 1, 0, "abcdefghijklmnopqrst", 0, 10, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0, 19, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0, 20, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 0, 21, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 1, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 9, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 18, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 19, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 1, 20, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 1, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 5, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 9, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 10, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 10, 11, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 19, 1, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 19, 2, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 0, 0, "", 0, 0, 0); - test("abcde", 0, 0, "", 0, 1, 0); - test("abcde", 0, 0, "", 1, 0, 0); - test("abcde", 0, 0, "abcde", 0, 0, 0); - test("abcde", 0, 0, "abcde", 0, 1, -1); - test("abcde", 0, 0, "abcde", 0, 2, -2); - test("abcde", 0, 0, "abcde", 0, 4, -4); - test("abcde", 0, 0, "abcde", 0, 5, -5); - test("abcde", 0, 0, "abcde", 0, 6, -5); - test("abcde", 0, 0, "abcde", 1, 0, 0); - test("abcde", 0, 0, "abcde", 1, 1, -1); - test("abcde", 0, 0, "abcde", 1, 2, -2); - test("abcde", 0, 0, "abcde", 1, 3, -3); - test("abcde", 0, 0, "abcde", 1, 4, -4); - test("abcde", 0, 0, "abcde", 1, 5, -4); - test("abcde", 0, 0, "abcde", 2, 0, 0); - test("abcde", 0, 0, "abcde", 2, 1, -1); - test("abcde", 0, 0, "abcde", 2, 2, -2); - test("abcde", 0, 0, "abcde", 2, 3, -3); - test("abcde", 0, 0, "abcde", 2, 4, -3); - test("abcde", 0, 0, "abcde", 4, 0, 0); - test("abcde", 0, 0, "abcde", 4, 1, -1); - test("abcde", 0, 0, "abcde", 4, 2, -1); - test("abcde", 0, 0, "abcde", 5, 0, 0); - test("abcde", 0, 0, "abcde", 5, 1, 0); - test("abcde", 0, 0, "abcde", 6, 0, 0); - test("abcde", 0, 0, "abcdefghij", 0, 0, 0); - test("abcde", 0, 0, "abcdefghij", 0, 1, -1); - test("abcde", 0, 0, "abcdefghij", 0, 5, -5); - test("abcde", 0, 0, "abcdefghij", 0, 9, -9); - test("abcde", 0, 0, "abcdefghij", 0, 10, -10); - test("abcde", 0, 0, "abcdefghij", 0, 11, -10); - test("abcde", 0, 0, "abcdefghij", 1, 0, 0); - test("abcde", 0, 0, "abcdefghij", 1, 1, -1); - test("abcde", 0, 0, "abcdefghij", 1, 4, -4); - test("abcde", 0, 0, "abcdefghij", 1, 8, -8); - test("abcde", 0, 0, "abcdefghij", 1, 9, -9); - test("abcde", 0, 0, "abcdefghij", 1, 10, -9); - test("abcde", 0, 0, "abcdefghij", 5, 0, 0); - test("abcde", 0, 0, "abcdefghij", 5, 1, -1); - test("abcde", 0, 0, "abcdefghij", 5, 2, -2); - test("abcde", 0, 0, "abcdefghij", 5, 4, -4); - test("abcde", 0, 0, "abcdefghij", 5, 5, -5); - test("abcde", 0, 0, "abcdefghij", 5, 6, -5); - test("abcde", 0, 0, "abcdefghij", 9, 0, 0); - test("abcde", 0, 0, "abcdefghij", 9, 1, -1); - test("abcde", 0, 0, "abcdefghij", 9, 2, -1); - test("abcde", 0, 0, "abcdefghij", 10, 0, 0); - test("abcde", 0, 0, "abcdefghij", 10, 1, 0); - test("abcde", 0, 0, "abcdefghij", 11, 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 0, 1, "", 0, 0, 1); - test("abcde", 0, 1, "", 0, 1, 1); - test("abcde", 0, 1, "", 1, 0, 0); - test("abcde", 0, 1, "abcde", 0, 0, 1); -} - -void test3() -{ - test("abcde", 0, 1, "abcde", 0, 1, 0); - test("abcde", 0, 1, "abcde", 0, 2, -1); - test("abcde", 0, 1, "abcde", 0, 4, -3); - test("abcde", 0, 1, "abcde", 0, 5, -4); - test("abcde", 0, 1, "abcde", 0, 6, -4); - test("abcde", 0, 1, "abcde", 1, 0, 1); - test("abcde", 0, 1, "abcde", 1, 1, -1); - test("abcde", 0, 1, "abcde", 1, 2, -1); - test("abcde", 0, 1, "abcde", 1, 3, -1); - test("abcde", 0, 1, "abcde", 1, 4, -1); - test("abcde", 0, 1, "abcde", 1, 5, -1); - test("abcde", 0, 1, "abcde", 2, 0, 1); - test("abcde", 0, 1, "abcde", 2, 1, -2); - test("abcde", 0, 1, "abcde", 2, 2, -2); - test("abcde", 0, 1, "abcde", 2, 3, -2); - test("abcde", 0, 1, "abcde", 2, 4, -2); - test("abcde", 0, 1, "abcde", 4, 0, 1); - test("abcde", 0, 1, "abcde", 4, 1, -4); - test("abcde", 0, 1, "abcde", 4, 2, -4); - test("abcde", 0, 1, "abcde", 5, 0, 1); - test("abcde", 0, 1, "abcde", 5, 1, 1); - test("abcde", 0, 1, "abcde", 6, 0, 0); - test("abcde", 0, 1, "abcdefghij", 0, 0, 1); - test("abcde", 0, 1, "abcdefghij", 0, 1, 0); - test("abcde", 0, 1, "abcdefghij", 0, 5, -4); - test("abcde", 0, 1, "abcdefghij", 0, 9, -8); - test("abcde", 0, 1, "abcdefghij", 0, 10, -9); - test("abcde", 0, 1, "abcdefghij", 0, 11, -9); - test("abcde", 0, 1, "abcdefghij", 1, 0, 1); - test("abcde", 0, 1, "abcdefghij", 1, 1, -1); - test("abcde", 0, 1, "abcdefghij", 1, 4, -1); - test("abcde", 0, 1, "abcdefghij", 1, 8, -1); - test("abcde", 0, 1, "abcdefghij", 1, 9, -1); - test("abcde", 0, 1, "abcdefghij", 1, 10, -1); - test("abcde", 0, 1, "abcdefghij", 5, 0, 1); - test("abcde", 0, 1, "abcdefghij", 5, 1, -5); - test("abcde", 0, 1, "abcdefghij", 5, 2, -5); - test("abcde", 0, 1, "abcdefghij", 5, 4, -5); - test("abcde", 0, 1, "abcdefghij", 5, 5, -5); - test("abcde", 0, 1, "abcdefghij", 5, 6, -5); - test("abcde", 0, 1, "abcdefghij", 9, 0, 1); - test("abcde", 0, 1, "abcdefghij", 9, 1, -9); - test("abcde", 0, 1, "abcdefghij", 9, 2, -9); - test("abcde", 0, 1, "abcdefghij", 10, 0, 1); - test("abcde", 0, 1, "abcdefghij", 10, 1, 1); - test("abcde", 0, 1, "abcdefghij", 11, 0, 0); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 1, 0); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 10, -9); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 19, -18); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 20, -19); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 21, -19); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcde", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 0, 2, "", 0, 0, 2); - test("abcde", 0, 2, "", 0, 1, 2); - test("abcde", 0, 2, "", 1, 0, 0); - test("abcde", 0, 2, "abcde", 0, 0, 2); - test("abcde", 0, 2, "abcde", 0, 1, 1); - test("abcde", 0, 2, "abcde", 0, 2, 0); - test("abcde", 0, 2, "abcde", 0, 4, -2); - test("abcde", 0, 2, "abcde", 0, 5, -3); - test("abcde", 0, 2, "abcde", 0, 6, -3); - test("abcde", 0, 2, "abcde", 1, 0, 2); - test("abcde", 0, 2, "abcde", 1, 1, -1); - test("abcde", 0, 2, "abcde", 1, 2, -1); - test("abcde", 0, 2, "abcde", 1, 3, -1); - test("abcde", 0, 2, "abcde", 1, 4, -1); - test("abcde", 0, 2, "abcde", 1, 5, -1); - test("abcde", 0, 2, "abcde", 2, 0, 2); - test("abcde", 0, 2, "abcde", 2, 1, -2); - test("abcde", 0, 2, "abcde", 2, 2, -2); - test("abcde", 0, 2, "abcde", 2, 3, -2); - test("abcde", 0, 2, "abcde", 2, 4, -2); - test("abcde", 0, 2, "abcde", 4, 0, 2); - test("abcde", 0, 2, "abcde", 4, 1, -4); - test("abcde", 0, 2, "abcde", 4, 2, -4); - test("abcde", 0, 2, "abcde", 5, 0, 2); - test("abcde", 0, 2, "abcde", 5, 1, 2); - test("abcde", 0, 2, "abcde", 6, 0, 0); - test("abcde", 0, 2, "abcdefghij", 0, 0, 2); - test("abcde", 0, 2, "abcdefghij", 0, 1, 1); - test("abcde", 0, 2, "abcdefghij", 0, 5, -3); - test("abcde", 0, 2, "abcdefghij", 0, 9, -7); -} - -void test4() -{ - test("abcde", 0, 2, "abcdefghij", 0, 10, -8); - test("abcde", 0, 2, "abcdefghij", 0, 11, -8); - test("abcde", 0, 2, "abcdefghij", 1, 0, 2); - test("abcde", 0, 2, "abcdefghij", 1, 1, -1); - test("abcde", 0, 2, "abcdefghij", 1, 4, -1); - test("abcde", 0, 2, "abcdefghij", 1, 8, -1); - test("abcde", 0, 2, "abcdefghij", 1, 9, -1); - test("abcde", 0, 2, "abcdefghij", 1, 10, -1); - test("abcde", 0, 2, "abcdefghij", 5, 0, 2); - test("abcde", 0, 2, "abcdefghij", 5, 1, -5); - test("abcde", 0, 2, "abcdefghij", 5, 2, -5); - test("abcde", 0, 2, "abcdefghij", 5, 4, -5); - test("abcde", 0, 2, "abcdefghij", 5, 5, -5); - test("abcde", 0, 2, "abcdefghij", 5, 6, -5); - test("abcde", 0, 2, "abcdefghij", 9, 0, 2); - test("abcde", 0, 2, "abcdefghij", 9, 1, -9); - test("abcde", 0, 2, "abcdefghij", 9, 2, -9); - test("abcde", 0, 2, "abcdefghij", 10, 0, 2); - test("abcde", 0, 2, "abcdefghij", 10, 1, 2); - test("abcde", 0, 2, "abcdefghij", 11, 0, 0); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 0, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 10, -8); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 19, -17); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 20, -18); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 21, -18); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 0, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 0, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, 0, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 20, 0, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 20, 1, 2); - test("abcde", 0, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 0, 4, "", 0, 0, 4); - test("abcde", 0, 4, "", 0, 1, 4); - test("abcde", 0, 4, "", 1, 0, 0); - test("abcde", 0, 4, "abcde", 0, 0, 4); - test("abcde", 0, 4, "abcde", 0, 1, 3); - test("abcde", 0, 4, "abcde", 0, 2, 2); - test("abcde", 0, 4, "abcde", 0, 4, 0); - test("abcde", 0, 4, "abcde", 0, 5, -1); - test("abcde", 0, 4, "abcde", 0, 6, -1); - test("abcde", 0, 4, "abcde", 1, 0, 4); - test("abcde", 0, 4, "abcde", 1, 1, -1); - test("abcde", 0, 4, "abcde", 1, 2, -1); - test("abcde", 0, 4, "abcde", 1, 3, -1); - test("abcde", 0, 4, "abcde", 1, 4, -1); - test("abcde", 0, 4, "abcde", 1, 5, -1); - test("abcde", 0, 4, "abcde", 2, 0, 4); - test("abcde", 0, 4, "abcde", 2, 1, -2); - test("abcde", 0, 4, "abcde", 2, 2, -2); - test("abcde", 0, 4, "abcde", 2, 3, -2); - test("abcde", 0, 4, "abcde", 2, 4, -2); - test("abcde", 0, 4, "abcde", 4, 0, 4); - test("abcde", 0, 4, "abcde", 4, 1, -4); - test("abcde", 0, 4, "abcde", 4, 2, -4); - test("abcde", 0, 4, "abcde", 5, 0, 4); - test("abcde", 0, 4, "abcde", 5, 1, 4); - test("abcde", 0, 4, "abcde", 6, 0, 0); - test("abcde", 0, 4, "abcdefghij", 0, 0, 4); - test("abcde", 0, 4, "abcdefghij", 0, 1, 3); - test("abcde", 0, 4, "abcdefghij", 0, 5, -1); - test("abcde", 0, 4, "abcdefghij", 0, 9, -5); - test("abcde", 0, 4, "abcdefghij", 0, 10, -6); - test("abcde", 0, 4, "abcdefghij", 0, 11, -6); - test("abcde", 0, 4, "abcdefghij", 1, 0, 4); - test("abcde", 0, 4, "abcdefghij", 1, 1, -1); - test("abcde", 0, 4, "abcdefghij", 1, 4, -1); - test("abcde", 0, 4, "abcdefghij", 1, 8, -1); - test("abcde", 0, 4, "abcdefghij", 1, 9, -1); - test("abcde", 0, 4, "abcdefghij", 1, 10, -1); - test("abcde", 0, 4, "abcdefghij", 5, 0, 4); - test("abcde", 0, 4, "abcdefghij", 5, 1, -5); - test("abcde", 0, 4, "abcdefghij", 5, 2, -5); - test("abcde", 0, 4, "abcdefghij", 5, 4, -5); - test("abcde", 0, 4, "abcdefghij", 5, 5, -5); - test("abcde", 0, 4, "abcdefghij", 5, 6, -5); - test("abcde", 0, 4, "abcdefghij", 9, 0, 4); - test("abcde", 0, 4, "abcdefghij", 9, 1, -9); - test("abcde", 0, 4, "abcdefghij", 9, 2, -9); - test("abcde", 0, 4, "abcdefghij", 10, 0, 4); - test("abcde", 0, 4, "abcdefghij", 10, 1, 4); - test("abcde", 0, 4, "abcdefghij", 11, 0, 0); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 0, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 1, 3); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 10, -6); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 19, -15); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 20, -16); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 21, -16); -} - -void test5() -{ - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 0, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 0, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, 0, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 20, 0, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 20, 1, 4); - test("abcde", 0, 4, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 0, 5, "", 0, 0, 5); - test("abcde", 0, 5, "", 0, 1, 5); - test("abcde", 0, 5, "", 1, 0, 0); - test("abcde", 0, 5, "abcde", 0, 0, 5); - test("abcde", 0, 5, "abcde", 0, 1, 4); - test("abcde", 0, 5, "abcde", 0, 2, 3); - test("abcde", 0, 5, "abcde", 0, 4, 1); - test("abcde", 0, 5, "abcde", 0, 5, 0); - test("abcde", 0, 5, "abcde", 0, 6, 0); - test("abcde", 0, 5, "abcde", 1, 0, 5); - test("abcde", 0, 5, "abcde", 1, 1, -1); - test("abcde", 0, 5, "abcde", 1, 2, -1); - test("abcde", 0, 5, "abcde", 1, 3, -1); - test("abcde", 0, 5, "abcde", 1, 4, -1); - test("abcde", 0, 5, "abcde", 1, 5, -1); - test("abcde", 0, 5, "abcde", 2, 0, 5); - test("abcde", 0, 5, "abcde", 2, 1, -2); - test("abcde", 0, 5, "abcde", 2, 2, -2); - test("abcde", 0, 5, "abcde", 2, 3, -2); - test("abcde", 0, 5, "abcde", 2, 4, -2); - test("abcde", 0, 5, "abcde", 4, 0, 5); - test("abcde", 0, 5, "abcde", 4, 1, -4); - test("abcde", 0, 5, "abcde", 4, 2, -4); - test("abcde", 0, 5, "abcde", 5, 0, 5); - test("abcde", 0, 5, "abcde", 5, 1, 5); - test("abcde", 0, 5, "abcde", 6, 0, 0); - test("abcde", 0, 5, "abcdefghij", 0, 0, 5); - test("abcde", 0, 5, "abcdefghij", 0, 1, 4); - test("abcde", 0, 5, "abcdefghij", 0, 5, 0); - test("abcde", 0, 5, "abcdefghij", 0, 9, -4); - test("abcde", 0, 5, "abcdefghij", 0, 10, -5); - test("abcde", 0, 5, "abcdefghij", 0, 11, -5); - test("abcde", 0, 5, "abcdefghij", 1, 0, 5); - test("abcde", 0, 5, "abcdefghij", 1, 1, -1); - test("abcde", 0, 5, "abcdefghij", 1, 4, -1); - test("abcde", 0, 5, "abcdefghij", 1, 8, -1); - test("abcde", 0, 5, "abcdefghij", 1, 9, -1); - test("abcde", 0, 5, "abcdefghij", 1, 10, -1); - test("abcde", 0, 5, "abcdefghij", 5, 0, 5); - test("abcde", 0, 5, "abcdefghij", 5, 1, -5); - test("abcde", 0, 5, "abcdefghij", 5, 2, -5); - test("abcde", 0, 5, "abcdefghij", 5, 4, -5); - test("abcde", 0, 5, "abcdefghij", 5, 5, -5); - test("abcde", 0, 5, "abcdefghij", 5, 6, -5); - test("abcde", 0, 5, "abcdefghij", 9, 0, 5); - test("abcde", 0, 5, "abcdefghij", 9, 1, -9); - test("abcde", 0, 5, "abcdefghij", 9, 2, -9); - test("abcde", 0, 5, "abcdefghij", 10, 0, 5); - test("abcde", 0, 5, "abcdefghij", 10, 1, 5); - test("abcde", 0, 5, "abcdefghij", 11, 0, 0); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 0, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 1, 4); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 10, -5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 19, -14); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 20, -15); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 21, -15); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 0, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 0, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, 0, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 20, 0, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 20, 1, 5); - test("abcde", 0, 5, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 0, 6, "", 0, 0, 5); - test("abcde", 0, 6, "", 0, 1, 5); - test("abcde", 0, 6, "", 1, 0, 0); - test("abcde", 0, 6, "abcde", 0, 0, 5); - test("abcde", 0, 6, "abcde", 0, 1, 4); - test("abcde", 0, 6, "abcde", 0, 2, 3); - test("abcde", 0, 6, "abcde", 0, 4, 1); - test("abcde", 0, 6, "abcde", 0, 5, 0); -} - -void test6() -{ - test("abcde", 0, 6, "abcde", 0, 6, 0); - test("abcde", 0, 6, "abcde", 1, 0, 5); - test("abcde", 0, 6, "abcde", 1, 1, -1); - test("abcde", 0, 6, "abcde", 1, 2, -1); - test("abcde", 0, 6, "abcde", 1, 3, -1); - test("abcde", 0, 6, "abcde", 1, 4, -1); - test("abcde", 0, 6, "abcde", 1, 5, -1); - test("abcde", 0, 6, "abcde", 2, 0, 5); - test("abcde", 0, 6, "abcde", 2, 1, -2); - test("abcde", 0, 6, "abcde", 2, 2, -2); - test("abcde", 0, 6, "abcde", 2, 3, -2); - test("abcde", 0, 6, "abcde", 2, 4, -2); - test("abcde", 0, 6, "abcde", 4, 0, 5); - test("abcde", 0, 6, "abcde", 4, 1, -4); - test("abcde", 0, 6, "abcde", 4, 2, -4); - test("abcde", 0, 6, "abcde", 5, 0, 5); - test("abcde", 0, 6, "abcde", 5, 1, 5); - test("abcde", 0, 6, "abcde", 6, 0, 0); - test("abcde", 0, 6, "abcdefghij", 0, 0, 5); - test("abcde", 0, 6, "abcdefghij", 0, 1, 4); - test("abcde", 0, 6, "abcdefghij", 0, 5, 0); - test("abcde", 0, 6, "abcdefghij", 0, 9, -4); - test("abcde", 0, 6, "abcdefghij", 0, 10, -5); - test("abcde", 0, 6, "abcdefghij", 0, 11, -5); - test("abcde", 0, 6, "abcdefghij", 1, 0, 5); - test("abcde", 0, 6, "abcdefghij", 1, 1, -1); - test("abcde", 0, 6, "abcdefghij", 1, 4, -1); - test("abcde", 0, 6, "abcdefghij", 1, 8, -1); - test("abcde", 0, 6, "abcdefghij", 1, 9, -1); - test("abcde", 0, 6, "abcdefghij", 1, 10, -1); - test("abcde", 0, 6, "abcdefghij", 5, 0, 5); - test("abcde", 0, 6, "abcdefghij", 5, 1, -5); - test("abcde", 0, 6, "abcdefghij", 5, 2, -5); - test("abcde", 0, 6, "abcdefghij", 5, 4, -5); - test("abcde", 0, 6, "abcdefghij", 5, 5, -5); - test("abcde", 0, 6, "abcdefghij", 5, 6, -5); - test("abcde", 0, 6, "abcdefghij", 9, 0, 5); - test("abcde", 0, 6, "abcdefghij", 9, 1, -9); - test("abcde", 0, 6, "abcdefghij", 9, 2, -9); - test("abcde", 0, 6, "abcdefghij", 10, 0, 5); - test("abcde", 0, 6, "abcdefghij", 10, 1, 5); - test("abcde", 0, 6, "abcdefghij", 11, 0, 0); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 0, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 1, 4); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 10, -5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 19, -14); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 20, -15); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 21, -15); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 0, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 0, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, 0, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 20, 0, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 20, 1, 5); - test("abcde", 0, 6, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 1, 0, "", 0, 0, 0); - test("abcde", 1, 0, "", 0, 1, 0); - test("abcde", 1, 0, "", 1, 0, 0); - test("abcde", 1, 0, "abcde", 0, 0, 0); - test("abcde", 1, 0, "abcde", 0, 1, -1); - test("abcde", 1, 0, "abcde", 0, 2, -2); - test("abcde", 1, 0, "abcde", 0, 4, -4); - test("abcde", 1, 0, "abcde", 0, 5, -5); - test("abcde", 1, 0, "abcde", 0, 6, -5); - test("abcde", 1, 0, "abcde", 1, 0, 0); - test("abcde", 1, 0, "abcde", 1, 1, -1); - test("abcde", 1, 0, "abcde", 1, 2, -2); - test("abcde", 1, 0, "abcde", 1, 3, -3); - test("abcde", 1, 0, "abcde", 1, 4, -4); - test("abcde", 1, 0, "abcde", 1, 5, -4); - test("abcde", 1, 0, "abcde", 2, 0, 0); - test("abcde", 1, 0, "abcde", 2, 1, -1); - test("abcde", 1, 0, "abcde", 2, 2, -2); - test("abcde", 1, 0, "abcde", 2, 3, -3); - test("abcde", 1, 0, "abcde", 2, 4, -3); - test("abcde", 1, 0, "abcde", 4, 0, 0); - test("abcde", 1, 0, "abcde", 4, 1, -1); - test("abcde", 1, 0, "abcde", 4, 2, -1); - test("abcde", 1, 0, "abcde", 5, 0, 0); - test("abcde", 1, 0, "abcde", 5, 1, 0); - test("abcde", 1, 0, "abcde", 6, 0, 0); - test("abcde", 1, 0, "abcdefghij", 0, 0, 0); - test("abcde", 1, 0, "abcdefghij", 0, 1, -1); - test("abcde", 1, 0, "abcdefghij", 0, 5, -5); - test("abcde", 1, 0, "abcdefghij", 0, 9, -9); - test("abcde", 1, 0, "abcdefghij", 0, 10, -10); - test("abcde", 1, 0, "abcdefghij", 0, 11, -10); - test("abcde", 1, 0, "abcdefghij", 1, 0, 0); - test("abcde", 1, 0, "abcdefghij", 1, 1, -1); -} - -void test7() -{ - test("abcde", 1, 0, "abcdefghij", 1, 4, -4); - test("abcde", 1, 0, "abcdefghij", 1, 8, -8); - test("abcde", 1, 0, "abcdefghij", 1, 9, -9); - test("abcde", 1, 0, "abcdefghij", 1, 10, -9); - test("abcde", 1, 0, "abcdefghij", 5, 0, 0); - test("abcde", 1, 0, "abcdefghij", 5, 1, -1); - test("abcde", 1, 0, "abcdefghij", 5, 2, -2); - test("abcde", 1, 0, "abcdefghij", 5, 4, -4); - test("abcde", 1, 0, "abcdefghij", 5, 5, -5); - test("abcde", 1, 0, "abcdefghij", 5, 6, -5); - test("abcde", 1, 0, "abcdefghij", 9, 0, 0); - test("abcde", 1, 0, "abcdefghij", 9, 1, -1); - test("abcde", 1, 0, "abcdefghij", 9, 2, -1); - test("abcde", 1, 0, "abcdefghij", 10, 0, 0); - test("abcde", 1, 0, "abcdefghij", 10, 1, 0); - test("abcde", 1, 0, "abcdefghij", 11, 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 1, 1, "", 0, 0, 1); - test("abcde", 1, 1, "", 0, 1, 1); - test("abcde", 1, 1, "", 1, 0, 0); - test("abcde", 1, 1, "abcde", 0, 0, 1); - test("abcde", 1, 1, "abcde", 0, 1, 1); - test("abcde", 1, 1, "abcde", 0, 2, 1); - test("abcde", 1, 1, "abcde", 0, 4, 1); - test("abcde", 1, 1, "abcde", 0, 5, 1); - test("abcde", 1, 1, "abcde", 0, 6, 1); - test("abcde", 1, 1, "abcde", 1, 0, 1); - test("abcde", 1, 1, "abcde", 1, 1, 0); - test("abcde", 1, 1, "abcde", 1, 2, -1); - test("abcde", 1, 1, "abcde", 1, 3, -2); - test("abcde", 1, 1, "abcde", 1, 4, -3); - test("abcde", 1, 1, "abcde", 1, 5, -3); - test("abcde", 1, 1, "abcde", 2, 0, 1); - test("abcde", 1, 1, "abcde", 2, 1, -1); - test("abcde", 1, 1, "abcde", 2, 2, -1); - test("abcde", 1, 1, "abcde", 2, 3, -1); - test("abcde", 1, 1, "abcde", 2, 4, -1); - test("abcde", 1, 1, "abcde", 4, 0, 1); - test("abcde", 1, 1, "abcde", 4, 1, -3); - test("abcde", 1, 1, "abcde", 4, 2, -3); - test("abcde", 1, 1, "abcde", 5, 0, 1); - test("abcde", 1, 1, "abcde", 5, 1, 1); - test("abcde", 1, 1, "abcde", 6, 0, 0); - test("abcde", 1, 1, "abcdefghij", 0, 0, 1); - test("abcde", 1, 1, "abcdefghij", 0, 1, 1); - test("abcde", 1, 1, "abcdefghij", 0, 5, 1); - test("abcde", 1, 1, "abcdefghij", 0, 9, 1); - test("abcde", 1, 1, "abcdefghij", 0, 10, 1); - test("abcde", 1, 1, "abcdefghij", 0, 11, 1); - test("abcde", 1, 1, "abcdefghij", 1, 0, 1); - test("abcde", 1, 1, "abcdefghij", 1, 1, 0); - test("abcde", 1, 1, "abcdefghij", 1, 4, -3); - test("abcde", 1, 1, "abcdefghij", 1, 8, -7); - test("abcde", 1, 1, "abcdefghij", 1, 9, -8); - test("abcde", 1, 1, "abcdefghij", 1, 10, -8); - test("abcde", 1, 1, "abcdefghij", 5, 0, 1); - test("abcde", 1, 1, "abcdefghij", 5, 1, -4); - test("abcde", 1, 1, "abcdefghij", 5, 2, -4); - test("abcde", 1, 1, "abcdefghij", 5, 4, -4); - test("abcde", 1, 1, "abcdefghij", 5, 5, -4); - test("abcde", 1, 1, "abcdefghij", 5, 6, -4); - test("abcde", 1, 1, "abcdefghij", 9, 0, 1); - test("abcde", 1, 1, "abcdefghij", 9, 1, -8); - test("abcde", 1, 1, "abcdefghij", 9, 2, -8); - test("abcde", 1, 1, "abcdefghij", 10, 0, 1); - test("abcde", 1, 1, "abcdefghij", 10, 1, 1); - test("abcde", 1, 1, "abcdefghij", 11, 0, 0); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 1, 0); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 9, -8); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 18, -17); -} - -void test8() -{ - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 19, -18); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 20, -18); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcde", 1, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 1, 2, "", 0, 0, 2); - test("abcde", 1, 2, "", 0, 1, 2); - test("abcde", 1, 2, "", 1, 0, 0); - test("abcde", 1, 2, "abcde", 0, 0, 2); - test("abcde", 1, 2, "abcde", 0, 1, 1); - test("abcde", 1, 2, "abcde", 0, 2, 1); - test("abcde", 1, 2, "abcde", 0, 4, 1); - test("abcde", 1, 2, "abcde", 0, 5, 1); - test("abcde", 1, 2, "abcde", 0, 6, 1); - test("abcde", 1, 2, "abcde", 1, 0, 2); - test("abcde", 1, 2, "abcde", 1, 1, 1); - test("abcde", 1, 2, "abcde", 1, 2, 0); - test("abcde", 1, 2, "abcde", 1, 3, -1); - test("abcde", 1, 2, "abcde", 1, 4, -2); - test("abcde", 1, 2, "abcde", 1, 5, -2); - test("abcde", 1, 2, "abcde", 2, 0, 2); - test("abcde", 1, 2, "abcde", 2, 1, -1); - test("abcde", 1, 2, "abcde", 2, 2, -1); - test("abcde", 1, 2, "abcde", 2, 3, -1); - test("abcde", 1, 2, "abcde", 2, 4, -1); - test("abcde", 1, 2, "abcde", 4, 0, 2); - test("abcde", 1, 2, "abcde", 4, 1, -3); - test("abcde", 1, 2, "abcde", 4, 2, -3); - test("abcde", 1, 2, "abcde", 5, 0, 2); - test("abcde", 1, 2, "abcde", 5, 1, 2); - test("abcde", 1, 2, "abcde", 6, 0, 0); - test("abcde", 1, 2, "abcdefghij", 0, 0, 2); - test("abcde", 1, 2, "abcdefghij", 0, 1, 1); - test("abcde", 1, 2, "abcdefghij", 0, 5, 1); - test("abcde", 1, 2, "abcdefghij", 0, 9, 1); - test("abcde", 1, 2, "abcdefghij", 0, 10, 1); - test("abcde", 1, 2, "abcdefghij", 0, 11, 1); - test("abcde", 1, 2, "abcdefghij", 1, 0, 2); - test("abcde", 1, 2, "abcdefghij", 1, 1, 1); - test("abcde", 1, 2, "abcdefghij", 1, 4, -2); - test("abcde", 1, 2, "abcdefghij", 1, 8, -6); - test("abcde", 1, 2, "abcdefghij", 1, 9, -7); - test("abcde", 1, 2, "abcdefghij", 1, 10, -7); - test("abcde", 1, 2, "abcdefghij", 5, 0, 2); - test("abcde", 1, 2, "abcdefghij", 5, 1, -4); - test("abcde", 1, 2, "abcdefghij", 5, 2, -4); - test("abcde", 1, 2, "abcdefghij", 5, 4, -4); - test("abcde", 1, 2, "abcdefghij", 5, 5, -4); - test("abcde", 1, 2, "abcdefghij", 5, 6, -4); - test("abcde", 1, 2, "abcdefghij", 9, 0, 2); - test("abcde", 1, 2, "abcdefghij", 9, 1, -8); - test("abcde", 1, 2, "abcdefghij", 9, 2, -8); - test("abcde", 1, 2, "abcdefghij", 10, 0, 2); - test("abcde", 1, 2, "abcdefghij", 10, 1, 2); - test("abcde", 1, 2, "abcdefghij", 11, 0, 0); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 0, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 0, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 1, 1); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 9, -7); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 18, -16); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 19, -17); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 20, -17); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 0, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 0, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 20, 0, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 20, 1, 2); - test("abcde", 1, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 1, 3, "", 0, 0, 3); - test("abcde", 1, 3, "", 0, 1, 3); - test("abcde", 1, 3, "", 1, 0, 0); - test("abcde", 1, 3, "abcde", 0, 0, 3); - test("abcde", 1, 3, "abcde", 0, 1, 1); - test("abcde", 1, 3, "abcde", 0, 2, 1); - test("abcde", 1, 3, "abcde", 0, 4, 1); - test("abcde", 1, 3, "abcde", 0, 5, 1); - test("abcde", 1, 3, "abcde", 0, 6, 1); - test("abcde", 1, 3, "abcde", 1, 0, 3); - test("abcde", 1, 3, "abcde", 1, 1, 2); - test("abcde", 1, 3, "abcde", 1, 2, 1); -} - -void test9() -{ - test("abcde", 1, 3, "abcde", 1, 3, 0); - test("abcde", 1, 3, "abcde", 1, 4, -1); - test("abcde", 1, 3, "abcde", 1, 5, -1); - test("abcde", 1, 3, "abcde", 2, 0, 3); - test("abcde", 1, 3, "abcde", 2, 1, -1); - test("abcde", 1, 3, "abcde", 2, 2, -1); - test("abcde", 1, 3, "abcde", 2, 3, -1); - test("abcde", 1, 3, "abcde", 2, 4, -1); - test("abcde", 1, 3, "abcde", 4, 0, 3); - test("abcde", 1, 3, "abcde", 4, 1, -3); - test("abcde", 1, 3, "abcde", 4, 2, -3); - test("abcde", 1, 3, "abcde", 5, 0, 3); - test("abcde", 1, 3, "abcde", 5, 1, 3); - test("abcde", 1, 3, "abcde", 6, 0, 0); - test("abcde", 1, 3, "abcdefghij", 0, 0, 3); - test("abcde", 1, 3, "abcdefghij", 0, 1, 1); - test("abcde", 1, 3, "abcdefghij", 0, 5, 1); - test("abcde", 1, 3, "abcdefghij", 0, 9, 1); - test("abcde", 1, 3, "abcdefghij", 0, 10, 1); - test("abcde", 1, 3, "abcdefghij", 0, 11, 1); - test("abcde", 1, 3, "abcdefghij", 1, 0, 3); - test("abcde", 1, 3, "abcdefghij", 1, 1, 2); - test("abcde", 1, 3, "abcdefghij", 1, 4, -1); - test("abcde", 1, 3, "abcdefghij", 1, 8, -5); - test("abcde", 1, 3, "abcdefghij", 1, 9, -6); - test("abcde", 1, 3, "abcdefghij", 1, 10, -6); - test("abcde", 1, 3, "abcdefghij", 5, 0, 3); - test("abcde", 1, 3, "abcdefghij", 5, 1, -4); - test("abcde", 1, 3, "abcdefghij", 5, 2, -4); - test("abcde", 1, 3, "abcdefghij", 5, 4, -4); - test("abcde", 1, 3, "abcdefghij", 5, 5, -4); - test("abcde", 1, 3, "abcdefghij", 5, 6, -4); - test("abcde", 1, 3, "abcdefghij", 9, 0, 3); - test("abcde", 1, 3, "abcdefghij", 9, 1, -8); - test("abcde", 1, 3, "abcdefghij", 9, 2, -8); - test("abcde", 1, 3, "abcdefghij", 10, 0, 3); - test("abcde", 1, 3, "abcdefghij", 10, 1, 3); - test("abcde", 1, 3, "abcdefghij", 11, 0, 0); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 0, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 0, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 1, 2); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 9, -6); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 18, -15); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 19, -16); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 20, -16); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 0, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 0, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 20, 0, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 20, 1, 3); - test("abcde", 1, 3, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 1, 4, "", 0, 0, 4); - test("abcde", 1, 4, "", 0, 1, 4); - test("abcde", 1, 4, "", 1, 0, 0); - test("abcde", 1, 4, "abcde", 0, 0, 4); - test("abcde", 1, 4, "abcde", 0, 1, 1); - test("abcde", 1, 4, "abcde", 0, 2, 1); - test("abcde", 1, 4, "abcde", 0, 4, 1); - test("abcde", 1, 4, "abcde", 0, 5, 1); - test("abcde", 1, 4, "abcde", 0, 6, 1); - test("abcde", 1, 4, "abcde", 1, 0, 4); - test("abcde", 1, 4, "abcde", 1, 1, 3); - test("abcde", 1, 4, "abcde", 1, 2, 2); - test("abcde", 1, 4, "abcde", 1, 3, 1); - test("abcde", 1, 4, "abcde", 1, 4, 0); - test("abcde", 1, 4, "abcde", 1, 5, 0); - test("abcde", 1, 4, "abcde", 2, 0, 4); - test("abcde", 1, 4, "abcde", 2, 1, -1); - test("abcde", 1, 4, "abcde", 2, 2, -1); - test("abcde", 1, 4, "abcde", 2, 3, -1); - test("abcde", 1, 4, "abcde", 2, 4, -1); - test("abcde", 1, 4, "abcde", 4, 0, 4); - test("abcde", 1, 4, "abcde", 4, 1, -3); - test("abcde", 1, 4, "abcde", 4, 2, -3); - test("abcde", 1, 4, "abcde", 5, 0, 4); - test("abcde", 1, 4, "abcde", 5, 1, 4); - test("abcde", 1, 4, "abcde", 6, 0, 0); - test("abcde", 1, 4, "abcdefghij", 0, 0, 4); - test("abcde", 1, 4, "abcdefghij", 0, 1, 1); - test("abcde", 1, 4, "abcdefghij", 0, 5, 1); - test("abcde", 1, 4, "abcdefghij", 0, 9, 1); - test("abcde", 1, 4, "abcdefghij", 0, 10, 1); - test("abcde", 1, 4, "abcdefghij", 0, 11, 1); - test("abcde", 1, 4, "abcdefghij", 1, 0, 4); - test("abcde", 1, 4, "abcdefghij", 1, 1, 3); - test("abcde", 1, 4, "abcdefghij", 1, 4, 0); - test("abcde", 1, 4, "abcdefghij", 1, 8, -4); - test("abcde", 1, 4, "abcdefghij", 1, 9, -5); - test("abcde", 1, 4, "abcdefghij", 1, 10, -5); -} - -void test10() -{ - test("abcde", 1, 4, "abcdefghij", 5, 0, 4); - test("abcde", 1, 4, "abcdefghij", 5, 1, -4); - test("abcde", 1, 4, "abcdefghij", 5, 2, -4); - test("abcde", 1, 4, "abcdefghij", 5, 4, -4); - test("abcde", 1, 4, "abcdefghij", 5, 5, -4); - test("abcde", 1, 4, "abcdefghij", 5, 6, -4); - test("abcde", 1, 4, "abcdefghij", 9, 0, 4); - test("abcde", 1, 4, "abcdefghij", 9, 1, -8); - test("abcde", 1, 4, "abcdefghij", 9, 2, -8); - test("abcde", 1, 4, "abcdefghij", 10, 0, 4); - test("abcde", 1, 4, "abcdefghij", 10, 1, 4); - test("abcde", 1, 4, "abcdefghij", 11, 0, 0); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 0, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 0, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 1, 3); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 9, -5); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 18, -14); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 19, -15); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 20, -15); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 0, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 0, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 20, 0, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 20, 1, 4); - test("abcde", 1, 4, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 1, 5, "", 0, 0, 4); - test("abcde", 1, 5, "", 0, 1, 4); - test("abcde", 1, 5, "", 1, 0, 0); - test("abcde", 1, 5, "abcde", 0, 0, 4); - test("abcde", 1, 5, "abcde", 0, 1, 1); - test("abcde", 1, 5, "abcde", 0, 2, 1); - test("abcde", 1, 5, "abcde", 0, 4, 1); - test("abcde", 1, 5, "abcde", 0, 5, 1); - test("abcde", 1, 5, "abcde", 0, 6, 1); - test("abcde", 1, 5, "abcde", 1, 0, 4); - test("abcde", 1, 5, "abcde", 1, 1, 3); - test("abcde", 1, 5, "abcde", 1, 2, 2); - test("abcde", 1, 5, "abcde", 1, 3, 1); - test("abcde", 1, 5, "abcde", 1, 4, 0); - test("abcde", 1, 5, "abcde", 1, 5, 0); - test("abcde", 1, 5, "abcde", 2, 0, 4); - test("abcde", 1, 5, "abcde", 2, 1, -1); - test("abcde", 1, 5, "abcde", 2, 2, -1); - test("abcde", 1, 5, "abcde", 2, 3, -1); - test("abcde", 1, 5, "abcde", 2, 4, -1); - test("abcde", 1, 5, "abcde", 4, 0, 4); - test("abcde", 1, 5, "abcde", 4, 1, -3); - test("abcde", 1, 5, "abcde", 4, 2, -3); - test("abcde", 1, 5, "abcde", 5, 0, 4); - test("abcde", 1, 5, "abcde", 5, 1, 4); - test("abcde", 1, 5, "abcde", 6, 0, 0); - test("abcde", 1, 5, "abcdefghij", 0, 0, 4); - test("abcde", 1, 5, "abcdefghij", 0, 1, 1); - test("abcde", 1, 5, "abcdefghij", 0, 5, 1); - test("abcde", 1, 5, "abcdefghij", 0, 9, 1); - test("abcde", 1, 5, "abcdefghij", 0, 10, 1); - test("abcde", 1, 5, "abcdefghij", 0, 11, 1); - test("abcde", 1, 5, "abcdefghij", 1, 0, 4); - test("abcde", 1, 5, "abcdefghij", 1, 1, 3); - test("abcde", 1, 5, "abcdefghij", 1, 4, 0); - test("abcde", 1, 5, "abcdefghij", 1, 8, -4); - test("abcde", 1, 5, "abcdefghij", 1, 9, -5); - test("abcde", 1, 5, "abcdefghij", 1, 10, -5); - test("abcde", 1, 5, "abcdefghij", 5, 0, 4); - test("abcde", 1, 5, "abcdefghij", 5, 1, -4); - test("abcde", 1, 5, "abcdefghij", 5, 2, -4); - test("abcde", 1, 5, "abcdefghij", 5, 4, -4); - test("abcde", 1, 5, "abcdefghij", 5, 5, -4); - test("abcde", 1, 5, "abcdefghij", 5, 6, -4); - test("abcde", 1, 5, "abcdefghij", 9, 0, 4); - test("abcde", 1, 5, "abcdefghij", 9, 1, -8); - test("abcde", 1, 5, "abcdefghij", 9, 2, -8); - test("abcde", 1, 5, "abcdefghij", 10, 0, 4); - test("abcde", 1, 5, "abcdefghij", 10, 1, 4); - test("abcde", 1, 5, "abcdefghij", 11, 0, 0); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 0, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 0, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 1, 3); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 9, -5); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 18, -14); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 19, -15); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 20, -15); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 0, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 1, -9); -} - -void test11() -{ - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 0, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 20, 0, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 20, 1, 4); - test("abcde", 1, 5, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 2, 0, "", 0, 0, 0); - test("abcde", 2, 0, "", 0, 1, 0); - test("abcde", 2, 0, "", 1, 0, 0); - test("abcde", 2, 0, "abcde", 0, 0, 0); - test("abcde", 2, 0, "abcde", 0, 1, -1); - test("abcde", 2, 0, "abcde", 0, 2, -2); - test("abcde", 2, 0, "abcde", 0, 4, -4); - test("abcde", 2, 0, "abcde", 0, 5, -5); - test("abcde", 2, 0, "abcde", 0, 6, -5); - test("abcde", 2, 0, "abcde", 1, 0, 0); - test("abcde", 2, 0, "abcde", 1, 1, -1); - test("abcde", 2, 0, "abcde", 1, 2, -2); - test("abcde", 2, 0, "abcde", 1, 3, -3); - test("abcde", 2, 0, "abcde", 1, 4, -4); - test("abcde", 2, 0, "abcde", 1, 5, -4); - test("abcde", 2, 0, "abcde", 2, 0, 0); - test("abcde", 2, 0, "abcde", 2, 1, -1); - test("abcde", 2, 0, "abcde", 2, 2, -2); - test("abcde", 2, 0, "abcde", 2, 3, -3); - test("abcde", 2, 0, "abcde", 2, 4, -3); - test("abcde", 2, 0, "abcde", 4, 0, 0); - test("abcde", 2, 0, "abcde", 4, 1, -1); - test("abcde", 2, 0, "abcde", 4, 2, -1); - test("abcde", 2, 0, "abcde", 5, 0, 0); - test("abcde", 2, 0, "abcde", 5, 1, 0); - test("abcde", 2, 0, "abcde", 6, 0, 0); - test("abcde", 2, 0, "abcdefghij", 0, 0, 0); - test("abcde", 2, 0, "abcdefghij", 0, 1, -1); - test("abcde", 2, 0, "abcdefghij", 0, 5, -5); - test("abcde", 2, 0, "abcdefghij", 0, 9, -9); - test("abcde", 2, 0, "abcdefghij", 0, 10, -10); - test("abcde", 2, 0, "abcdefghij", 0, 11, -10); - test("abcde", 2, 0, "abcdefghij", 1, 0, 0); - test("abcde", 2, 0, "abcdefghij", 1, 1, -1); - test("abcde", 2, 0, "abcdefghij", 1, 4, -4); - test("abcde", 2, 0, "abcdefghij", 1, 8, -8); - test("abcde", 2, 0, "abcdefghij", 1, 9, -9); - test("abcde", 2, 0, "abcdefghij", 1, 10, -9); - test("abcde", 2, 0, "abcdefghij", 5, 0, 0); - test("abcde", 2, 0, "abcdefghij", 5, 1, -1); - test("abcde", 2, 0, "abcdefghij", 5, 2, -2); - test("abcde", 2, 0, "abcdefghij", 5, 4, -4); - test("abcde", 2, 0, "abcdefghij", 5, 5, -5); - test("abcde", 2, 0, "abcdefghij", 5, 6, -5); - test("abcde", 2, 0, "abcdefghij", 9, 0, 0); - test("abcde", 2, 0, "abcdefghij", 9, 1, -1); - test("abcde", 2, 0, "abcdefghij", 9, 2, -1); - test("abcde", 2, 0, "abcdefghij", 10, 0, 0); - test("abcde", 2, 0, "abcdefghij", 10, 1, 0); - test("abcde", 2, 0, "abcdefghij", 11, 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 2, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 2, 1, "", 0, 0, 1); - test("abcde", 2, 1, "", 0, 1, 1); - test("abcde", 2, 1, "", 1, 0, 0); - test("abcde", 2, 1, "abcde", 0, 0, 1); - test("abcde", 2, 1, "abcde", 0, 1, 2); - test("abcde", 2, 1, "abcde", 0, 2, 2); - test("abcde", 2, 1, "abcde", 0, 4, 2); - test("abcde", 2, 1, "abcde", 0, 5, 2); - test("abcde", 2, 1, "abcde", 0, 6, 2); - test("abcde", 2, 1, "abcde", 1, 0, 1); - test("abcde", 2, 1, "abcde", 1, 1, 1); - test("abcde", 2, 1, "abcde", 1, 2, 1); - test("abcde", 2, 1, "abcde", 1, 3, 1); - test("abcde", 2, 1, "abcde", 1, 4, 1); - test("abcde", 2, 1, "abcde", 1, 5, 1); - test("abcde", 2, 1, "abcde", 2, 0, 1); -} - -void test12() -{ - test("abcde", 2, 1, "abcde", 2, 1, 0); - test("abcde", 2, 1, "abcde", 2, 2, -1); - test("abcde", 2, 1, "abcde", 2, 3, -2); - test("abcde", 2, 1, "abcde", 2, 4, -2); - test("abcde", 2, 1, "abcde", 4, 0, 1); - test("abcde", 2, 1, "abcde", 4, 1, -2); - test("abcde", 2, 1, "abcde", 4, 2, -2); - test("abcde", 2, 1, "abcde", 5, 0, 1); - test("abcde", 2, 1, "abcde", 5, 1, 1); - test("abcde", 2, 1, "abcde", 6, 0, 0); - test("abcde", 2, 1, "abcdefghij", 0, 0, 1); - test("abcde", 2, 1, "abcdefghij", 0, 1, 2); - test("abcde", 2, 1, "abcdefghij", 0, 5, 2); - test("abcde", 2, 1, "abcdefghij", 0, 9, 2); - test("abcde", 2, 1, "abcdefghij", 0, 10, 2); - test("abcde", 2, 1, "abcdefghij", 0, 11, 2); - test("abcde", 2, 1, "abcdefghij", 1, 0, 1); - test("abcde", 2, 1, "abcdefghij", 1, 1, 1); - test("abcde", 2, 1, "abcdefghij", 1, 4, 1); - test("abcde", 2, 1, "abcdefghij", 1, 8, 1); - test("abcde", 2, 1, "abcdefghij", 1, 9, 1); - test("abcde", 2, 1, "abcdefghij", 1, 10, 1); - test("abcde", 2, 1, "abcdefghij", 5, 0, 1); - test("abcde", 2, 1, "abcdefghij", 5, 1, -3); - test("abcde", 2, 1, "abcdefghij", 5, 2, -3); - test("abcde", 2, 1, "abcdefghij", 5, 4, -3); - test("abcde", 2, 1, "abcdefghij", 5, 5, -3); - test("abcde", 2, 1, "abcdefghij", 5, 6, -3); - test("abcde", 2, 1, "abcdefghij", 9, 0, 1); - test("abcde", 2, 1, "abcdefghij", 9, 1, -7); - test("abcde", 2, 1, "abcdefghij", 9, 2, -7); - test("abcde", 2, 1, "abcdefghij", 10, 0, 1); - test("abcde", 2, 1, "abcdefghij", 10, 1, 1); - test("abcde", 2, 1, "abcdefghij", 11, 0, 0); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 1, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 10, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 19, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 20, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 21, 2); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 1, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 9, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 18, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 19, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 20, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 1, -8); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 5, -8); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 9, -8); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 10, -8); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 11, -8); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 1, -17); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 2, -17); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcde", 2, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 2, 2, "", 0, 0, 2); - test("abcde", 2, 2, "", 0, 1, 2); - test("abcde", 2, 2, "", 1, 0, 0); - test("abcde", 2, 2, "abcde", 0, 0, 2); - test("abcde", 2, 2, "abcde", 0, 1, 2); - test("abcde", 2, 2, "abcde", 0, 2, 2); - test("abcde", 2, 2, "abcde", 0, 4, 2); - test("abcde", 2, 2, "abcde", 0, 5, 2); - test("abcde", 2, 2, "abcde", 0, 6, 2); - test("abcde", 2, 2, "abcde", 1, 0, 2); - test("abcde", 2, 2, "abcde", 1, 1, 1); - test("abcde", 2, 2, "abcde", 1, 2, 1); - test("abcde", 2, 2, "abcde", 1, 3, 1); - test("abcde", 2, 2, "abcde", 1, 4, 1); - test("abcde", 2, 2, "abcde", 1, 5, 1); - test("abcde", 2, 2, "abcde", 2, 0, 2); - test("abcde", 2, 2, "abcde", 2, 1, 1); - test("abcde", 2, 2, "abcde", 2, 2, 0); - test("abcde", 2, 2, "abcde", 2, 3, -1); - test("abcde", 2, 2, "abcde", 2, 4, -1); - test("abcde", 2, 2, "abcde", 4, 0, 2); - test("abcde", 2, 2, "abcde", 4, 1, -2); - test("abcde", 2, 2, "abcde", 4, 2, -2); - test("abcde", 2, 2, "abcde", 5, 0, 2); - test("abcde", 2, 2, "abcde", 5, 1, 2); - test("abcde", 2, 2, "abcde", 6, 0, 0); - test("abcde", 2, 2, "abcdefghij", 0, 0, 2); - test("abcde", 2, 2, "abcdefghij", 0, 1, 2); - test("abcde", 2, 2, "abcdefghij", 0, 5, 2); - test("abcde", 2, 2, "abcdefghij", 0, 9, 2); - test("abcde", 2, 2, "abcdefghij", 0, 10, 2); - test("abcde", 2, 2, "abcdefghij", 0, 11, 2); - test("abcde", 2, 2, "abcdefghij", 1, 0, 2); - test("abcde", 2, 2, "abcdefghij", 1, 1, 1); - test("abcde", 2, 2, "abcdefghij", 1, 4, 1); - test("abcde", 2, 2, "abcdefghij", 1, 8, 1); - test("abcde", 2, 2, "abcdefghij", 1, 9, 1); - test("abcde", 2, 2, "abcdefghij", 1, 10, 1); - test("abcde", 2, 2, "abcdefghij", 5, 0, 2); - test("abcde", 2, 2, "abcdefghij", 5, 1, -3); - test("abcde", 2, 2, "abcdefghij", 5, 2, -3); - test("abcde", 2, 2, "abcdefghij", 5, 4, -3); -} - -void test13() -{ - test("abcde", 2, 2, "abcdefghij", 5, 5, -3); - test("abcde", 2, 2, "abcdefghij", 5, 6, -3); - test("abcde", 2, 2, "abcdefghij", 9, 0, 2); - test("abcde", 2, 2, "abcdefghij", 9, 1, -7); - test("abcde", 2, 2, "abcdefghij", 9, 2, -7); - test("abcde", 2, 2, "abcdefghij", 10, 0, 2); - test("abcde", 2, 2, "abcdefghij", 10, 1, 2); - test("abcde", 2, 2, "abcdefghij", 11, 0, 0); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 0, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 1, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 10, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 19, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 20, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 21, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 0, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 1, 1); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 9, 1); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 18, 1); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 19, 1); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 20, 1); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 0, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 1, -8); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 5, -8); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 9, -8); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 10, -8); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 11, -8); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 0, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 1, -17); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 2, -17); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 20, 0, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 20, 1, 2); - test("abcde", 2, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 2, 3, "", 0, 0, 3); - test("abcde", 2, 3, "", 0, 1, 3); - test("abcde", 2, 3, "", 1, 0, 0); - test("abcde", 2, 3, "abcde", 0, 0, 3); - test("abcde", 2, 3, "abcde", 0, 1, 2); - test("abcde", 2, 3, "abcde", 0, 2, 2); - test("abcde", 2, 3, "abcde", 0, 4, 2); - test("abcde", 2, 3, "abcde", 0, 5, 2); - test("abcde", 2, 3, "abcde", 0, 6, 2); - test("abcde", 2, 3, "abcde", 1, 0, 3); - test("abcde", 2, 3, "abcde", 1, 1, 1); - test("abcde", 2, 3, "abcde", 1, 2, 1); - test("abcde", 2, 3, "abcde", 1, 3, 1); - test("abcde", 2, 3, "abcde", 1, 4, 1); - test("abcde", 2, 3, "abcde", 1, 5, 1); - test("abcde", 2, 3, "abcde", 2, 0, 3); - test("abcde", 2, 3, "abcde", 2, 1, 2); - test("abcde", 2, 3, "abcde", 2, 2, 1); - test("abcde", 2, 3, "abcde", 2, 3, 0); - test("abcde", 2, 3, "abcde", 2, 4, 0); - test("abcde", 2, 3, "abcde", 4, 0, 3); - test("abcde", 2, 3, "abcde", 4, 1, -2); - test("abcde", 2, 3, "abcde", 4, 2, -2); - test("abcde", 2, 3, "abcde", 5, 0, 3); - test("abcde", 2, 3, "abcde", 5, 1, 3); - test("abcde", 2, 3, "abcde", 6, 0, 0); - test("abcde", 2, 3, "abcdefghij", 0, 0, 3); - test("abcde", 2, 3, "abcdefghij", 0, 1, 2); - test("abcde", 2, 3, "abcdefghij", 0, 5, 2); - test("abcde", 2, 3, "abcdefghij", 0, 9, 2); - test("abcde", 2, 3, "abcdefghij", 0, 10, 2); - test("abcde", 2, 3, "abcdefghij", 0, 11, 2); - test("abcde", 2, 3, "abcdefghij", 1, 0, 3); - test("abcde", 2, 3, "abcdefghij", 1, 1, 1); - test("abcde", 2, 3, "abcdefghij", 1, 4, 1); - test("abcde", 2, 3, "abcdefghij", 1, 8, 1); - test("abcde", 2, 3, "abcdefghij", 1, 9, 1); - test("abcde", 2, 3, "abcdefghij", 1, 10, 1); - test("abcde", 2, 3, "abcdefghij", 5, 0, 3); - test("abcde", 2, 3, "abcdefghij", 5, 1, -3); - test("abcde", 2, 3, "abcdefghij", 5, 2, -3); - test("abcde", 2, 3, "abcdefghij", 5, 4, -3); - test("abcde", 2, 3, "abcdefghij", 5, 5, -3); - test("abcde", 2, 3, "abcdefghij", 5, 6, -3); - test("abcde", 2, 3, "abcdefghij", 9, 0, 3); - test("abcde", 2, 3, "abcdefghij", 9, 1, -7); - test("abcde", 2, 3, "abcdefghij", 9, 2, -7); - test("abcde", 2, 3, "abcdefghij", 10, 0, 3); - test("abcde", 2, 3, "abcdefghij", 10, 1, 3); - test("abcde", 2, 3, "abcdefghij", 11, 0, 0); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 0, 3); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 1, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 10, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 19, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 20, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 21, 2); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 0, 3); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 1, 1); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 9, 1); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 18, 1); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 19, 1); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 20, 1); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 0, 3); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 1, -8); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 5, -8); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 9, -8); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 10, -8); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 11, -8); -} - -void test14() -{ - test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 0, 3); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 1, -17); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 2, -17); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 20, 0, 3); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 20, 1, 3); - test("abcde", 2, 3, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 2, 4, "", 0, 0, 3); - test("abcde", 2, 4, "", 0, 1, 3); - test("abcde", 2, 4, "", 1, 0, 0); - test("abcde", 2, 4, "abcde", 0, 0, 3); - test("abcde", 2, 4, "abcde", 0, 1, 2); - test("abcde", 2, 4, "abcde", 0, 2, 2); - test("abcde", 2, 4, "abcde", 0, 4, 2); - test("abcde", 2, 4, "abcde", 0, 5, 2); - test("abcde", 2, 4, "abcde", 0, 6, 2); - test("abcde", 2, 4, "abcde", 1, 0, 3); - test("abcde", 2, 4, "abcde", 1, 1, 1); - test("abcde", 2, 4, "abcde", 1, 2, 1); - test("abcde", 2, 4, "abcde", 1, 3, 1); - test("abcde", 2, 4, "abcde", 1, 4, 1); - test("abcde", 2, 4, "abcde", 1, 5, 1); - test("abcde", 2, 4, "abcde", 2, 0, 3); - test("abcde", 2, 4, "abcde", 2, 1, 2); - test("abcde", 2, 4, "abcde", 2, 2, 1); - test("abcde", 2, 4, "abcde", 2, 3, 0); - test("abcde", 2, 4, "abcde", 2, 4, 0); - test("abcde", 2, 4, "abcde", 4, 0, 3); - test("abcde", 2, 4, "abcde", 4, 1, -2); - test("abcde", 2, 4, "abcde", 4, 2, -2); - test("abcde", 2, 4, "abcde", 5, 0, 3); - test("abcde", 2, 4, "abcde", 5, 1, 3); - test("abcde", 2, 4, "abcde", 6, 0, 0); - test("abcde", 2, 4, "abcdefghij", 0, 0, 3); - test("abcde", 2, 4, "abcdefghij", 0, 1, 2); - test("abcde", 2, 4, "abcdefghij", 0, 5, 2); - test("abcde", 2, 4, "abcdefghij", 0, 9, 2); - test("abcde", 2, 4, "abcdefghij", 0, 10, 2); - test("abcde", 2, 4, "abcdefghij", 0, 11, 2); - test("abcde", 2, 4, "abcdefghij", 1, 0, 3); - test("abcde", 2, 4, "abcdefghij", 1, 1, 1); - test("abcde", 2, 4, "abcdefghij", 1, 4, 1); - test("abcde", 2, 4, "abcdefghij", 1, 8, 1); - test("abcde", 2, 4, "abcdefghij", 1, 9, 1); - test("abcde", 2, 4, "abcdefghij", 1, 10, 1); - test("abcde", 2, 4, "abcdefghij", 5, 0, 3); - test("abcde", 2, 4, "abcdefghij", 5, 1, -3); - test("abcde", 2, 4, "abcdefghij", 5, 2, -3); - test("abcde", 2, 4, "abcdefghij", 5, 4, -3); - test("abcde", 2, 4, "abcdefghij", 5, 5, -3); - test("abcde", 2, 4, "abcdefghij", 5, 6, -3); - test("abcde", 2, 4, "abcdefghij", 9, 0, 3); - test("abcde", 2, 4, "abcdefghij", 9, 1, -7); - test("abcde", 2, 4, "abcdefghij", 9, 2, -7); - test("abcde", 2, 4, "abcdefghij", 10, 0, 3); - test("abcde", 2, 4, "abcdefghij", 10, 1, 3); - test("abcde", 2, 4, "abcdefghij", 11, 0, 0); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 0, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 1, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 10, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 19, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 20, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 21, 2); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 0, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 1, 1); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 9, 1); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 18, 1); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 19, 1); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 20, 1); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 0, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 1, -8); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 5, -8); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 9, -8); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 10, -8); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 11, -8); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 0, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 1, -17); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 2, -17); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 20, 0, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 20, 1, 3); - test("abcde", 2, 4, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 4, 0, "", 0, 0, 0); - test("abcde", 4, 0, "", 0, 1, 0); - test("abcde", 4, 0, "", 1, 0, 0); - test("abcde", 4, 0, "abcde", 0, 0, 0); - test("abcde", 4, 0, "abcde", 0, 1, -1); - test("abcde", 4, 0, "abcde", 0, 2, -2); - test("abcde", 4, 0, "abcde", 0, 4, -4); - test("abcde", 4, 0, "abcde", 0, 5, -5); - test("abcde", 4, 0, "abcde", 0, 6, -5); - test("abcde", 4, 0, "abcde", 1, 0, 0); - test("abcde", 4, 0, "abcde", 1, 1, -1); - test("abcde", 4, 0, "abcde", 1, 2, -2); - test("abcde", 4, 0, "abcde", 1, 3, -3); - test("abcde", 4, 0, "abcde", 1, 4, -4); - test("abcde", 4, 0, "abcde", 1, 5, -4); - test("abcde", 4, 0, "abcde", 2, 0, 0); - test("abcde", 4, 0, "abcde", 2, 1, -1); - test("abcde", 4, 0, "abcde", 2, 2, -2); - test("abcde", 4, 0, "abcde", 2, 3, -3); - test("abcde", 4, 0, "abcde", 2, 4, -3); -} - -void test15() -{ - test("abcde", 4, 0, "abcde", 4, 0, 0); - test("abcde", 4, 0, "abcde", 4, 1, -1); - test("abcde", 4, 0, "abcde", 4, 2, -1); - test("abcde", 4, 0, "abcde", 5, 0, 0); - test("abcde", 4, 0, "abcde", 5, 1, 0); - test("abcde", 4, 0, "abcde", 6, 0, 0); - test("abcde", 4, 0, "abcdefghij", 0, 0, 0); - test("abcde", 4, 0, "abcdefghij", 0, 1, -1); - test("abcde", 4, 0, "abcdefghij", 0, 5, -5); - test("abcde", 4, 0, "abcdefghij", 0, 9, -9); - test("abcde", 4, 0, "abcdefghij", 0, 10, -10); - test("abcde", 4, 0, "abcdefghij", 0, 11, -10); - test("abcde", 4, 0, "abcdefghij", 1, 0, 0); - test("abcde", 4, 0, "abcdefghij", 1, 1, -1); - test("abcde", 4, 0, "abcdefghij", 1, 4, -4); - test("abcde", 4, 0, "abcdefghij", 1, 8, -8); - test("abcde", 4, 0, "abcdefghij", 1, 9, -9); - test("abcde", 4, 0, "abcdefghij", 1, 10, -9); - test("abcde", 4, 0, "abcdefghij", 5, 0, 0); - test("abcde", 4, 0, "abcdefghij", 5, 1, -1); - test("abcde", 4, 0, "abcdefghij", 5, 2, -2); - test("abcde", 4, 0, "abcdefghij", 5, 4, -4); - test("abcde", 4, 0, "abcdefghij", 5, 5, -5); - test("abcde", 4, 0, "abcdefghij", 5, 6, -5); - test("abcde", 4, 0, "abcdefghij", 9, 0, 0); - test("abcde", 4, 0, "abcdefghij", 9, 1, -1); - test("abcde", 4, 0, "abcdefghij", 9, 2, -1); - test("abcde", 4, 0, "abcdefghij", 10, 0, 0); - test("abcde", 4, 0, "abcdefghij", 10, 1, 0); - test("abcde", 4, 0, "abcdefghij", 11, 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 4, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 4, 1, "", 0, 0, 1); - test("abcde", 4, 1, "", 0, 1, 1); - test("abcde", 4, 1, "", 1, 0, 0); - test("abcde", 4, 1, "abcde", 0, 0, 1); - test("abcde", 4, 1, "abcde", 0, 1, 4); - test("abcde", 4, 1, "abcde", 0, 2, 4); - test("abcde", 4, 1, "abcde", 0, 4, 4); - test("abcde", 4, 1, "abcde", 0, 5, 4); - test("abcde", 4, 1, "abcde", 0, 6, 4); - test("abcde", 4, 1, "abcde", 1, 0, 1); - test("abcde", 4, 1, "abcde", 1, 1, 3); - test("abcde", 4, 1, "abcde", 1, 2, 3); - test("abcde", 4, 1, "abcde", 1, 3, 3); - test("abcde", 4, 1, "abcde", 1, 4, 3); - test("abcde", 4, 1, "abcde", 1, 5, 3); - test("abcde", 4, 1, "abcde", 2, 0, 1); - test("abcde", 4, 1, "abcde", 2, 1, 2); - test("abcde", 4, 1, "abcde", 2, 2, 2); - test("abcde", 4, 1, "abcde", 2, 3, 2); - test("abcde", 4, 1, "abcde", 2, 4, 2); - test("abcde", 4, 1, "abcde", 4, 0, 1); - test("abcde", 4, 1, "abcde", 4, 1, 0); - test("abcde", 4, 1, "abcde", 4, 2, 0); - test("abcde", 4, 1, "abcde", 5, 0, 1); - test("abcde", 4, 1, "abcde", 5, 1, 1); - test("abcde", 4, 1, "abcde", 6, 0, 0); - test("abcde", 4, 1, "abcdefghij", 0, 0, 1); - test("abcde", 4, 1, "abcdefghij", 0, 1, 4); - test("abcde", 4, 1, "abcdefghij", 0, 5, 4); - test("abcde", 4, 1, "abcdefghij", 0, 9, 4); - test("abcde", 4, 1, "abcdefghij", 0, 10, 4); - test("abcde", 4, 1, "abcdefghij", 0, 11, 4); - test("abcde", 4, 1, "abcdefghij", 1, 0, 1); - test("abcde", 4, 1, "abcdefghij", 1, 1, 3); - test("abcde", 4, 1, "abcdefghij", 1, 4, 3); - test("abcde", 4, 1, "abcdefghij", 1, 8, 3); - test("abcde", 4, 1, "abcdefghij", 1, 9, 3); - test("abcde", 4, 1, "abcdefghij", 1, 10, 3); - test("abcde", 4, 1, "abcdefghij", 5, 0, 1); - test("abcde", 4, 1, "abcdefghij", 5, 1, -1); - test("abcde", 4, 1, "abcdefghij", 5, 2, -1); - test("abcde", 4, 1, "abcdefghij", 5, 4, -1); - test("abcde", 4, 1, "abcdefghij", 5, 5, -1); - test("abcde", 4, 1, "abcdefghij", 5, 6, -1); - test("abcde", 4, 1, "abcdefghij", 9, 0, 1); - test("abcde", 4, 1, "abcdefghij", 9, 1, -5); -} - -void test16() -{ - test("abcde", 4, 1, "abcdefghij", 9, 2, -5); - test("abcde", 4, 1, "abcdefghij", 10, 0, 1); - test("abcde", 4, 1, "abcdefghij", 10, 1, 1); - test("abcde", 4, 1, "abcdefghij", 11, 0, 0); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 1, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 10, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 19, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 20, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 21, 4); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 1, 3); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 9, 3); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 18, 3); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 19, 3); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 20, 3); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 1, -6); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 5, -6); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 9, -6); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 10, -6); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 11, -6); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 1, -15); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 2, -15); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcde", 4, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 4, 2, "", 0, 0, 1); - test("abcde", 4, 2, "", 0, 1, 1); - test("abcde", 4, 2, "", 1, 0, 0); - test("abcde", 4, 2, "abcde", 0, 0, 1); - test("abcde", 4, 2, "abcde", 0, 1, 4); - test("abcde", 4, 2, "abcde", 0, 2, 4); - test("abcde", 4, 2, "abcde", 0, 4, 4); - test("abcde", 4, 2, "abcde", 0, 5, 4); - test("abcde", 4, 2, "abcde", 0, 6, 4); - test("abcde", 4, 2, "abcde", 1, 0, 1); - test("abcde", 4, 2, "abcde", 1, 1, 3); - test("abcde", 4, 2, "abcde", 1, 2, 3); - test("abcde", 4, 2, "abcde", 1, 3, 3); - test("abcde", 4, 2, "abcde", 1, 4, 3); - test("abcde", 4, 2, "abcde", 1, 5, 3); - test("abcde", 4, 2, "abcde", 2, 0, 1); - test("abcde", 4, 2, "abcde", 2, 1, 2); - test("abcde", 4, 2, "abcde", 2, 2, 2); - test("abcde", 4, 2, "abcde", 2, 3, 2); - test("abcde", 4, 2, "abcde", 2, 4, 2); - test("abcde", 4, 2, "abcde", 4, 0, 1); - test("abcde", 4, 2, "abcde", 4, 1, 0); - test("abcde", 4, 2, "abcde", 4, 2, 0); - test("abcde", 4, 2, "abcde", 5, 0, 1); - test("abcde", 4, 2, "abcde", 5, 1, 1); - test("abcde", 4, 2, "abcde", 6, 0, 0); - test("abcde", 4, 2, "abcdefghij", 0, 0, 1); - test("abcde", 4, 2, "abcdefghij", 0, 1, 4); - test("abcde", 4, 2, "abcdefghij", 0, 5, 4); - test("abcde", 4, 2, "abcdefghij", 0, 9, 4); - test("abcde", 4, 2, "abcdefghij", 0, 10, 4); - test("abcde", 4, 2, "abcdefghij", 0, 11, 4); - test("abcde", 4, 2, "abcdefghij", 1, 0, 1); - test("abcde", 4, 2, "abcdefghij", 1, 1, 3); - test("abcde", 4, 2, "abcdefghij", 1, 4, 3); - test("abcde", 4, 2, "abcdefghij", 1, 8, 3); - test("abcde", 4, 2, "abcdefghij", 1, 9, 3); - test("abcde", 4, 2, "abcdefghij", 1, 10, 3); - test("abcde", 4, 2, "abcdefghij", 5, 0, 1); - test("abcde", 4, 2, "abcdefghij", 5, 1, -1); - test("abcde", 4, 2, "abcdefghij", 5, 2, -1); - test("abcde", 4, 2, "abcdefghij", 5, 4, -1); - test("abcde", 4, 2, "abcdefghij", 5, 5, -1); - test("abcde", 4, 2, "abcdefghij", 5, 6, -1); - test("abcde", 4, 2, "abcdefghij", 9, 0, 1); - test("abcde", 4, 2, "abcdefghij", 9, 1, -5); - test("abcde", 4, 2, "abcdefghij", 9, 2, -5); - test("abcde", 4, 2, "abcdefghij", 10, 0, 1); - test("abcde", 4, 2, "abcdefghij", 10, 1, 1); - test("abcde", 4, 2, "abcdefghij", 11, 0, 0); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 1, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 10, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 19, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 20, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 21, 4); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 1, 3); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 9, 3); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 18, 3); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 19, 3); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 20, 3); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 1, -6); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 5, -6); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 9, -6); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 10, -6); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 11, -6); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 1, -15); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 2, -15); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 20, 0, 1); -} - -void test17() -{ - test("abcde", 4, 2, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcde", 4, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 5, 0, "", 0, 0, 0); - test("abcde", 5, 0, "", 0, 1, 0); - test("abcde", 5, 0, "", 1, 0, 0); - test("abcde", 5, 0, "abcde", 0, 0, 0); - test("abcde", 5, 0, "abcde", 0, 1, -1); - test("abcde", 5, 0, "abcde", 0, 2, -2); - test("abcde", 5, 0, "abcde", 0, 4, -4); - test("abcde", 5, 0, "abcde", 0, 5, -5); - test("abcde", 5, 0, "abcde", 0, 6, -5); - test("abcde", 5, 0, "abcde", 1, 0, 0); - test("abcde", 5, 0, "abcde", 1, 1, -1); - test("abcde", 5, 0, "abcde", 1, 2, -2); - test("abcde", 5, 0, "abcde", 1, 3, -3); - test("abcde", 5, 0, "abcde", 1, 4, -4); - test("abcde", 5, 0, "abcde", 1, 5, -4); - test("abcde", 5, 0, "abcde", 2, 0, 0); - test("abcde", 5, 0, "abcde", 2, 1, -1); - test("abcde", 5, 0, "abcde", 2, 2, -2); - test("abcde", 5, 0, "abcde", 2, 3, -3); - test("abcde", 5, 0, "abcde", 2, 4, -3); - test("abcde", 5, 0, "abcde", 4, 0, 0); - test("abcde", 5, 0, "abcde", 4, 1, -1); - test("abcde", 5, 0, "abcde", 4, 2, -1); - test("abcde", 5, 0, "abcde", 5, 0, 0); - test("abcde", 5, 0, "abcde", 5, 1, 0); - test("abcde", 5, 0, "abcde", 6, 0, 0); - test("abcde", 5, 0, "abcdefghij", 0, 0, 0); - test("abcde", 5, 0, "abcdefghij", 0, 1, -1); - test("abcde", 5, 0, "abcdefghij", 0, 5, -5); - test("abcde", 5, 0, "abcdefghij", 0, 9, -9); - test("abcde", 5, 0, "abcdefghij", 0, 10, -10); - test("abcde", 5, 0, "abcdefghij", 0, 11, -10); - test("abcde", 5, 0, "abcdefghij", 1, 0, 0); - test("abcde", 5, 0, "abcdefghij", 1, 1, -1); - test("abcde", 5, 0, "abcdefghij", 1, 4, -4); - test("abcde", 5, 0, "abcdefghij", 1, 8, -8); - test("abcde", 5, 0, "abcdefghij", 1, 9, -9); - test("abcde", 5, 0, "abcdefghij", 1, 10, -9); - test("abcde", 5, 0, "abcdefghij", 5, 0, 0); - test("abcde", 5, 0, "abcdefghij", 5, 1, -1); - test("abcde", 5, 0, "abcdefghij", 5, 2, -2); - test("abcde", 5, 0, "abcdefghij", 5, 4, -4); - test("abcde", 5, 0, "abcdefghij", 5, 5, -5); - test("abcde", 5, 0, "abcdefghij", 5, 6, -5); - test("abcde", 5, 0, "abcdefghij", 9, 0, 0); - test("abcde", 5, 0, "abcdefghij", 9, 1, -1); - test("abcde", 5, 0, "abcdefghij", 9, 2, -1); - test("abcde", 5, 0, "abcdefghij", 10, 0, 0); - test("abcde", 5, 0, "abcdefghij", 10, 1, 0); - test("abcde", 5, 0, "abcdefghij", 11, 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 5, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 5, 1, "", 0, 0, 0); - test("abcde", 5, 1, "", 0, 1, 0); - test("abcde", 5, 1, "", 1, 0, 0); - test("abcde", 5, 1, "abcde", 0, 0, 0); - test("abcde", 5, 1, "abcde", 0, 1, -1); - test("abcde", 5, 1, "abcde", 0, 2, -2); - test("abcde", 5, 1, "abcde", 0, 4, -4); - test("abcde", 5, 1, "abcde", 0, 5, -5); - test("abcde", 5, 1, "abcde", 0, 6, -5); - test("abcde", 5, 1, "abcde", 1, 0, 0); - test("abcde", 5, 1, "abcde", 1, 1, -1); - test("abcde", 5, 1, "abcde", 1, 2, -2); - test("abcde", 5, 1, "abcde", 1, 3, -3); - test("abcde", 5, 1, "abcde", 1, 4, -4); - test("abcde", 5, 1, "abcde", 1, 5, -4); - test("abcde", 5, 1, "abcde", 2, 0, 0); - test("abcde", 5, 1, "abcde", 2, 1, -1); - test("abcde", 5, 1, "abcde", 2, 2, -2); - test("abcde", 5, 1, "abcde", 2, 3, -3); - test("abcde", 5, 1, "abcde", 2, 4, -3); - test("abcde", 5, 1, "abcde", 4, 0, 0); - test("abcde", 5, 1, "abcde", 4, 1, -1); - test("abcde", 5, 1, "abcde", 4, 2, -1); - test("abcde", 5, 1, "abcde", 5, 0, 0); -} - -void test18() -{ - test("abcde", 5, 1, "abcde", 5, 1, 0); - test("abcde", 5, 1, "abcde", 6, 0, 0); - test("abcde", 5, 1, "abcdefghij", 0, 0, 0); - test("abcde", 5, 1, "abcdefghij", 0, 1, -1); - test("abcde", 5, 1, "abcdefghij", 0, 5, -5); - test("abcde", 5, 1, "abcdefghij", 0, 9, -9); - test("abcde", 5, 1, "abcdefghij", 0, 10, -10); - test("abcde", 5, 1, "abcdefghij", 0, 11, -10); - test("abcde", 5, 1, "abcdefghij", 1, 0, 0); - test("abcde", 5, 1, "abcdefghij", 1, 1, -1); - test("abcde", 5, 1, "abcdefghij", 1, 4, -4); - test("abcde", 5, 1, "abcdefghij", 1, 8, -8); - test("abcde", 5, 1, "abcdefghij", 1, 9, -9); - test("abcde", 5, 1, "abcdefghij", 1, 10, -9); - test("abcde", 5, 1, "abcdefghij", 5, 0, 0); - test("abcde", 5, 1, "abcdefghij", 5, 1, -1); - test("abcde", 5, 1, "abcdefghij", 5, 2, -2); - test("abcde", 5, 1, "abcdefghij", 5, 4, -4); - test("abcde", 5, 1, "abcdefghij", 5, 5, -5); - test("abcde", 5, 1, "abcdefghij", 5, 6, -5); - test("abcde", 5, 1, "abcdefghij", 9, 0, 0); - test("abcde", 5, 1, "abcdefghij", 9, 1, -1); - test("abcde", 5, 1, "abcdefghij", 9, 2, -1); - test("abcde", 5, 1, "abcdefghij", 10, 0, 0); - test("abcde", 5, 1, "abcdefghij", 10, 1, 0); - test("abcde", 5, 1, "abcdefghij", 11, 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 5, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcde", 6, 0, "", 0, 0, 0); - test("abcde", 6, 0, "", 0, 1, 0); - test("abcde", 6, 0, "", 1, 0, 0); - test("abcde", 6, 0, "abcde", 0, 0, 0); - test("abcde", 6, 0, "abcde", 0, 1, 0); - test("abcde", 6, 0, "abcde", 0, 2, 0); - test("abcde", 6, 0, "abcde", 0, 4, 0); - test("abcde", 6, 0, "abcde", 0, 5, 0); - test("abcde", 6, 0, "abcde", 0, 6, 0); - test("abcde", 6, 0, "abcde", 1, 0, 0); - test("abcde", 6, 0, "abcde", 1, 1, 0); - test("abcde", 6, 0, "abcde", 1, 2, 0); - test("abcde", 6, 0, "abcde", 1, 3, 0); - test("abcde", 6, 0, "abcde", 1, 4, 0); - test("abcde", 6, 0, "abcde", 1, 5, 0); - test("abcde", 6, 0, "abcde", 2, 0, 0); - test("abcde", 6, 0, "abcde", 2, 1, 0); - test("abcde", 6, 0, "abcde", 2, 2, 0); - test("abcde", 6, 0, "abcde", 2, 3, 0); - test("abcde", 6, 0, "abcde", 2, 4, 0); - test("abcde", 6, 0, "abcde", 4, 0, 0); - test("abcde", 6, 0, "abcde", 4, 1, 0); - test("abcde", 6, 0, "abcde", 4, 2, 0); - test("abcde", 6, 0, "abcde", 5, 0, 0); - test("abcde", 6, 0, "abcde", 5, 1, 0); - test("abcde", 6, 0, "abcde", 6, 0, 0); - test("abcde", 6, 0, "abcdefghij", 0, 0, 0); - test("abcde", 6, 0, "abcdefghij", 0, 1, 0); - test("abcde", 6, 0, "abcdefghij", 0, 5, 0); - test("abcde", 6, 0, "abcdefghij", 0, 9, 0); - test("abcde", 6, 0, "abcdefghij", 0, 10, 0); - test("abcde", 6, 0, "abcdefghij", 0, 11, 0); - test("abcde", 6, 0, "abcdefghij", 1, 0, 0); - test("abcde", 6, 0, "abcdefghij", 1, 1, 0); - test("abcde", 6, 0, "abcdefghij", 1, 4, 0); - test("abcde", 6, 0, "abcdefghij", 1, 8, 0); - test("abcde", 6, 0, "abcdefghij", 1, 9, 0); - test("abcde", 6, 0, "abcdefghij", 1, 10, 0); - test("abcde", 6, 0, "abcdefghij", 5, 0, 0); - test("abcde", 6, 0, "abcdefghij", 5, 1, 0); - test("abcde", 6, 0, "abcdefghij", 5, 2, 0); - test("abcde", 6, 0, "abcdefghij", 5, 4, 0); - test("abcde", 6, 0, "abcdefghij", 5, 5, 0); - test("abcde", 6, 0, "abcdefghij", 5, 6, 0); - test("abcde", 6, 0, "abcdefghij", 9, 0, 0); - test("abcde", 6, 0, "abcdefghij", 9, 1, 0); - test("abcde", 6, 0, "abcdefghij", 9, 2, 0); - test("abcde", 6, 0, "abcdefghij", 10, 0, 0); - test("abcde", 6, 0, "abcdefghij", 10, 1, 0); - test("abcde", 6, 0, "abcdefghij", 11, 0, 0); -} - -void test19() -{ - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 1, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 10, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 19, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 20, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 21, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 1, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 9, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 18, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 19, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 20, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 1, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 5, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 9, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 10, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 11, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 1, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 2, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcde", 6, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 0, 0, "", 0, 0, 0); - test("abcdefghij", 0, 0, "", 0, 1, 0); - test("abcdefghij", 0, 0, "", 1, 0, 0); - test("abcdefghij", 0, 0, "abcde", 0, 0, 0); - test("abcdefghij", 0, 0, "abcde", 0, 1, -1); - test("abcdefghij", 0, 0, "abcde", 0, 2, -2); - test("abcdefghij", 0, 0, "abcde", 0, 4, -4); - test("abcdefghij", 0, 0, "abcde", 0, 5, -5); - test("abcdefghij", 0, 0, "abcde", 0, 6, -5); - test("abcdefghij", 0, 0, "abcde", 1, 0, 0); - test("abcdefghij", 0, 0, "abcde", 1, 1, -1); - test("abcdefghij", 0, 0, "abcde", 1, 2, -2); - test("abcdefghij", 0, 0, "abcde", 1, 3, -3); - test("abcdefghij", 0, 0, "abcde", 1, 4, -4); - test("abcdefghij", 0, 0, "abcde", 1, 5, -4); - test("abcdefghij", 0, 0, "abcde", 2, 0, 0); - test("abcdefghij", 0, 0, "abcde", 2, 1, -1); - test("abcdefghij", 0, 0, "abcde", 2, 2, -2); - test("abcdefghij", 0, 0, "abcde", 2, 3, -3); - test("abcdefghij", 0, 0, "abcde", 2, 4, -3); - test("abcdefghij", 0, 0, "abcde", 4, 0, 0); - test("abcdefghij", 0, 0, "abcde", 4, 1, -1); - test("abcdefghij", 0, 0, "abcde", 4, 2, -1); - test("abcdefghij", 0, 0, "abcde", 5, 0, 0); - test("abcdefghij", 0, 0, "abcde", 5, 1, 0); - test("abcdefghij", 0, 0, "abcde", 6, 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 0, 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 0, 1, -1); - test("abcdefghij", 0, 0, "abcdefghij", 0, 5, -5); - test("abcdefghij", 0, 0, "abcdefghij", 0, 9, -9); - test("abcdefghij", 0, 0, "abcdefghij", 0, 10, -10); - test("abcdefghij", 0, 0, "abcdefghij", 0, 11, -10); - test("abcdefghij", 0, 0, "abcdefghij", 1, 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 1, 1, -1); - test("abcdefghij", 0, 0, "abcdefghij", 1, 4, -4); - test("abcdefghij", 0, 0, "abcdefghij", 1, 8, -8); - test("abcdefghij", 0, 0, "abcdefghij", 1, 9, -9); - test("abcdefghij", 0, 0, "abcdefghij", 1, 10, -9); - test("abcdefghij", 0, 0, "abcdefghij", 5, 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 5, 1, -1); - test("abcdefghij", 0, 0, "abcdefghij", 5, 2, -2); - test("abcdefghij", 0, 0, "abcdefghij", 5, 4, -4); - test("abcdefghij", 0, 0, "abcdefghij", 5, 5, -5); - test("abcdefghij", 0, 0, "abcdefghij", 5, 6, -5); - test("abcdefghij", 0, 0, "abcdefghij", 9, 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 9, 1, -1); - test("abcdefghij", 0, 0, "abcdefghij", 9, 2, -1); - test("abcdefghij", 0, 0, "abcdefghij", 10, 0, 0); - test("abcdefghij", 0, 0, "abcdefghij", 10, 1, 0); - test("abcdefghij", 0, 0, "abcdefghij", 11, 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 0, 1, "", 0, 0, 1); - test("abcdefghij", 0, 1, "", 0, 1, 1); -} - -void test20() -{ - test("abcdefghij", 0, 1, "", 1, 0, 0); - test("abcdefghij", 0, 1, "abcde", 0, 0, 1); - test("abcdefghij", 0, 1, "abcde", 0, 1, 0); - test("abcdefghij", 0, 1, "abcde", 0, 2, -1); - test("abcdefghij", 0, 1, "abcde", 0, 4, -3); - test("abcdefghij", 0, 1, "abcde", 0, 5, -4); - test("abcdefghij", 0, 1, "abcde", 0, 6, -4); - test("abcdefghij", 0, 1, "abcde", 1, 0, 1); - test("abcdefghij", 0, 1, "abcde", 1, 1, -1); - test("abcdefghij", 0, 1, "abcde", 1, 2, -1); - test("abcdefghij", 0, 1, "abcde", 1, 3, -1); - test("abcdefghij", 0, 1, "abcde", 1, 4, -1); - test("abcdefghij", 0, 1, "abcde", 1, 5, -1); - test("abcdefghij", 0, 1, "abcde", 2, 0, 1); - test("abcdefghij", 0, 1, "abcde", 2, 1, -2); - test("abcdefghij", 0, 1, "abcde", 2, 2, -2); - test("abcdefghij", 0, 1, "abcde", 2, 3, -2); - test("abcdefghij", 0, 1, "abcde", 2, 4, -2); - test("abcdefghij", 0, 1, "abcde", 4, 0, 1); - test("abcdefghij", 0, 1, "abcde", 4, 1, -4); - test("abcdefghij", 0, 1, "abcde", 4, 2, -4); - test("abcdefghij", 0, 1, "abcde", 5, 0, 1); - test("abcdefghij", 0, 1, "abcde", 5, 1, 1); - test("abcdefghij", 0, 1, "abcde", 6, 0, 0); - test("abcdefghij", 0, 1, "abcdefghij", 0, 0, 1); - test("abcdefghij", 0, 1, "abcdefghij", 0, 1, 0); - test("abcdefghij", 0, 1, "abcdefghij", 0, 5, -4); - test("abcdefghij", 0, 1, "abcdefghij", 0, 9, -8); - test("abcdefghij", 0, 1, "abcdefghij", 0, 10, -9); - test("abcdefghij", 0, 1, "abcdefghij", 0, 11, -9); - test("abcdefghij", 0, 1, "abcdefghij", 1, 0, 1); - test("abcdefghij", 0, 1, "abcdefghij", 1, 1, -1); - test("abcdefghij", 0, 1, "abcdefghij", 1, 4, -1); - test("abcdefghij", 0, 1, "abcdefghij", 1, 8, -1); - test("abcdefghij", 0, 1, "abcdefghij", 1, 9, -1); - test("abcdefghij", 0, 1, "abcdefghij", 1, 10, -1); - test("abcdefghij", 0, 1, "abcdefghij", 5, 0, 1); - test("abcdefghij", 0, 1, "abcdefghij", 5, 1, -5); - test("abcdefghij", 0, 1, "abcdefghij", 5, 2, -5); - test("abcdefghij", 0, 1, "abcdefghij", 5, 4, -5); - test("abcdefghij", 0, 1, "abcdefghij", 5, 5, -5); - test("abcdefghij", 0, 1, "abcdefghij", 5, 6, -5); - test("abcdefghij", 0, 1, "abcdefghij", 9, 0, 1); - test("abcdefghij", 0, 1, "abcdefghij", 9, 1, -9); - test("abcdefghij", 0, 1, "abcdefghij", 9, 2, -9); - test("abcdefghij", 0, 1, "abcdefghij", 10, 0, 1); - test("abcdefghij", 0, 1, "abcdefghij", 10, 1, 1); - test("abcdefghij", 0, 1, "abcdefghij", 11, 0, 0); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 1, 0); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 10, -9); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 19, -18); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 20, -19); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 21, -19); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 0, 5, "", 0, 0, 5); - test("abcdefghij", 0, 5, "", 0, 1, 5); - test("abcdefghij", 0, 5, "", 1, 0, 0); - test("abcdefghij", 0, 5, "abcde", 0, 0, 5); - test("abcdefghij", 0, 5, "abcde", 0, 1, 4); - test("abcdefghij", 0, 5, "abcde", 0, 2, 3); - test("abcdefghij", 0, 5, "abcde", 0, 4, 1); - test("abcdefghij", 0, 5, "abcde", 0, 5, 0); - test("abcdefghij", 0, 5, "abcde", 0, 6, 0); - test("abcdefghij", 0, 5, "abcde", 1, 0, 5); - test("abcdefghij", 0, 5, "abcde", 1, 1, -1); - test("abcdefghij", 0, 5, "abcde", 1, 2, -1); - test("abcdefghij", 0, 5, "abcde", 1, 3, -1); - test("abcdefghij", 0, 5, "abcde", 1, 4, -1); - test("abcdefghij", 0, 5, "abcde", 1, 5, -1); - test("abcdefghij", 0, 5, "abcde", 2, 0, 5); - test("abcdefghij", 0, 5, "abcde", 2, 1, -2); - test("abcdefghij", 0, 5, "abcde", 2, 2, -2); - test("abcdefghij", 0, 5, "abcde", 2, 3, -2); - test("abcdefghij", 0, 5, "abcde", 2, 4, -2); - test("abcdefghij", 0, 5, "abcde", 4, 0, 5); - test("abcdefghij", 0, 5, "abcde", 4, 1, -4); - test("abcdefghij", 0, 5, "abcde", 4, 2, -4); - test("abcdefghij", 0, 5, "abcde", 5, 0, 5); - test("abcdefghij", 0, 5, "abcde", 5, 1, 5); - test("abcdefghij", 0, 5, "abcde", 6, 0, 0); - test("abcdefghij", 0, 5, "abcdefghij", 0, 0, 5); - test("abcdefghij", 0, 5, "abcdefghij", 0, 1, 4); -} - -void test21() -{ - test("abcdefghij", 0, 5, "abcdefghij", 0, 5, 0); - test("abcdefghij", 0, 5, "abcdefghij", 0, 9, -4); - test("abcdefghij", 0, 5, "abcdefghij", 0, 10, -5); - test("abcdefghij", 0, 5, "abcdefghij", 0, 11, -5); - test("abcdefghij", 0, 5, "abcdefghij", 1, 0, 5); - test("abcdefghij", 0, 5, "abcdefghij", 1, 1, -1); - test("abcdefghij", 0, 5, "abcdefghij", 1, 4, -1); - test("abcdefghij", 0, 5, "abcdefghij", 1, 8, -1); - test("abcdefghij", 0, 5, "abcdefghij", 1, 9, -1); - test("abcdefghij", 0, 5, "abcdefghij", 1, 10, -1); - test("abcdefghij", 0, 5, "abcdefghij", 5, 0, 5); - test("abcdefghij", 0, 5, "abcdefghij", 5, 1, -5); - test("abcdefghij", 0, 5, "abcdefghij", 5, 2, -5); - test("abcdefghij", 0, 5, "abcdefghij", 5, 4, -5); - test("abcdefghij", 0, 5, "abcdefghij", 5, 5, -5); - test("abcdefghij", 0, 5, "abcdefghij", 5, 6, -5); - test("abcdefghij", 0, 5, "abcdefghij", 9, 0, 5); - test("abcdefghij", 0, 5, "abcdefghij", 9, 1, -9); - test("abcdefghij", 0, 5, "abcdefghij", 9, 2, -9); - test("abcdefghij", 0, 5, "abcdefghij", 10, 0, 5); - test("abcdefghij", 0, 5, "abcdefghij", 10, 1, 5); - test("abcdefghij", 0, 5, "abcdefghij", 11, 0, 0); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 0, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 1, 4); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 10, -5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 19, -14); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 20, -15); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 21, -15); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 0, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 0, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, 0, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 20, 0, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 20, 1, 5); - test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 0, 9, "", 0, 0, 9); - test("abcdefghij", 0, 9, "", 0, 1, 9); - test("abcdefghij", 0, 9, "", 1, 0, 0); - test("abcdefghij", 0, 9, "abcde", 0, 0, 9); - test("abcdefghij", 0, 9, "abcde", 0, 1, 8); - test("abcdefghij", 0, 9, "abcde", 0, 2, 7); - test("abcdefghij", 0, 9, "abcde", 0, 4, 5); - test("abcdefghij", 0, 9, "abcde", 0, 5, 4); - test("abcdefghij", 0, 9, "abcde", 0, 6, 4); - test("abcdefghij", 0, 9, "abcde", 1, 0, 9); - test("abcdefghij", 0, 9, "abcde", 1, 1, -1); - test("abcdefghij", 0, 9, "abcde", 1, 2, -1); - test("abcdefghij", 0, 9, "abcde", 1, 3, -1); - test("abcdefghij", 0, 9, "abcde", 1, 4, -1); - test("abcdefghij", 0, 9, "abcde", 1, 5, -1); - test("abcdefghij", 0, 9, "abcde", 2, 0, 9); - test("abcdefghij", 0, 9, "abcde", 2, 1, -2); - test("abcdefghij", 0, 9, "abcde", 2, 2, -2); - test("abcdefghij", 0, 9, "abcde", 2, 3, -2); - test("abcdefghij", 0, 9, "abcde", 2, 4, -2); - test("abcdefghij", 0, 9, "abcde", 4, 0, 9); - test("abcdefghij", 0, 9, "abcde", 4, 1, -4); - test("abcdefghij", 0, 9, "abcde", 4, 2, -4); - test("abcdefghij", 0, 9, "abcde", 5, 0, 9); - test("abcdefghij", 0, 9, "abcde", 5, 1, 9); - test("abcdefghij", 0, 9, "abcde", 6, 0, 0); - test("abcdefghij", 0, 9, "abcdefghij", 0, 0, 9); - test("abcdefghij", 0, 9, "abcdefghij", 0, 1, 8); - test("abcdefghij", 0, 9, "abcdefghij", 0, 5, 4); - test("abcdefghij", 0, 9, "abcdefghij", 0, 9, 0); - test("abcdefghij", 0, 9, "abcdefghij", 0, 10, -1); - test("abcdefghij", 0, 9, "abcdefghij", 0, 11, -1); - test("abcdefghij", 0, 9, "abcdefghij", 1, 0, 9); - test("abcdefghij", 0, 9, "abcdefghij", 1, 1, -1); - test("abcdefghij", 0, 9, "abcdefghij", 1, 4, -1); - test("abcdefghij", 0, 9, "abcdefghij", 1, 8, -1); - test("abcdefghij", 0, 9, "abcdefghij", 1, 9, -1); - test("abcdefghij", 0, 9, "abcdefghij", 1, 10, -1); - test("abcdefghij", 0, 9, "abcdefghij", 5, 0, 9); - test("abcdefghij", 0, 9, "abcdefghij", 5, 1, -5); - test("abcdefghij", 0, 9, "abcdefghij", 5, 2, -5); - test("abcdefghij", 0, 9, "abcdefghij", 5, 4, -5); - test("abcdefghij", 0, 9, "abcdefghij", 5, 5, -5); - test("abcdefghij", 0, 9, "abcdefghij", 5, 6, -5); - test("abcdefghij", 0, 9, "abcdefghij", 9, 0, 9); - test("abcdefghij", 0, 9, "abcdefghij", 9, 1, -9); - test("abcdefghij", 0, 9, "abcdefghij", 9, 2, -9); - test("abcdefghij", 0, 9, "abcdefghij", 10, 0, 9); - test("abcdefghij", 0, 9, "abcdefghij", 10, 1, 9); - test("abcdefghij", 0, 9, "abcdefghij", 11, 0, 0); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 0, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 1, 8); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 10, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 19, -10); -} - -void test22() -{ - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 20, -11); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 21, -11); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 0, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 0, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, 0, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 20, 0, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 20, 1, 9); - test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 0, 10, "", 0, 0, 10); - test("abcdefghij", 0, 10, "", 0, 1, 10); - test("abcdefghij", 0, 10, "", 1, 0, 0); - test("abcdefghij", 0, 10, "abcde", 0, 0, 10); - test("abcdefghij", 0, 10, "abcde", 0, 1, 9); - test("abcdefghij", 0, 10, "abcde", 0, 2, 8); - test("abcdefghij", 0, 10, "abcde", 0, 4, 6); - test("abcdefghij", 0, 10, "abcde", 0, 5, 5); - test("abcdefghij", 0, 10, "abcde", 0, 6, 5); - test("abcdefghij", 0, 10, "abcde", 1, 0, 10); - test("abcdefghij", 0, 10, "abcde", 1, 1, -1); - test("abcdefghij", 0, 10, "abcde", 1, 2, -1); - test("abcdefghij", 0, 10, "abcde", 1, 3, -1); - test("abcdefghij", 0, 10, "abcde", 1, 4, -1); - test("abcdefghij", 0, 10, "abcde", 1, 5, -1); - test("abcdefghij", 0, 10, "abcde", 2, 0, 10); - test("abcdefghij", 0, 10, "abcde", 2, 1, -2); - test("abcdefghij", 0, 10, "abcde", 2, 2, -2); - test("abcdefghij", 0, 10, "abcde", 2, 3, -2); - test("abcdefghij", 0, 10, "abcde", 2, 4, -2); - test("abcdefghij", 0, 10, "abcde", 4, 0, 10); - test("abcdefghij", 0, 10, "abcde", 4, 1, -4); - test("abcdefghij", 0, 10, "abcde", 4, 2, -4); - test("abcdefghij", 0, 10, "abcde", 5, 0, 10); - test("abcdefghij", 0, 10, "abcde", 5, 1, 10); - test("abcdefghij", 0, 10, "abcde", 6, 0, 0); - test("abcdefghij", 0, 10, "abcdefghij", 0, 0, 10); - test("abcdefghij", 0, 10, "abcdefghij", 0, 1, 9); - test("abcdefghij", 0, 10, "abcdefghij", 0, 5, 5); - test("abcdefghij", 0, 10, "abcdefghij", 0, 9, 1); - test("abcdefghij", 0, 10, "abcdefghij", 0, 10, 0); - test("abcdefghij", 0, 10, "abcdefghij", 0, 11, 0); - test("abcdefghij", 0, 10, "abcdefghij", 1, 0, 10); - test("abcdefghij", 0, 10, "abcdefghij", 1, 1, -1); - test("abcdefghij", 0, 10, "abcdefghij", 1, 4, -1); - test("abcdefghij", 0, 10, "abcdefghij", 1, 8, -1); - test("abcdefghij", 0, 10, "abcdefghij", 1, 9, -1); - test("abcdefghij", 0, 10, "abcdefghij", 1, 10, -1); - test("abcdefghij", 0, 10, "abcdefghij", 5, 0, 10); - test("abcdefghij", 0, 10, "abcdefghij", 5, 1, -5); - test("abcdefghij", 0, 10, "abcdefghij", 5, 2, -5); - test("abcdefghij", 0, 10, "abcdefghij", 5, 4, -5); - test("abcdefghij", 0, 10, "abcdefghij", 5, 5, -5); - test("abcdefghij", 0, 10, "abcdefghij", 5, 6, -5); - test("abcdefghij", 0, 10, "abcdefghij", 9, 0, 10); - test("abcdefghij", 0, 10, "abcdefghij", 9, 1, -9); - test("abcdefghij", 0, 10, "abcdefghij", 9, 2, -9); - test("abcdefghij", 0, 10, "abcdefghij", 10, 0, 10); - test("abcdefghij", 0, 10, "abcdefghij", 10, 1, 10); - test("abcdefghij", 0, 10, "abcdefghij", 11, 0, 0); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 0, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 1, 9); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 10, 0); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 19, -9); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 20, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 21, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 0, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 0, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, 0, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 20, 0, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 20, 1, 10); - test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 0, 11, "", 0, 0, 10); - test("abcdefghij", 0, 11, "", 0, 1, 10); - test("abcdefghij", 0, 11, "", 1, 0, 0); - test("abcdefghij", 0, 11, "abcde", 0, 0, 10); - test("abcdefghij", 0, 11, "abcde", 0, 1, 9); - test("abcdefghij", 0, 11, "abcde", 0, 2, 8); -} - -void test23() -{ - test("abcdefghij", 0, 11, "abcde", 0, 4, 6); - test("abcdefghij", 0, 11, "abcde", 0, 5, 5); - test("abcdefghij", 0, 11, "abcde", 0, 6, 5); - test("abcdefghij", 0, 11, "abcde", 1, 0, 10); - test("abcdefghij", 0, 11, "abcde", 1, 1, -1); - test("abcdefghij", 0, 11, "abcde", 1, 2, -1); - test("abcdefghij", 0, 11, "abcde", 1, 3, -1); - test("abcdefghij", 0, 11, "abcde", 1, 4, -1); - test("abcdefghij", 0, 11, "abcde", 1, 5, -1); - test("abcdefghij", 0, 11, "abcde", 2, 0, 10); - test("abcdefghij", 0, 11, "abcde", 2, 1, -2); - test("abcdefghij", 0, 11, "abcde", 2, 2, -2); - test("abcdefghij", 0, 11, "abcde", 2, 3, -2); - test("abcdefghij", 0, 11, "abcde", 2, 4, -2); - test("abcdefghij", 0, 11, "abcde", 4, 0, 10); - test("abcdefghij", 0, 11, "abcde", 4, 1, -4); - test("abcdefghij", 0, 11, "abcde", 4, 2, -4); - test("abcdefghij", 0, 11, "abcde", 5, 0, 10); - test("abcdefghij", 0, 11, "abcde", 5, 1, 10); - test("abcdefghij", 0, 11, "abcde", 6, 0, 0); - test("abcdefghij", 0, 11, "abcdefghij", 0, 0, 10); - test("abcdefghij", 0, 11, "abcdefghij", 0, 1, 9); - test("abcdefghij", 0, 11, "abcdefghij", 0, 5, 5); - test("abcdefghij", 0, 11, "abcdefghij", 0, 9, 1); - test("abcdefghij", 0, 11, "abcdefghij", 0, 10, 0); - test("abcdefghij", 0, 11, "abcdefghij", 0, 11, 0); - test("abcdefghij", 0, 11, "abcdefghij", 1, 0, 10); - test("abcdefghij", 0, 11, "abcdefghij", 1, 1, -1); - test("abcdefghij", 0, 11, "abcdefghij", 1, 4, -1); - test("abcdefghij", 0, 11, "abcdefghij", 1, 8, -1); - test("abcdefghij", 0, 11, "abcdefghij", 1, 9, -1); - test("abcdefghij", 0, 11, "abcdefghij", 1, 10, -1); - test("abcdefghij", 0, 11, "abcdefghij", 5, 0, 10); - test("abcdefghij", 0, 11, "abcdefghij", 5, 1, -5); - test("abcdefghij", 0, 11, "abcdefghij", 5, 2, -5); - test("abcdefghij", 0, 11, "abcdefghij", 5, 4, -5); - test("abcdefghij", 0, 11, "abcdefghij", 5, 5, -5); - test("abcdefghij", 0, 11, "abcdefghij", 5, 6, -5); - test("abcdefghij", 0, 11, "abcdefghij", 9, 0, 10); - test("abcdefghij", 0, 11, "abcdefghij", 9, 1, -9); - test("abcdefghij", 0, 11, "abcdefghij", 9, 2, -9); - test("abcdefghij", 0, 11, "abcdefghij", 10, 0, 10); - test("abcdefghij", 0, 11, "abcdefghij", 10, 1, 10); - test("abcdefghij", 0, 11, "abcdefghij", 11, 0, 0); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 0, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 1, 9); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 10, 0); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 19, -9); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 20, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 21, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 0, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 0, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, 0, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 20, 0, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 20, 1, 10); - test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 1, 0, "", 0, 0, 0); - test("abcdefghij", 1, 0, "", 0, 1, 0); - test("abcdefghij", 1, 0, "", 1, 0, 0); - test("abcdefghij", 1, 0, "abcde", 0, 0, 0); - test("abcdefghij", 1, 0, "abcde", 0, 1, -1); - test("abcdefghij", 1, 0, "abcde", 0, 2, -2); - test("abcdefghij", 1, 0, "abcde", 0, 4, -4); - test("abcdefghij", 1, 0, "abcde", 0, 5, -5); - test("abcdefghij", 1, 0, "abcde", 0, 6, -5); - test("abcdefghij", 1, 0, "abcde", 1, 0, 0); - test("abcdefghij", 1, 0, "abcde", 1, 1, -1); - test("abcdefghij", 1, 0, "abcde", 1, 2, -2); - test("abcdefghij", 1, 0, "abcde", 1, 3, -3); - test("abcdefghij", 1, 0, "abcde", 1, 4, -4); - test("abcdefghij", 1, 0, "abcde", 1, 5, -4); - test("abcdefghij", 1, 0, "abcde", 2, 0, 0); - test("abcdefghij", 1, 0, "abcde", 2, 1, -1); - test("abcdefghij", 1, 0, "abcde", 2, 2, -2); - test("abcdefghij", 1, 0, "abcde", 2, 3, -3); - test("abcdefghij", 1, 0, "abcde", 2, 4, -3); - test("abcdefghij", 1, 0, "abcde", 4, 0, 0); - test("abcdefghij", 1, 0, "abcde", 4, 1, -1); - test("abcdefghij", 1, 0, "abcde", 4, 2, -1); - test("abcdefghij", 1, 0, "abcde", 5, 0, 0); - test("abcdefghij", 1, 0, "abcde", 5, 1, 0); - test("abcdefghij", 1, 0, "abcde", 6, 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 0, 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 0, 1, -1); - test("abcdefghij", 1, 0, "abcdefghij", 0, 5, -5); - test("abcdefghij", 1, 0, "abcdefghij", 0, 9, -9); - test("abcdefghij", 1, 0, "abcdefghij", 0, 10, -10); - test("abcdefghij", 1, 0, "abcdefghij", 0, 11, -10); -} - -void test24() -{ - test("abcdefghij", 1, 0, "abcdefghij", 1, 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 1, 1, -1); - test("abcdefghij", 1, 0, "abcdefghij", 1, 4, -4); - test("abcdefghij", 1, 0, "abcdefghij", 1, 8, -8); - test("abcdefghij", 1, 0, "abcdefghij", 1, 9, -9); - test("abcdefghij", 1, 0, "abcdefghij", 1, 10, -9); - test("abcdefghij", 1, 0, "abcdefghij", 5, 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 5, 1, -1); - test("abcdefghij", 1, 0, "abcdefghij", 5, 2, -2); - test("abcdefghij", 1, 0, "abcdefghij", 5, 4, -4); - test("abcdefghij", 1, 0, "abcdefghij", 5, 5, -5); - test("abcdefghij", 1, 0, "abcdefghij", 5, 6, -5); - test("abcdefghij", 1, 0, "abcdefghij", 9, 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 9, 1, -1); - test("abcdefghij", 1, 0, "abcdefghij", 9, 2, -1); - test("abcdefghij", 1, 0, "abcdefghij", 10, 0, 0); - test("abcdefghij", 1, 0, "abcdefghij", 10, 1, 0); - test("abcdefghij", 1, 0, "abcdefghij", 11, 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 1, 1, "", 0, 0, 1); - test("abcdefghij", 1, 1, "", 0, 1, 1); - test("abcdefghij", 1, 1, "", 1, 0, 0); - test("abcdefghij", 1, 1, "abcde", 0, 0, 1); - test("abcdefghij", 1, 1, "abcde", 0, 1, 1); - test("abcdefghij", 1, 1, "abcde", 0, 2, 1); - test("abcdefghij", 1, 1, "abcde", 0, 4, 1); - test("abcdefghij", 1, 1, "abcde", 0, 5, 1); - test("abcdefghij", 1, 1, "abcde", 0, 6, 1); - test("abcdefghij", 1, 1, "abcde", 1, 0, 1); - test("abcdefghij", 1, 1, "abcde", 1, 1, 0); - test("abcdefghij", 1, 1, "abcde", 1, 2, -1); - test("abcdefghij", 1, 1, "abcde", 1, 3, -2); - test("abcdefghij", 1, 1, "abcde", 1, 4, -3); - test("abcdefghij", 1, 1, "abcde", 1, 5, -3); - test("abcdefghij", 1, 1, "abcde", 2, 0, 1); - test("abcdefghij", 1, 1, "abcde", 2, 1, -1); - test("abcdefghij", 1, 1, "abcde", 2, 2, -1); - test("abcdefghij", 1, 1, "abcde", 2, 3, -1); - test("abcdefghij", 1, 1, "abcde", 2, 4, -1); - test("abcdefghij", 1, 1, "abcde", 4, 0, 1); - test("abcdefghij", 1, 1, "abcde", 4, 1, -3); - test("abcdefghij", 1, 1, "abcde", 4, 2, -3); - test("abcdefghij", 1, 1, "abcde", 5, 0, 1); - test("abcdefghij", 1, 1, "abcde", 5, 1, 1); - test("abcdefghij", 1, 1, "abcde", 6, 0, 0); - test("abcdefghij", 1, 1, "abcdefghij", 0, 0, 1); - test("abcdefghij", 1, 1, "abcdefghij", 0, 1, 1); - test("abcdefghij", 1, 1, "abcdefghij", 0, 5, 1); - test("abcdefghij", 1, 1, "abcdefghij", 0, 9, 1); - test("abcdefghij", 1, 1, "abcdefghij", 0, 10, 1); - test("abcdefghij", 1, 1, "abcdefghij", 0, 11, 1); - test("abcdefghij", 1, 1, "abcdefghij", 1, 0, 1); - test("abcdefghij", 1, 1, "abcdefghij", 1, 1, 0); - test("abcdefghij", 1, 1, "abcdefghij", 1, 4, -3); - test("abcdefghij", 1, 1, "abcdefghij", 1, 8, -7); - test("abcdefghij", 1, 1, "abcdefghij", 1, 9, -8); - test("abcdefghij", 1, 1, "abcdefghij", 1, 10, -8); - test("abcdefghij", 1, 1, "abcdefghij", 5, 0, 1); - test("abcdefghij", 1, 1, "abcdefghij", 5, 1, -4); - test("abcdefghij", 1, 1, "abcdefghij", 5, 2, -4); - test("abcdefghij", 1, 1, "abcdefghij", 5, 4, -4); - test("abcdefghij", 1, 1, "abcdefghij", 5, 5, -4); - test("abcdefghij", 1, 1, "abcdefghij", 5, 6, -4); - test("abcdefghij", 1, 1, "abcdefghij", 9, 0, 1); - test("abcdefghij", 1, 1, "abcdefghij", 9, 1, -8); - test("abcdefghij", 1, 1, "abcdefghij", 9, 2, -8); - test("abcdefghij", 1, 1, "abcdefghij", 10, 0, 1); - test("abcdefghij", 1, 1, "abcdefghij", 10, 1, 1); - test("abcdefghij", 1, 1, "abcdefghij", 11, 0, 0); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 1, 0); -} - -void test25() -{ - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 9, -8); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 18, -17); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 19, -18); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 20, -18); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 1, 4, "", 0, 0, 4); - test("abcdefghij", 1, 4, "", 0, 1, 4); - test("abcdefghij", 1, 4, "", 1, 0, 0); - test("abcdefghij", 1, 4, "abcde", 0, 0, 4); - test("abcdefghij", 1, 4, "abcde", 0, 1, 1); - test("abcdefghij", 1, 4, "abcde", 0, 2, 1); - test("abcdefghij", 1, 4, "abcde", 0, 4, 1); - test("abcdefghij", 1, 4, "abcde", 0, 5, 1); - test("abcdefghij", 1, 4, "abcde", 0, 6, 1); - test("abcdefghij", 1, 4, "abcde", 1, 0, 4); - test("abcdefghij", 1, 4, "abcde", 1, 1, 3); - test("abcdefghij", 1, 4, "abcde", 1, 2, 2); - test("abcdefghij", 1, 4, "abcde", 1, 3, 1); - test("abcdefghij", 1, 4, "abcde", 1, 4, 0); - test("abcdefghij", 1, 4, "abcde", 1, 5, 0); - test("abcdefghij", 1, 4, "abcde", 2, 0, 4); - test("abcdefghij", 1, 4, "abcde", 2, 1, -1); - test("abcdefghij", 1, 4, "abcde", 2, 2, -1); - test("abcdefghij", 1, 4, "abcde", 2, 3, -1); - test("abcdefghij", 1, 4, "abcde", 2, 4, -1); - test("abcdefghij", 1, 4, "abcde", 4, 0, 4); - test("abcdefghij", 1, 4, "abcde", 4, 1, -3); - test("abcdefghij", 1, 4, "abcde", 4, 2, -3); - test("abcdefghij", 1, 4, "abcde", 5, 0, 4); - test("abcdefghij", 1, 4, "abcde", 5, 1, 4); - test("abcdefghij", 1, 4, "abcde", 6, 0, 0); - test("abcdefghij", 1, 4, "abcdefghij", 0, 0, 4); - test("abcdefghij", 1, 4, "abcdefghij", 0, 1, 1); - test("abcdefghij", 1, 4, "abcdefghij", 0, 5, 1); - test("abcdefghij", 1, 4, "abcdefghij", 0, 9, 1); - test("abcdefghij", 1, 4, "abcdefghij", 0, 10, 1); - test("abcdefghij", 1, 4, "abcdefghij", 0, 11, 1); - test("abcdefghij", 1, 4, "abcdefghij", 1, 0, 4); - test("abcdefghij", 1, 4, "abcdefghij", 1, 1, 3); - test("abcdefghij", 1, 4, "abcdefghij", 1, 4, 0); - test("abcdefghij", 1, 4, "abcdefghij", 1, 8, -4); - test("abcdefghij", 1, 4, "abcdefghij", 1, 9, -5); - test("abcdefghij", 1, 4, "abcdefghij", 1, 10, -5); - test("abcdefghij", 1, 4, "abcdefghij", 5, 0, 4); - test("abcdefghij", 1, 4, "abcdefghij", 5, 1, -4); - test("abcdefghij", 1, 4, "abcdefghij", 5, 2, -4); - test("abcdefghij", 1, 4, "abcdefghij", 5, 4, -4); - test("abcdefghij", 1, 4, "abcdefghij", 5, 5, -4); - test("abcdefghij", 1, 4, "abcdefghij", 5, 6, -4); - test("abcdefghij", 1, 4, "abcdefghij", 9, 0, 4); - test("abcdefghij", 1, 4, "abcdefghij", 9, 1, -8); - test("abcdefghij", 1, 4, "abcdefghij", 9, 2, -8); - test("abcdefghij", 1, 4, "abcdefghij", 10, 0, 4); - test("abcdefghij", 1, 4, "abcdefghij", 10, 1, 4); - test("abcdefghij", 1, 4, "abcdefghij", 11, 0, 0); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 0, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 0, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 1, 3); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 9, -5); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 18, -14); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 19, -15); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 20, -15); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 0, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 0, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 20, 0, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 20, 1, 4); - test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 1, 8, "", 0, 0, 8); - test("abcdefghij", 1, 8, "", 0, 1, 8); - test("abcdefghij", 1, 8, "", 1, 0, 0); - test("abcdefghij", 1, 8, "abcde", 0, 0, 8); - test("abcdefghij", 1, 8, "abcde", 0, 1, 1); - test("abcdefghij", 1, 8, "abcde", 0, 2, 1); - test("abcdefghij", 1, 8, "abcde", 0, 4, 1); - test("abcdefghij", 1, 8, "abcde", 0, 5, 1); - test("abcdefghij", 1, 8, "abcde", 0, 6, 1); - test("abcdefghij", 1, 8, "abcde", 1, 0, 8); -} - -void test26() -{ - test("abcdefghij", 1, 8, "abcde", 1, 1, 7); - test("abcdefghij", 1, 8, "abcde", 1, 2, 6); - test("abcdefghij", 1, 8, "abcde", 1, 3, 5); - test("abcdefghij", 1, 8, "abcde", 1, 4, 4); - test("abcdefghij", 1, 8, "abcde", 1, 5, 4); - test("abcdefghij", 1, 8, "abcde", 2, 0, 8); - test("abcdefghij", 1, 8, "abcde", 2, 1, -1); - test("abcdefghij", 1, 8, "abcde", 2, 2, -1); - test("abcdefghij", 1, 8, "abcde", 2, 3, -1); - test("abcdefghij", 1, 8, "abcde", 2, 4, -1); - test("abcdefghij", 1, 8, "abcde", 4, 0, 8); - test("abcdefghij", 1, 8, "abcde", 4, 1, -3); - test("abcdefghij", 1, 8, "abcde", 4, 2, -3); - test("abcdefghij", 1, 8, "abcde", 5, 0, 8); - test("abcdefghij", 1, 8, "abcde", 5, 1, 8); - test("abcdefghij", 1, 8, "abcde", 6, 0, 0); - test("abcdefghij", 1, 8, "abcdefghij", 0, 0, 8); - test("abcdefghij", 1, 8, "abcdefghij", 0, 1, 1); - test("abcdefghij", 1, 8, "abcdefghij", 0, 5, 1); - test("abcdefghij", 1, 8, "abcdefghij", 0, 9, 1); - test("abcdefghij", 1, 8, "abcdefghij", 0, 10, 1); - test("abcdefghij", 1, 8, "abcdefghij", 0, 11, 1); - test("abcdefghij", 1, 8, "abcdefghij", 1, 0, 8); - test("abcdefghij", 1, 8, "abcdefghij", 1, 1, 7); - test("abcdefghij", 1, 8, "abcdefghij", 1, 4, 4); - test("abcdefghij", 1, 8, "abcdefghij", 1, 8, 0); - test("abcdefghij", 1, 8, "abcdefghij", 1, 9, -1); - test("abcdefghij", 1, 8, "abcdefghij", 1, 10, -1); - test("abcdefghij", 1, 8, "abcdefghij", 5, 0, 8); - test("abcdefghij", 1, 8, "abcdefghij", 5, 1, -4); - test("abcdefghij", 1, 8, "abcdefghij", 5, 2, -4); - test("abcdefghij", 1, 8, "abcdefghij", 5, 4, -4); - test("abcdefghij", 1, 8, "abcdefghij", 5, 5, -4); - test("abcdefghij", 1, 8, "abcdefghij", 5, 6, -4); - test("abcdefghij", 1, 8, "abcdefghij", 9, 0, 8); - test("abcdefghij", 1, 8, "abcdefghij", 9, 1, -8); - test("abcdefghij", 1, 8, "abcdefghij", 9, 2, -8); - test("abcdefghij", 1, 8, "abcdefghij", 10, 0, 8); - test("abcdefghij", 1, 8, "abcdefghij", 10, 1, 8); - test("abcdefghij", 1, 8, "abcdefghij", 11, 0, 0); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 0, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 0, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 1, 7); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 18, -10); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 19, -11); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 20, -11); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 0, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 0, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 20, 0, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 20, 1, 8); - test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 1, 9, "", 0, 0, 9); - test("abcdefghij", 1, 9, "", 0, 1, 9); - test("abcdefghij", 1, 9, "", 1, 0, 0); - test("abcdefghij", 1, 9, "abcde", 0, 0, 9); - test("abcdefghij", 1, 9, "abcde", 0, 1, 1); - test("abcdefghij", 1, 9, "abcde", 0, 2, 1); - test("abcdefghij", 1, 9, "abcde", 0, 4, 1); - test("abcdefghij", 1, 9, "abcde", 0, 5, 1); - test("abcdefghij", 1, 9, "abcde", 0, 6, 1); - test("abcdefghij", 1, 9, "abcde", 1, 0, 9); - test("abcdefghij", 1, 9, "abcde", 1, 1, 8); - test("abcdefghij", 1, 9, "abcde", 1, 2, 7); - test("abcdefghij", 1, 9, "abcde", 1, 3, 6); - test("abcdefghij", 1, 9, "abcde", 1, 4, 5); - test("abcdefghij", 1, 9, "abcde", 1, 5, 5); - test("abcdefghij", 1, 9, "abcde", 2, 0, 9); - test("abcdefghij", 1, 9, "abcde", 2, 1, -1); - test("abcdefghij", 1, 9, "abcde", 2, 2, -1); - test("abcdefghij", 1, 9, "abcde", 2, 3, -1); - test("abcdefghij", 1, 9, "abcde", 2, 4, -1); - test("abcdefghij", 1, 9, "abcde", 4, 0, 9); - test("abcdefghij", 1, 9, "abcde", 4, 1, -3); - test("abcdefghij", 1, 9, "abcde", 4, 2, -3); - test("abcdefghij", 1, 9, "abcde", 5, 0, 9); - test("abcdefghij", 1, 9, "abcde", 5, 1, 9); - test("abcdefghij", 1, 9, "abcde", 6, 0, 0); - test("abcdefghij", 1, 9, "abcdefghij", 0, 0, 9); - test("abcdefghij", 1, 9, "abcdefghij", 0, 1, 1); - test("abcdefghij", 1, 9, "abcdefghij", 0, 5, 1); - test("abcdefghij", 1, 9, "abcdefghij", 0, 9, 1); - test("abcdefghij", 1, 9, "abcdefghij", 0, 10, 1); - test("abcdefghij", 1, 9, "abcdefghij", 0, 11, 1); - test("abcdefghij", 1, 9, "abcdefghij", 1, 0, 9); - test("abcdefghij", 1, 9, "abcdefghij", 1, 1, 8); - test("abcdefghij", 1, 9, "abcdefghij", 1, 4, 5); - test("abcdefghij", 1, 9, "abcdefghij", 1, 8, 1); -} - -void test27() -{ - test("abcdefghij", 1, 9, "abcdefghij", 1, 9, 0); - test("abcdefghij", 1, 9, "abcdefghij", 1, 10, 0); - test("abcdefghij", 1, 9, "abcdefghij", 5, 0, 9); - test("abcdefghij", 1, 9, "abcdefghij", 5, 1, -4); - test("abcdefghij", 1, 9, "abcdefghij", 5, 2, -4); - test("abcdefghij", 1, 9, "abcdefghij", 5, 4, -4); - test("abcdefghij", 1, 9, "abcdefghij", 5, 5, -4); - test("abcdefghij", 1, 9, "abcdefghij", 5, 6, -4); - test("abcdefghij", 1, 9, "abcdefghij", 9, 0, 9); - test("abcdefghij", 1, 9, "abcdefghij", 9, 1, -8); - test("abcdefghij", 1, 9, "abcdefghij", 9, 2, -8); - test("abcdefghij", 1, 9, "abcdefghij", 10, 0, 9); - test("abcdefghij", 1, 9, "abcdefghij", 10, 1, 9); - test("abcdefghij", 1, 9, "abcdefghij", 11, 0, 0); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 0, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 0, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 1, 8); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 9, 0); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 18, -9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 19, -10); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 20, -10); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 0, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 0, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 20, 0, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 20, 1, 9); - test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 1, 10, "", 0, 0, 9); - test("abcdefghij", 1, 10, "", 0, 1, 9); - test("abcdefghij", 1, 10, "", 1, 0, 0); - test("abcdefghij", 1, 10, "abcde", 0, 0, 9); - test("abcdefghij", 1, 10, "abcde", 0, 1, 1); - test("abcdefghij", 1, 10, "abcde", 0, 2, 1); - test("abcdefghij", 1, 10, "abcde", 0, 4, 1); - test("abcdefghij", 1, 10, "abcde", 0, 5, 1); - test("abcdefghij", 1, 10, "abcde", 0, 6, 1); - test("abcdefghij", 1, 10, "abcde", 1, 0, 9); - test("abcdefghij", 1, 10, "abcde", 1, 1, 8); - test("abcdefghij", 1, 10, "abcde", 1, 2, 7); - test("abcdefghij", 1, 10, "abcde", 1, 3, 6); - test("abcdefghij", 1, 10, "abcde", 1, 4, 5); - test("abcdefghij", 1, 10, "abcde", 1, 5, 5); - test("abcdefghij", 1, 10, "abcde", 2, 0, 9); - test("abcdefghij", 1, 10, "abcde", 2, 1, -1); - test("abcdefghij", 1, 10, "abcde", 2, 2, -1); - test("abcdefghij", 1, 10, "abcde", 2, 3, -1); - test("abcdefghij", 1, 10, "abcde", 2, 4, -1); - test("abcdefghij", 1, 10, "abcde", 4, 0, 9); - test("abcdefghij", 1, 10, "abcde", 4, 1, -3); - test("abcdefghij", 1, 10, "abcde", 4, 2, -3); - test("abcdefghij", 1, 10, "abcde", 5, 0, 9); - test("abcdefghij", 1, 10, "abcde", 5, 1, 9); - test("abcdefghij", 1, 10, "abcde", 6, 0, 0); - test("abcdefghij", 1, 10, "abcdefghij", 0, 0, 9); - test("abcdefghij", 1, 10, "abcdefghij", 0, 1, 1); - test("abcdefghij", 1, 10, "abcdefghij", 0, 5, 1); - test("abcdefghij", 1, 10, "abcdefghij", 0, 9, 1); - test("abcdefghij", 1, 10, "abcdefghij", 0, 10, 1); - test("abcdefghij", 1, 10, "abcdefghij", 0, 11, 1); - test("abcdefghij", 1, 10, "abcdefghij", 1, 0, 9); - test("abcdefghij", 1, 10, "abcdefghij", 1, 1, 8); - test("abcdefghij", 1, 10, "abcdefghij", 1, 4, 5); - test("abcdefghij", 1, 10, "abcdefghij", 1, 8, 1); - test("abcdefghij", 1, 10, "abcdefghij", 1, 9, 0); - test("abcdefghij", 1, 10, "abcdefghij", 1, 10, 0); - test("abcdefghij", 1, 10, "abcdefghij", 5, 0, 9); - test("abcdefghij", 1, 10, "abcdefghij", 5, 1, -4); - test("abcdefghij", 1, 10, "abcdefghij", 5, 2, -4); - test("abcdefghij", 1, 10, "abcdefghij", 5, 4, -4); - test("abcdefghij", 1, 10, "abcdefghij", 5, 5, -4); - test("abcdefghij", 1, 10, "abcdefghij", 5, 6, -4); - test("abcdefghij", 1, 10, "abcdefghij", 9, 0, 9); - test("abcdefghij", 1, 10, "abcdefghij", 9, 1, -8); - test("abcdefghij", 1, 10, "abcdefghij", 9, 2, -8); - test("abcdefghij", 1, 10, "abcdefghij", 10, 0, 9); - test("abcdefghij", 1, 10, "abcdefghij", 10, 1, 9); - test("abcdefghij", 1, 10, "abcdefghij", 11, 0, 0); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 0, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 0, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 1, 8); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 9, 0); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 18, -9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 19, -10); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 20, -10); -} - -void test28() -{ - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 0, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 0, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 20, 0, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 20, 1, 9); - test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 5, 0, "", 0, 0, 0); - test("abcdefghij", 5, 0, "", 0, 1, 0); - test("abcdefghij", 5, 0, "", 1, 0, 0); - test("abcdefghij", 5, 0, "abcde", 0, 0, 0); - test("abcdefghij", 5, 0, "abcde", 0, 1, -1); - test("abcdefghij", 5, 0, "abcde", 0, 2, -2); - test("abcdefghij", 5, 0, "abcde", 0, 4, -4); - test("abcdefghij", 5, 0, "abcde", 0, 5, -5); - test("abcdefghij", 5, 0, "abcde", 0, 6, -5); - test("abcdefghij", 5, 0, "abcde", 1, 0, 0); - test("abcdefghij", 5, 0, "abcde", 1, 1, -1); - test("abcdefghij", 5, 0, "abcde", 1, 2, -2); - test("abcdefghij", 5, 0, "abcde", 1, 3, -3); - test("abcdefghij", 5, 0, "abcde", 1, 4, -4); - test("abcdefghij", 5, 0, "abcde", 1, 5, -4); - test("abcdefghij", 5, 0, "abcde", 2, 0, 0); - test("abcdefghij", 5, 0, "abcde", 2, 1, -1); - test("abcdefghij", 5, 0, "abcde", 2, 2, -2); - test("abcdefghij", 5, 0, "abcde", 2, 3, -3); - test("abcdefghij", 5, 0, "abcde", 2, 4, -3); - test("abcdefghij", 5, 0, "abcde", 4, 0, 0); - test("abcdefghij", 5, 0, "abcde", 4, 1, -1); - test("abcdefghij", 5, 0, "abcde", 4, 2, -1); - test("abcdefghij", 5, 0, "abcde", 5, 0, 0); - test("abcdefghij", 5, 0, "abcde", 5, 1, 0); - test("abcdefghij", 5, 0, "abcde", 6, 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 0, 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 0, 1, -1); - test("abcdefghij", 5, 0, "abcdefghij", 0, 5, -5); - test("abcdefghij", 5, 0, "abcdefghij", 0, 9, -9); - test("abcdefghij", 5, 0, "abcdefghij", 0, 10, -10); - test("abcdefghij", 5, 0, "abcdefghij", 0, 11, -10); - test("abcdefghij", 5, 0, "abcdefghij", 1, 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 1, 1, -1); - test("abcdefghij", 5, 0, "abcdefghij", 1, 4, -4); - test("abcdefghij", 5, 0, "abcdefghij", 1, 8, -8); - test("abcdefghij", 5, 0, "abcdefghij", 1, 9, -9); - test("abcdefghij", 5, 0, "abcdefghij", 1, 10, -9); - test("abcdefghij", 5, 0, "abcdefghij", 5, 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 5, 1, -1); - test("abcdefghij", 5, 0, "abcdefghij", 5, 2, -2); - test("abcdefghij", 5, 0, "abcdefghij", 5, 4, -4); - test("abcdefghij", 5, 0, "abcdefghij", 5, 5, -5); - test("abcdefghij", 5, 0, "abcdefghij", 5, 6, -5); - test("abcdefghij", 5, 0, "abcdefghij", 9, 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 9, 1, -1); - test("abcdefghij", 5, 0, "abcdefghij", 9, 2, -1); - test("abcdefghij", 5, 0, "abcdefghij", 10, 0, 0); - test("abcdefghij", 5, 0, "abcdefghij", 10, 1, 0); - test("abcdefghij", 5, 0, "abcdefghij", 11, 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 5, 1, "", 0, 0, 1); - test("abcdefghij", 5, 1, "", 0, 1, 1); - test("abcdefghij", 5, 1, "", 1, 0, 0); - test("abcdefghij", 5, 1, "abcde", 0, 0, 1); - test("abcdefghij", 5, 1, "abcde", 0, 1, 5); - test("abcdefghij", 5, 1, "abcde", 0, 2, 5); - test("abcdefghij", 5, 1, "abcde", 0, 4, 5); - test("abcdefghij", 5, 1, "abcde", 0, 5, 5); - test("abcdefghij", 5, 1, "abcde", 0, 6, 5); - test("abcdefghij", 5, 1, "abcde", 1, 0, 1); - test("abcdefghij", 5, 1, "abcde", 1, 1, 4); - test("abcdefghij", 5, 1, "abcde", 1, 2, 4); - test("abcdefghij", 5, 1, "abcde", 1, 3, 4); - test("abcdefghij", 5, 1, "abcde", 1, 4, 4); -} - -void test29() -{ - test("abcdefghij", 5, 1, "abcde", 1, 5, 4); - test("abcdefghij", 5, 1, "abcde", 2, 0, 1); - test("abcdefghij", 5, 1, "abcde", 2, 1, 3); - test("abcdefghij", 5, 1, "abcde", 2, 2, 3); - test("abcdefghij", 5, 1, "abcde", 2, 3, 3); - test("abcdefghij", 5, 1, "abcde", 2, 4, 3); - test("abcdefghij", 5, 1, "abcde", 4, 0, 1); - test("abcdefghij", 5, 1, "abcde", 4, 1, 1); - test("abcdefghij", 5, 1, "abcde", 4, 2, 1); - test("abcdefghij", 5, 1, "abcde", 5, 0, 1); - test("abcdefghij", 5, 1, "abcde", 5, 1, 1); - test("abcdefghij", 5, 1, "abcde", 6, 0, 0); - test("abcdefghij", 5, 1, "abcdefghij", 0, 0, 1); - test("abcdefghij", 5, 1, "abcdefghij", 0, 1, 5); - test("abcdefghij", 5, 1, "abcdefghij", 0, 5, 5); - test("abcdefghij", 5, 1, "abcdefghij", 0, 9, 5); - test("abcdefghij", 5, 1, "abcdefghij", 0, 10, 5); - test("abcdefghij", 5, 1, "abcdefghij", 0, 11, 5); - test("abcdefghij", 5, 1, "abcdefghij", 1, 0, 1); - test("abcdefghij", 5, 1, "abcdefghij", 1, 1, 4); - test("abcdefghij", 5, 1, "abcdefghij", 1, 4, 4); - test("abcdefghij", 5, 1, "abcdefghij", 1, 8, 4); - test("abcdefghij", 5, 1, "abcdefghij", 1, 9, 4); - test("abcdefghij", 5, 1, "abcdefghij", 1, 10, 4); - test("abcdefghij", 5, 1, "abcdefghij", 5, 0, 1); - test("abcdefghij", 5, 1, "abcdefghij", 5, 1, 0); - test("abcdefghij", 5, 1, "abcdefghij", 5, 2, -1); - test("abcdefghij", 5, 1, "abcdefghij", 5, 4, -3); - test("abcdefghij", 5, 1, "abcdefghij", 5, 5, -4); - test("abcdefghij", 5, 1, "abcdefghij", 5, 6, -4); - test("abcdefghij", 5, 1, "abcdefghij", 9, 0, 1); - test("abcdefghij", 5, 1, "abcdefghij", 9, 1, -4); - test("abcdefghij", 5, 1, "abcdefghij", 9, 2, -4); - test("abcdefghij", 5, 1, "abcdefghij", 10, 0, 1); - test("abcdefghij", 5, 1, "abcdefghij", 10, 1, 1); - test("abcdefghij", 5, 1, "abcdefghij", 11, 0, 0); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 1, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 10, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 19, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 20, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 21, 5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 1, 4); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 9, 4); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 18, 4); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 19, 4); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 20, 4); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 1, -5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 9, -5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 10, -5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 11, -5); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 1, -14); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 2, -14); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 5, 2, "", 0, 0, 2); - test("abcdefghij", 5, 2, "", 0, 1, 2); - test("abcdefghij", 5, 2, "", 1, 0, 0); - test("abcdefghij", 5, 2, "abcde", 0, 0, 2); - test("abcdefghij", 5, 2, "abcde", 0, 1, 5); - test("abcdefghij", 5, 2, "abcde", 0, 2, 5); - test("abcdefghij", 5, 2, "abcde", 0, 4, 5); - test("abcdefghij", 5, 2, "abcde", 0, 5, 5); - test("abcdefghij", 5, 2, "abcde", 0, 6, 5); - test("abcdefghij", 5, 2, "abcde", 1, 0, 2); - test("abcdefghij", 5, 2, "abcde", 1, 1, 4); - test("abcdefghij", 5, 2, "abcde", 1, 2, 4); - test("abcdefghij", 5, 2, "abcde", 1, 3, 4); - test("abcdefghij", 5, 2, "abcde", 1, 4, 4); - test("abcdefghij", 5, 2, "abcde", 1, 5, 4); - test("abcdefghij", 5, 2, "abcde", 2, 0, 2); - test("abcdefghij", 5, 2, "abcde", 2, 1, 3); - test("abcdefghij", 5, 2, "abcde", 2, 2, 3); - test("abcdefghij", 5, 2, "abcde", 2, 3, 3); - test("abcdefghij", 5, 2, "abcde", 2, 4, 3); - test("abcdefghij", 5, 2, "abcde", 4, 0, 2); - test("abcdefghij", 5, 2, "abcde", 4, 1, 1); - test("abcdefghij", 5, 2, "abcde", 4, 2, 1); - test("abcdefghij", 5, 2, "abcde", 5, 0, 2); - test("abcdefghij", 5, 2, "abcde", 5, 1, 2); - test("abcdefghij", 5, 2, "abcde", 6, 0, 0); - test("abcdefghij", 5, 2, "abcdefghij", 0, 0, 2); - test("abcdefghij", 5, 2, "abcdefghij", 0, 1, 5); - test("abcdefghij", 5, 2, "abcdefghij", 0, 5, 5); - test("abcdefghij", 5, 2, "abcdefghij", 0, 9, 5); - test("abcdefghij", 5, 2, "abcdefghij", 0, 10, 5); - test("abcdefghij", 5, 2, "abcdefghij", 0, 11, 5); - test("abcdefghij", 5, 2, "abcdefghij", 1, 0, 2); - test("abcdefghij", 5, 2, "abcdefghij", 1, 1, 4); - test("abcdefghij", 5, 2, "abcdefghij", 1, 4, 4); - test("abcdefghij", 5, 2, "abcdefghij", 1, 8, 4); - test("abcdefghij", 5, 2, "abcdefghij", 1, 9, 4); - test("abcdefghij", 5, 2, "abcdefghij", 1, 10, 4); - test("abcdefghij", 5, 2, "abcdefghij", 5, 0, 2); - test("abcdefghij", 5, 2, "abcdefghij", 5, 1, 1); -} - -void test30() -{ - test("abcdefghij", 5, 2, "abcdefghij", 5, 2, 0); - test("abcdefghij", 5, 2, "abcdefghij", 5, 4, -2); - test("abcdefghij", 5, 2, "abcdefghij", 5, 5, -3); - test("abcdefghij", 5, 2, "abcdefghij", 5, 6, -3); - test("abcdefghij", 5, 2, "abcdefghij", 9, 0, 2); - test("abcdefghij", 5, 2, "abcdefghij", 9, 1, -4); - test("abcdefghij", 5, 2, "abcdefghij", 9, 2, -4); - test("abcdefghij", 5, 2, "abcdefghij", 10, 0, 2); - test("abcdefghij", 5, 2, "abcdefghij", 10, 1, 2); - test("abcdefghij", 5, 2, "abcdefghij", 11, 0, 0); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 0, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 1, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 10, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 19, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 20, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 21, 5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 0, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 1, 4); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 9, 4); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 18, 4); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 19, 4); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 20, 4); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 0, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 1, -5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 9, -5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 10, -5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 11, -5); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 0, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 1, -14); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 2, -14); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 20, 0, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 20, 1, 2); - test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 5, 4, "", 0, 0, 4); - test("abcdefghij", 5, 4, "", 0, 1, 4); - test("abcdefghij", 5, 4, "", 1, 0, 0); - test("abcdefghij", 5, 4, "abcde", 0, 0, 4); - test("abcdefghij", 5, 4, "abcde", 0, 1, 5); - test("abcdefghij", 5, 4, "abcde", 0, 2, 5); - test("abcdefghij", 5, 4, "abcde", 0, 4, 5); - test("abcdefghij", 5, 4, "abcde", 0, 5, 5); - test("abcdefghij", 5, 4, "abcde", 0, 6, 5); - test("abcdefghij", 5, 4, "abcde", 1, 0, 4); - test("abcdefghij", 5, 4, "abcde", 1, 1, 4); - test("abcdefghij", 5, 4, "abcde", 1, 2, 4); - test("abcdefghij", 5, 4, "abcde", 1, 3, 4); - test("abcdefghij", 5, 4, "abcde", 1, 4, 4); - test("abcdefghij", 5, 4, "abcde", 1, 5, 4); - test("abcdefghij", 5, 4, "abcde", 2, 0, 4); - test("abcdefghij", 5, 4, "abcde", 2, 1, 3); - test("abcdefghij", 5, 4, "abcde", 2, 2, 3); - test("abcdefghij", 5, 4, "abcde", 2, 3, 3); - test("abcdefghij", 5, 4, "abcde", 2, 4, 3); - test("abcdefghij", 5, 4, "abcde", 4, 0, 4); - test("abcdefghij", 5, 4, "abcde", 4, 1, 1); - test("abcdefghij", 5, 4, "abcde", 4, 2, 1); - test("abcdefghij", 5, 4, "abcde", 5, 0, 4); - test("abcdefghij", 5, 4, "abcde", 5, 1, 4); - test("abcdefghij", 5, 4, "abcde", 6, 0, 0); - test("abcdefghij", 5, 4, "abcdefghij", 0, 0, 4); - test("abcdefghij", 5, 4, "abcdefghij", 0, 1, 5); - test("abcdefghij", 5, 4, "abcdefghij", 0, 5, 5); - test("abcdefghij", 5, 4, "abcdefghij", 0, 9, 5); - test("abcdefghij", 5, 4, "abcdefghij", 0, 10, 5); - test("abcdefghij", 5, 4, "abcdefghij", 0, 11, 5); - test("abcdefghij", 5, 4, "abcdefghij", 1, 0, 4); - test("abcdefghij", 5, 4, "abcdefghij", 1, 1, 4); - test("abcdefghij", 5, 4, "abcdefghij", 1, 4, 4); - test("abcdefghij", 5, 4, "abcdefghij", 1, 8, 4); - test("abcdefghij", 5, 4, "abcdefghij", 1, 9, 4); - test("abcdefghij", 5, 4, "abcdefghij", 1, 10, 4); - test("abcdefghij", 5, 4, "abcdefghij", 5, 0, 4); - test("abcdefghij", 5, 4, "abcdefghij", 5, 1, 3); - test("abcdefghij", 5, 4, "abcdefghij", 5, 2, 2); - test("abcdefghij", 5, 4, "abcdefghij", 5, 4, 0); - test("abcdefghij", 5, 4, "abcdefghij", 5, 5, -1); - test("abcdefghij", 5, 4, "abcdefghij", 5, 6, -1); - test("abcdefghij", 5, 4, "abcdefghij", 9, 0, 4); - test("abcdefghij", 5, 4, "abcdefghij", 9, 1, -4); - test("abcdefghij", 5, 4, "abcdefghij", 9, 2, -4); - test("abcdefghij", 5, 4, "abcdefghij", 10, 0, 4); - test("abcdefghij", 5, 4, "abcdefghij", 10, 1, 4); - test("abcdefghij", 5, 4, "abcdefghij", 11, 0, 0); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 0, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 1, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 10, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 19, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 20, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 21, 5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 0, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 1, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 9, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 18, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 19, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 20, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 0, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 1, -5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 9, -5); -} - -void test31() -{ - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 10, -5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 11, -5); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 0, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 1, -14); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 2, -14); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 20, 0, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 20, 1, 4); - test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 5, 5, "", 0, 0, 5); - test("abcdefghij", 5, 5, "", 0, 1, 5); - test("abcdefghij", 5, 5, "", 1, 0, 0); - test("abcdefghij", 5, 5, "abcde", 0, 0, 5); - test("abcdefghij", 5, 5, "abcde", 0, 1, 5); - test("abcdefghij", 5, 5, "abcde", 0, 2, 5); - test("abcdefghij", 5, 5, "abcde", 0, 4, 5); - test("abcdefghij", 5, 5, "abcde", 0, 5, 5); - test("abcdefghij", 5, 5, "abcde", 0, 6, 5); - test("abcdefghij", 5, 5, "abcde", 1, 0, 5); - test("abcdefghij", 5, 5, "abcde", 1, 1, 4); - test("abcdefghij", 5, 5, "abcde", 1, 2, 4); - test("abcdefghij", 5, 5, "abcde", 1, 3, 4); - test("abcdefghij", 5, 5, "abcde", 1, 4, 4); - test("abcdefghij", 5, 5, "abcde", 1, 5, 4); - test("abcdefghij", 5, 5, "abcde", 2, 0, 5); - test("abcdefghij", 5, 5, "abcde", 2, 1, 3); - test("abcdefghij", 5, 5, "abcde", 2, 2, 3); - test("abcdefghij", 5, 5, "abcde", 2, 3, 3); - test("abcdefghij", 5, 5, "abcde", 2, 4, 3); - test("abcdefghij", 5, 5, "abcde", 4, 0, 5); - test("abcdefghij", 5, 5, "abcde", 4, 1, 1); - test("abcdefghij", 5, 5, "abcde", 4, 2, 1); - test("abcdefghij", 5, 5, "abcde", 5, 0, 5); - test("abcdefghij", 5, 5, "abcde", 5, 1, 5); - test("abcdefghij", 5, 5, "abcde", 6, 0, 0); - test("abcdefghij", 5, 5, "abcdefghij", 0, 0, 5); - test("abcdefghij", 5, 5, "abcdefghij", 0, 1, 5); - test("abcdefghij", 5, 5, "abcdefghij", 0, 5, 5); - test("abcdefghij", 5, 5, "abcdefghij", 0, 9, 5); - test("abcdefghij", 5, 5, "abcdefghij", 0, 10, 5); - test("abcdefghij", 5, 5, "abcdefghij", 0, 11, 5); - test("abcdefghij", 5, 5, "abcdefghij", 1, 0, 5); - test("abcdefghij", 5, 5, "abcdefghij", 1, 1, 4); - test("abcdefghij", 5, 5, "abcdefghij", 1, 4, 4); - test("abcdefghij", 5, 5, "abcdefghij", 1, 8, 4); - test("abcdefghij", 5, 5, "abcdefghij", 1, 9, 4); - test("abcdefghij", 5, 5, "abcdefghij", 1, 10, 4); - test("abcdefghij", 5, 5, "abcdefghij", 5, 0, 5); - test("abcdefghij", 5, 5, "abcdefghij", 5, 1, 4); - test("abcdefghij", 5, 5, "abcdefghij", 5, 2, 3); - test("abcdefghij", 5, 5, "abcdefghij", 5, 4, 1); - test("abcdefghij", 5, 5, "abcdefghij", 5, 5, 0); - test("abcdefghij", 5, 5, "abcdefghij", 5, 6, 0); - test("abcdefghij", 5, 5, "abcdefghij", 9, 0, 5); - test("abcdefghij", 5, 5, "abcdefghij", 9, 1, -4); - test("abcdefghij", 5, 5, "abcdefghij", 9, 2, -4); - test("abcdefghij", 5, 5, "abcdefghij", 10, 0, 5); - test("abcdefghij", 5, 5, "abcdefghij", 10, 1, 5); - test("abcdefghij", 5, 5, "abcdefghij", 11, 0, 0); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 0, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 1, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 10, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 19, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 20, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 21, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 0, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 1, 4); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 9, 4); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 18, 4); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 19, 4); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 20, 4); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 0, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 1, -5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 9, -5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 10, -5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 11, -5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 0, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 1, -14); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 2, -14); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 20, 0, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 20, 1, 5); - test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 5, 6, "", 0, 0, 5); - test("abcdefghij", 5, 6, "", 0, 1, 5); - test("abcdefghij", 5, 6, "", 1, 0, 0); - test("abcdefghij", 5, 6, "abcde", 0, 0, 5); - test("abcdefghij", 5, 6, "abcde", 0, 1, 5); - test("abcdefghij", 5, 6, "abcde", 0, 2, 5); - test("abcdefghij", 5, 6, "abcde", 0, 4, 5); - test("abcdefghij", 5, 6, "abcde", 0, 5, 5); - test("abcdefghij", 5, 6, "abcde", 0, 6, 5); - test("abcdefghij", 5, 6, "abcde", 1, 0, 5); - test("abcdefghij", 5, 6, "abcde", 1, 1, 4); - test("abcdefghij", 5, 6, "abcde", 1, 2, 4); - test("abcdefghij", 5, 6, "abcde", 1, 3, 4); - test("abcdefghij", 5, 6, "abcde", 1, 4, 4); - test("abcdefghij", 5, 6, "abcde", 1, 5, 4); - test("abcdefghij", 5, 6, "abcde", 2, 0, 5); - test("abcdefghij", 5, 6, "abcde", 2, 1, 3); - test("abcdefghij", 5, 6, "abcde", 2, 2, 3); -} - -void test32() -{ - test("abcdefghij", 5, 6, "abcde", 2, 3, 3); - test("abcdefghij", 5, 6, "abcde", 2, 4, 3); - test("abcdefghij", 5, 6, "abcde", 4, 0, 5); - test("abcdefghij", 5, 6, "abcde", 4, 1, 1); - test("abcdefghij", 5, 6, "abcde", 4, 2, 1); - test("abcdefghij", 5, 6, "abcde", 5, 0, 5); - test("abcdefghij", 5, 6, "abcde", 5, 1, 5); - test("abcdefghij", 5, 6, "abcde", 6, 0, 0); - test("abcdefghij", 5, 6, "abcdefghij", 0, 0, 5); - test("abcdefghij", 5, 6, "abcdefghij", 0, 1, 5); - test("abcdefghij", 5, 6, "abcdefghij", 0, 5, 5); - test("abcdefghij", 5, 6, "abcdefghij", 0, 9, 5); - test("abcdefghij", 5, 6, "abcdefghij", 0, 10, 5); - test("abcdefghij", 5, 6, "abcdefghij", 0, 11, 5); - test("abcdefghij", 5, 6, "abcdefghij", 1, 0, 5); - test("abcdefghij", 5, 6, "abcdefghij", 1, 1, 4); - test("abcdefghij", 5, 6, "abcdefghij", 1, 4, 4); - test("abcdefghij", 5, 6, "abcdefghij", 1, 8, 4); - test("abcdefghij", 5, 6, "abcdefghij", 1, 9, 4); - test("abcdefghij", 5, 6, "abcdefghij", 1, 10, 4); - test("abcdefghij", 5, 6, "abcdefghij", 5, 0, 5); - test("abcdefghij", 5, 6, "abcdefghij", 5, 1, 4); - test("abcdefghij", 5, 6, "abcdefghij", 5, 2, 3); - test("abcdefghij", 5, 6, "abcdefghij", 5, 4, 1); - test("abcdefghij", 5, 6, "abcdefghij", 5, 5, 0); - test("abcdefghij", 5, 6, "abcdefghij", 5, 6, 0); - test("abcdefghij", 5, 6, "abcdefghij", 9, 0, 5); - test("abcdefghij", 5, 6, "abcdefghij", 9, 1, -4); - test("abcdefghij", 5, 6, "abcdefghij", 9, 2, -4); - test("abcdefghij", 5, 6, "abcdefghij", 10, 0, 5); - test("abcdefghij", 5, 6, "abcdefghij", 10, 1, 5); - test("abcdefghij", 5, 6, "abcdefghij", 11, 0, 0); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 0, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 1, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 10, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 19, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 20, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 21, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 0, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 1, 4); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 9, 4); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 18, 4); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 19, 4); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 20, 4); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 0, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 1, -5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 9, -5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 10, -5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 11, -5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 0, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 1, -14); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 2, -14); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 20, 0, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 20, 1, 5); - test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 9, 0, "", 0, 0, 0); - test("abcdefghij", 9, 0, "", 0, 1, 0); - test("abcdefghij", 9, 0, "", 1, 0, 0); - test("abcdefghij", 9, 0, "abcde", 0, 0, 0); - test("abcdefghij", 9, 0, "abcde", 0, 1, -1); - test("abcdefghij", 9, 0, "abcde", 0, 2, -2); - test("abcdefghij", 9, 0, "abcde", 0, 4, -4); - test("abcdefghij", 9, 0, "abcde", 0, 5, -5); - test("abcdefghij", 9, 0, "abcde", 0, 6, -5); - test("abcdefghij", 9, 0, "abcde", 1, 0, 0); - test("abcdefghij", 9, 0, "abcde", 1, 1, -1); - test("abcdefghij", 9, 0, "abcde", 1, 2, -2); - test("abcdefghij", 9, 0, "abcde", 1, 3, -3); - test("abcdefghij", 9, 0, "abcde", 1, 4, -4); - test("abcdefghij", 9, 0, "abcde", 1, 5, -4); - test("abcdefghij", 9, 0, "abcde", 2, 0, 0); - test("abcdefghij", 9, 0, "abcde", 2, 1, -1); - test("abcdefghij", 9, 0, "abcde", 2, 2, -2); - test("abcdefghij", 9, 0, "abcde", 2, 3, -3); - test("abcdefghij", 9, 0, "abcde", 2, 4, -3); - test("abcdefghij", 9, 0, "abcde", 4, 0, 0); - test("abcdefghij", 9, 0, "abcde", 4, 1, -1); - test("abcdefghij", 9, 0, "abcde", 4, 2, -1); - test("abcdefghij", 9, 0, "abcde", 5, 0, 0); - test("abcdefghij", 9, 0, "abcde", 5, 1, 0); - test("abcdefghij", 9, 0, "abcde", 6, 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 0, 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 0, 1, -1); - test("abcdefghij", 9, 0, "abcdefghij", 0, 5, -5); - test("abcdefghij", 9, 0, "abcdefghij", 0, 9, -9); - test("abcdefghij", 9, 0, "abcdefghij", 0, 10, -10); - test("abcdefghij", 9, 0, "abcdefghij", 0, 11, -10); - test("abcdefghij", 9, 0, "abcdefghij", 1, 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 1, 1, -1); - test("abcdefghij", 9, 0, "abcdefghij", 1, 4, -4); - test("abcdefghij", 9, 0, "abcdefghij", 1, 8, -8); - test("abcdefghij", 9, 0, "abcdefghij", 1, 9, -9); - test("abcdefghij", 9, 0, "abcdefghij", 1, 10, -9); - test("abcdefghij", 9, 0, "abcdefghij", 5, 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 5, 1, -1); - test("abcdefghij", 9, 0, "abcdefghij", 5, 2, -2); - test("abcdefghij", 9, 0, "abcdefghij", 5, 4, -4); - test("abcdefghij", 9, 0, "abcdefghij", 5, 5, -5); - test("abcdefghij", 9, 0, "abcdefghij", 5, 6, -5); -} - -void test33() -{ - test("abcdefghij", 9, 0, "abcdefghij", 9, 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 9, 1, -1); - test("abcdefghij", 9, 0, "abcdefghij", 9, 2, -1); - test("abcdefghij", 9, 0, "abcdefghij", 10, 0, 0); - test("abcdefghij", 9, 0, "abcdefghij", 10, 1, 0); - test("abcdefghij", 9, 0, "abcdefghij", 11, 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 9, 1, "", 0, 0, 1); - test("abcdefghij", 9, 1, "", 0, 1, 1); - test("abcdefghij", 9, 1, "", 1, 0, 0); - test("abcdefghij", 9, 1, "abcde", 0, 0, 1); - test("abcdefghij", 9, 1, "abcde", 0, 1, 9); - test("abcdefghij", 9, 1, "abcde", 0, 2, 9); - test("abcdefghij", 9, 1, "abcde", 0, 4, 9); - test("abcdefghij", 9, 1, "abcde", 0, 5, 9); - test("abcdefghij", 9, 1, "abcde", 0, 6, 9); - test("abcdefghij", 9, 1, "abcde", 1, 0, 1); - test("abcdefghij", 9, 1, "abcde", 1, 1, 8); - test("abcdefghij", 9, 1, "abcde", 1, 2, 8); - test("abcdefghij", 9, 1, "abcde", 1, 3, 8); - test("abcdefghij", 9, 1, "abcde", 1, 4, 8); - test("abcdefghij", 9, 1, "abcde", 1, 5, 8); - test("abcdefghij", 9, 1, "abcde", 2, 0, 1); - test("abcdefghij", 9, 1, "abcde", 2, 1, 7); - test("abcdefghij", 9, 1, "abcde", 2, 2, 7); - test("abcdefghij", 9, 1, "abcde", 2, 3, 7); - test("abcdefghij", 9, 1, "abcde", 2, 4, 7); - test("abcdefghij", 9, 1, "abcde", 4, 0, 1); - test("abcdefghij", 9, 1, "abcde", 4, 1, 5); - test("abcdefghij", 9, 1, "abcde", 4, 2, 5); - test("abcdefghij", 9, 1, "abcde", 5, 0, 1); - test("abcdefghij", 9, 1, "abcde", 5, 1, 1); - test("abcdefghij", 9, 1, "abcde", 6, 0, 0); - test("abcdefghij", 9, 1, "abcdefghij", 0, 0, 1); - test("abcdefghij", 9, 1, "abcdefghij", 0, 1, 9); - test("abcdefghij", 9, 1, "abcdefghij", 0, 5, 9); - test("abcdefghij", 9, 1, "abcdefghij", 0, 9, 9); - test("abcdefghij", 9, 1, "abcdefghij", 0, 10, 9); - test("abcdefghij", 9, 1, "abcdefghij", 0, 11, 9); - test("abcdefghij", 9, 1, "abcdefghij", 1, 0, 1); - test("abcdefghij", 9, 1, "abcdefghij", 1, 1, 8); - test("abcdefghij", 9, 1, "abcdefghij", 1, 4, 8); - test("abcdefghij", 9, 1, "abcdefghij", 1, 8, 8); - test("abcdefghij", 9, 1, "abcdefghij", 1, 9, 8); - test("abcdefghij", 9, 1, "abcdefghij", 1, 10, 8); - test("abcdefghij", 9, 1, "abcdefghij", 5, 0, 1); - test("abcdefghij", 9, 1, "abcdefghij", 5, 1, 4); - test("abcdefghij", 9, 1, "abcdefghij", 5, 2, 4); - test("abcdefghij", 9, 1, "abcdefghij", 5, 4, 4); - test("abcdefghij", 9, 1, "abcdefghij", 5, 5, 4); - test("abcdefghij", 9, 1, "abcdefghij", 5, 6, 4); - test("abcdefghij", 9, 1, "abcdefghij", 9, 0, 1); - test("abcdefghij", 9, 1, "abcdefghij", 9, 1, 0); - test("abcdefghij", 9, 1, "abcdefghij", 9, 2, 0); - test("abcdefghij", 9, 1, "abcdefghij", 10, 0, 1); - test("abcdefghij", 9, 1, "abcdefghij", 10, 1, 1); - test("abcdefghij", 9, 1, "abcdefghij", 11, 0, 0); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 1, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 10, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 19, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 20, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 21, 9); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 1, 8); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 9, 8); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 18, 8); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 19, 8); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 20, 8); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 5, -1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 9, -1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 10, -1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 11, -1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 1, -10); -} - -void test34() -{ - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 2, -10); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 9, 2, "", 0, 0, 1); - test("abcdefghij", 9, 2, "", 0, 1, 1); - test("abcdefghij", 9, 2, "", 1, 0, 0); - test("abcdefghij", 9, 2, "abcde", 0, 0, 1); - test("abcdefghij", 9, 2, "abcde", 0, 1, 9); - test("abcdefghij", 9, 2, "abcde", 0, 2, 9); - test("abcdefghij", 9, 2, "abcde", 0, 4, 9); - test("abcdefghij", 9, 2, "abcde", 0, 5, 9); - test("abcdefghij", 9, 2, "abcde", 0, 6, 9); - test("abcdefghij", 9, 2, "abcde", 1, 0, 1); - test("abcdefghij", 9, 2, "abcde", 1, 1, 8); - test("abcdefghij", 9, 2, "abcde", 1, 2, 8); - test("abcdefghij", 9, 2, "abcde", 1, 3, 8); - test("abcdefghij", 9, 2, "abcde", 1, 4, 8); - test("abcdefghij", 9, 2, "abcde", 1, 5, 8); - test("abcdefghij", 9, 2, "abcde", 2, 0, 1); - test("abcdefghij", 9, 2, "abcde", 2, 1, 7); - test("abcdefghij", 9, 2, "abcde", 2, 2, 7); - test("abcdefghij", 9, 2, "abcde", 2, 3, 7); - test("abcdefghij", 9, 2, "abcde", 2, 4, 7); - test("abcdefghij", 9, 2, "abcde", 4, 0, 1); - test("abcdefghij", 9, 2, "abcde", 4, 1, 5); - test("abcdefghij", 9, 2, "abcde", 4, 2, 5); - test("abcdefghij", 9, 2, "abcde", 5, 0, 1); - test("abcdefghij", 9, 2, "abcde", 5, 1, 1); - test("abcdefghij", 9, 2, "abcde", 6, 0, 0); - test("abcdefghij", 9, 2, "abcdefghij", 0, 0, 1); - test("abcdefghij", 9, 2, "abcdefghij", 0, 1, 9); - test("abcdefghij", 9, 2, "abcdefghij", 0, 5, 9); - test("abcdefghij", 9, 2, "abcdefghij", 0, 9, 9); - test("abcdefghij", 9, 2, "abcdefghij", 0, 10, 9); - test("abcdefghij", 9, 2, "abcdefghij", 0, 11, 9); - test("abcdefghij", 9, 2, "abcdefghij", 1, 0, 1); - test("abcdefghij", 9, 2, "abcdefghij", 1, 1, 8); - test("abcdefghij", 9, 2, "abcdefghij", 1, 4, 8); - test("abcdefghij", 9, 2, "abcdefghij", 1, 8, 8); - test("abcdefghij", 9, 2, "abcdefghij", 1, 9, 8); - test("abcdefghij", 9, 2, "abcdefghij", 1, 10, 8); - test("abcdefghij", 9, 2, "abcdefghij", 5, 0, 1); - test("abcdefghij", 9, 2, "abcdefghij", 5, 1, 4); - test("abcdefghij", 9, 2, "abcdefghij", 5, 2, 4); - test("abcdefghij", 9, 2, "abcdefghij", 5, 4, 4); - test("abcdefghij", 9, 2, "abcdefghij", 5, 5, 4); - test("abcdefghij", 9, 2, "abcdefghij", 5, 6, 4); - test("abcdefghij", 9, 2, "abcdefghij", 9, 0, 1); - test("abcdefghij", 9, 2, "abcdefghij", 9, 1, 0); - test("abcdefghij", 9, 2, "abcdefghij", 9, 2, 0); - test("abcdefghij", 9, 2, "abcdefghij", 10, 0, 1); - test("abcdefghij", 9, 2, "abcdefghij", 10, 1, 1); - test("abcdefghij", 9, 2, "abcdefghij", 11, 0, 0); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 1, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 10, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 19, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 20, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 21, 9); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 1, 8); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 9, 8); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 18, 8); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 19, 8); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 20, 8); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 5, -1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 9, -1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 10, -1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 11, -1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 1, -10); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 2, -10); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 10, 0, "", 0, 0, 0); - test("abcdefghij", 10, 0, "", 0, 1, 0); - test("abcdefghij", 10, 0, "", 1, 0, 0); - test("abcdefghij", 10, 0, "abcde", 0, 0, 0); - test("abcdefghij", 10, 0, "abcde", 0, 1, -1); - test("abcdefghij", 10, 0, "abcde", 0, 2, -2); - test("abcdefghij", 10, 0, "abcde", 0, 4, -4); - test("abcdefghij", 10, 0, "abcde", 0, 5, -5); - test("abcdefghij", 10, 0, "abcde", 0, 6, -5); - test("abcdefghij", 10, 0, "abcde", 1, 0, 0); - test("abcdefghij", 10, 0, "abcde", 1, 1, -1); - test("abcdefghij", 10, 0, "abcde", 1, 2, -2); - test("abcdefghij", 10, 0, "abcde", 1, 3, -3); - test("abcdefghij", 10, 0, "abcde", 1, 4, -4); - test("abcdefghij", 10, 0, "abcde", 1, 5, -4); - test("abcdefghij", 10, 0, "abcde", 2, 0, 0); - test("abcdefghij", 10, 0, "abcde", 2, 1, -1); - test("abcdefghij", 10, 0, "abcde", 2, 2, -2); - test("abcdefghij", 10, 0, "abcde", 2, 3, -3); - test("abcdefghij", 10, 0, "abcde", 2, 4, -3); - test("abcdefghij", 10, 0, "abcde", 4, 0, 0); - test("abcdefghij", 10, 0, "abcde", 4, 1, -1); -} - -void test35() -{ - test("abcdefghij", 10, 0, "abcde", 4, 2, -1); - test("abcdefghij", 10, 0, "abcde", 5, 0, 0); - test("abcdefghij", 10, 0, "abcde", 5, 1, 0); - test("abcdefghij", 10, 0, "abcde", 6, 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 0, 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 0, 1, -1); - test("abcdefghij", 10, 0, "abcdefghij", 0, 5, -5); - test("abcdefghij", 10, 0, "abcdefghij", 0, 9, -9); - test("abcdefghij", 10, 0, "abcdefghij", 0, 10, -10); - test("abcdefghij", 10, 0, "abcdefghij", 0, 11, -10); - test("abcdefghij", 10, 0, "abcdefghij", 1, 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 1, 1, -1); - test("abcdefghij", 10, 0, "abcdefghij", 1, 4, -4); - test("abcdefghij", 10, 0, "abcdefghij", 1, 8, -8); - test("abcdefghij", 10, 0, "abcdefghij", 1, 9, -9); - test("abcdefghij", 10, 0, "abcdefghij", 1, 10, -9); - test("abcdefghij", 10, 0, "abcdefghij", 5, 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 5, 1, -1); - test("abcdefghij", 10, 0, "abcdefghij", 5, 2, -2); - test("abcdefghij", 10, 0, "abcdefghij", 5, 4, -4); - test("abcdefghij", 10, 0, "abcdefghij", 5, 5, -5); - test("abcdefghij", 10, 0, "abcdefghij", 5, 6, -5); - test("abcdefghij", 10, 0, "abcdefghij", 9, 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 9, 1, -1); - test("abcdefghij", 10, 0, "abcdefghij", 9, 2, -1); - test("abcdefghij", 10, 0, "abcdefghij", 10, 0, 0); - test("abcdefghij", 10, 0, "abcdefghij", 10, 1, 0); - test("abcdefghij", 10, 0, "abcdefghij", 11, 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 10, 1, "", 0, 0, 0); - test("abcdefghij", 10, 1, "", 0, 1, 0); - test("abcdefghij", 10, 1, "", 1, 0, 0); - test("abcdefghij", 10, 1, "abcde", 0, 0, 0); - test("abcdefghij", 10, 1, "abcde", 0, 1, -1); - test("abcdefghij", 10, 1, "abcde", 0, 2, -2); - test("abcdefghij", 10, 1, "abcde", 0, 4, -4); - test("abcdefghij", 10, 1, "abcde", 0, 5, -5); - test("abcdefghij", 10, 1, "abcde", 0, 6, -5); - test("abcdefghij", 10, 1, "abcde", 1, 0, 0); - test("abcdefghij", 10, 1, "abcde", 1, 1, -1); - test("abcdefghij", 10, 1, "abcde", 1, 2, -2); - test("abcdefghij", 10, 1, "abcde", 1, 3, -3); - test("abcdefghij", 10, 1, "abcde", 1, 4, -4); - test("abcdefghij", 10, 1, "abcde", 1, 5, -4); - test("abcdefghij", 10, 1, "abcde", 2, 0, 0); - test("abcdefghij", 10, 1, "abcde", 2, 1, -1); - test("abcdefghij", 10, 1, "abcde", 2, 2, -2); - test("abcdefghij", 10, 1, "abcde", 2, 3, -3); - test("abcdefghij", 10, 1, "abcde", 2, 4, -3); - test("abcdefghij", 10, 1, "abcde", 4, 0, 0); - test("abcdefghij", 10, 1, "abcde", 4, 1, -1); - test("abcdefghij", 10, 1, "abcde", 4, 2, -1); - test("abcdefghij", 10, 1, "abcde", 5, 0, 0); - test("abcdefghij", 10, 1, "abcde", 5, 1, 0); - test("abcdefghij", 10, 1, "abcde", 6, 0, 0); - test("abcdefghij", 10, 1, "abcdefghij", 0, 0, 0); - test("abcdefghij", 10, 1, "abcdefghij", 0, 1, -1); - test("abcdefghij", 10, 1, "abcdefghij", 0, 5, -5); - test("abcdefghij", 10, 1, "abcdefghij", 0, 9, -9); - test("abcdefghij", 10, 1, "abcdefghij", 0, 10, -10); - test("abcdefghij", 10, 1, "abcdefghij", 0, 11, -10); - test("abcdefghij", 10, 1, "abcdefghij", 1, 0, 0); - test("abcdefghij", 10, 1, "abcdefghij", 1, 1, -1); - test("abcdefghij", 10, 1, "abcdefghij", 1, 4, -4); - test("abcdefghij", 10, 1, "abcdefghij", 1, 8, -8); - test("abcdefghij", 10, 1, "abcdefghij", 1, 9, -9); - test("abcdefghij", 10, 1, "abcdefghij", 1, 10, -9); - test("abcdefghij", 10, 1, "abcdefghij", 5, 0, 0); - test("abcdefghij", 10, 1, "abcdefghij", 5, 1, -1); - test("abcdefghij", 10, 1, "abcdefghij", 5, 2, -2); - test("abcdefghij", 10, 1, "abcdefghij", 5, 4, -4); - test("abcdefghij", 10, 1, "abcdefghij", 5, 5, -5); - test("abcdefghij", 10, 1, "abcdefghij", 5, 6, -5); - test("abcdefghij", 10, 1, "abcdefghij", 9, 0, 0); - test("abcdefghij", 10, 1, "abcdefghij", 9, 1, -1); - test("abcdefghij", 10, 1, "abcdefghij", 9, 2, -1); - test("abcdefghij", 10, 1, "abcdefghij", 10, 0, 0); -} - -void test36() -{ - test("abcdefghij", 10, 1, "abcdefghij", 10, 1, 0); - test("abcdefghij", 10, 1, "abcdefghij", 11, 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghij", 11, 0, "", 0, 0, 0); - test("abcdefghij", 11, 0, "", 0, 1, 0); - test("abcdefghij", 11, 0, "", 1, 0, 0); - test("abcdefghij", 11, 0, "abcde", 0, 0, 0); - test("abcdefghij", 11, 0, "abcde", 0, 1, 0); - test("abcdefghij", 11, 0, "abcde", 0, 2, 0); - test("abcdefghij", 11, 0, "abcde", 0, 4, 0); - test("abcdefghij", 11, 0, "abcde", 0, 5, 0); - test("abcdefghij", 11, 0, "abcde", 0, 6, 0); - test("abcdefghij", 11, 0, "abcde", 1, 0, 0); - test("abcdefghij", 11, 0, "abcde", 1, 1, 0); - test("abcdefghij", 11, 0, "abcde", 1, 2, 0); - test("abcdefghij", 11, 0, "abcde", 1, 3, 0); - test("abcdefghij", 11, 0, "abcde", 1, 4, 0); - test("abcdefghij", 11, 0, "abcde", 1, 5, 0); - test("abcdefghij", 11, 0, "abcde", 2, 0, 0); - test("abcdefghij", 11, 0, "abcde", 2, 1, 0); - test("abcdefghij", 11, 0, "abcde", 2, 2, 0); - test("abcdefghij", 11, 0, "abcde", 2, 3, 0); - test("abcdefghij", 11, 0, "abcde", 2, 4, 0); - test("abcdefghij", 11, 0, "abcde", 4, 0, 0); - test("abcdefghij", 11, 0, "abcde", 4, 1, 0); - test("abcdefghij", 11, 0, "abcde", 4, 2, 0); - test("abcdefghij", 11, 0, "abcde", 5, 0, 0); - test("abcdefghij", 11, 0, "abcde", 5, 1, 0); - test("abcdefghij", 11, 0, "abcde", 6, 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 1, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 5, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 9, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 10, 0); - test("abcdefghij", 11, 0, "abcdefghij", 0, 11, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 1, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 4, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 8, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 9, 0); - test("abcdefghij", 11, 0, "abcdefghij", 1, 10, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 1, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 2, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 4, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 5, 0); - test("abcdefghij", 11, 0, "abcdefghij", 5, 6, 0); - test("abcdefghij", 11, 0, "abcdefghij", 9, 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 9, 1, 0); - test("abcdefghij", 11, 0, "abcdefghij", 9, 2, 0); - test("abcdefghij", 11, 0, "abcdefghij", 10, 0, 0); - test("abcdefghij", 11, 0, "abcdefghij", 10, 1, 0); - test("abcdefghij", 11, 0, "abcdefghij", 11, 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 1, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 10, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 19, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 20, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 21, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 1, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 9, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 18, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 19, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 20, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 1, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 5, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 9, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 10, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 11, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 1, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 2, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 21, 0, 0); -} - -void test37() -{ - test("abcdefghijklmnopqrst", 0, 0, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 0, 0, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 2, -2); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 4, -4); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 5, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 6, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 2, -2); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 3, -3); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 4, -4); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 5, -4); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 3, -3); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 4, -3); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, 2, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 5, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 9, -9); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 10, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 11, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 4, -4); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 8, -8); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 9, -9); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 10, -9); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 2, -2); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, 2, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 0, 1, "", 0, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "", 0, 1, 1); - test("abcdefghijklmnopqrst", 0, 1, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 1, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 2, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 4, -3); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 5, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 6, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 2, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 3, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 5, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 1, -2); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 3, -2); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 4, -2); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, 1, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, 2, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 5, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 5, 1, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcde", 6, 0, 0); -} - -void test38() -{ - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 1, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 5, -4); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 9, -8); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 10, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 11, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 8, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 10, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 1, -5); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 2, -5); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 4, -5); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, 1, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, 2, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 10, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 10, 1, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 1, 0); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 10, -9); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 19, -18); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 20, -19); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 21, -19); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 0, 10, "", 0, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "", 0, 1, 10); - test("abcdefghijklmnopqrst", 0, 10, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 1, 9); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 2, 8); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 4, 6); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 5, 5); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 6, 5); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 2, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 3, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 5, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 1, -2); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 3, -2); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 4, -2); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 1, -4); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 2, -4); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 5, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 5, 1, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 1, 9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 5, 5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 9, 1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 10, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 11, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 8, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 10, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 1, -5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 2, -5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 4, -5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 1, -9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 2, -9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 10, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 10, 1, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 1, 9); -} - -void test39() -{ - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 10, 0); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 19, -9); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 20, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 21, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 20, 0, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 20, 1, 10); - test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 0, 19, "", 0, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 19, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 1, 18); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 2, 17); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 4, 15); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 5, 14); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 6, 14); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 2, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 3, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 5, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 1, -2); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 3, -2); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 4, -2); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 1, -4); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 2, -4); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 5, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 5, 1, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 1, 18); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 5, 14); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 9, 10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 10, 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 11, 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 8, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 10, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 1, -5); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 2, -5); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 4, -5); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 1, -9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 2, -9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 10, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 10, 1, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 1, 18); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 10, 9); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 19, 0); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 20, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 21, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 20, 0, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 20, 1, 19); - test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 0, 20, "", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "", 0, 1, 20); - test("abcdefghijklmnopqrst", 0, 20, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 0, 20); -} - -void test40() -{ - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 2, 18); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 4, 16); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 5, 15); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 6, 15); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 2, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 3, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 5, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 1, -2); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 3, -2); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 4, -2); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 1, -4); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 2, -4); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 5, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 5, 1, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 5, 15); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 9, 11); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 8, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 10, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 1, -5); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 2, -5); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 4, -5); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 1, -9); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 2, -9); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10, 1, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 20, 0); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 21, 0); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 20, 0, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 20, 1, 20); - test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 0, 21, "", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "", 0, 1, 20); - test("abcdefghijklmnopqrst", 0, 21, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 2, 18); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 4, 16); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 5, 15); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 6, 15); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 2, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 3, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 5, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 1, -2); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 3, -2); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 4, -2); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 1, -4); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 2, -4); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 5, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 5, 1, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 5, 15); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 9, 11); -} - -void test41() -{ - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 4, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 8, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 10, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 1, -5); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 2, -5); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 4, -5); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 1, -9); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 2, -9); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10, 1, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 1, 19); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 20, 0); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 21, 0); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 9, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 18, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 1, -10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 5, -10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 9, -10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 1, -19); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 2, -19); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 20, 0, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 20, 1, 20); - test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 1, 0, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 2, -2); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 4, -4); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 5, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 6, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 2, -2); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 3, -3); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 4, -4); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 5, -4); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 3, -3); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 4, -3); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, 2, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 5, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 9, -9); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 10, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 11, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 4, -4); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 8, -8); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 9, -9); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 10, -9); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 2, -2); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, 2, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 21, -20); -} - -void test42() -{ - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 1, 1, "", 0, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 2, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 4, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 6, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 1, 0); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 2, -1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 3, -2); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 4, -3); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 5, -3); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 2, -1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 3, -1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 4, -1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 1, -3); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 2, -3); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 5, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 5, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 9, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 11, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 1, 0); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 4, -3); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 8, -7); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 9, -8); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 10, -8); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 1, -4); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 2, -4); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 5, -4); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 6, -4); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 1, -8); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 2, -8); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 10, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 10, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 1, 0); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 9, -8); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 18, -17); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 19, -18); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 20, -18); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 1, 9, "", 0, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "", 0, 1, 9); - test("abcdefghijklmnopqrst", 1, 9, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 2, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 4, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 5, 1); -} - -void test43() -{ - test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 6, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 1, 8); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 2, 7); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 3, 6); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 4, 5); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 5, 5); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 2, -1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 3, -1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 4, -1); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 1, -3); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 2, -3); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 5, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 5, 1, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 9, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 11, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 1, 8); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 4, 5); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 8, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 9, 0); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 10, 0); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 1, -4); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 2, -4); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 5, -4); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 6, -4); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 1, -8); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 2, -8); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 10, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 10, 1, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 1, 8); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 9, 0); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 18, -9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 19, -10); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 20, -10); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 20, 0, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 20, 1, 9); - test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 1, 18, "", 0, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "", 0, 1, 18); - test("abcdefghijklmnopqrst", 1, 18, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 2, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 4, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 6, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 1, 17); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 2, 16); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 3, 15); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 4, 14); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 5, 14); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 2, -1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 3, -1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 4, -1); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 1, -3); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 2, -3); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 5, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 5, 1, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 9, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 11, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 1, 17); -} - -void test44() -{ - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 4, 14); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 8, 10); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 9, 9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 10, 9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 1, -4); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 2, -4); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 5, -4); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 6, -4); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 1, -8); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 2, -8); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 10, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 10, 1, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 1, 17); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 9, 9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 18, 0); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 19, -1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 20, -1); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 20, 0, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 20, 1, 18); - test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 1, 19, "", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "", 0, 1, 19); - test("abcdefghijklmnopqrst", 1, 19, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 2, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 4, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 6, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 1, 18); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 2, 17); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 3, 16); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 4, 15); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 5, 15); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 2, -1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 3, -1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 4, -1); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 1, -3); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 2, -3); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 5, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 5, 1, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 9, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 11, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 1, 18); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 4, 15); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 8, 11); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 9, 10); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 10, 10); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 1, -4); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 2, -4); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 5, -4); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 6, -4); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 1, -8); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 2, -8); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 10, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 10, 1, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 1, 18); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 9, 10); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 18, 1); -} - -void test45() -{ - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 19, 0); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 20, 0); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 20, 0, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 20, 1, 19); - test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 1, 20, "", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "", 0, 1, 19); - test("abcdefghijklmnopqrst", 1, 20, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 2, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 4, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 6, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 1, 18); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 2, 17); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 3, 16); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 4, 15); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 5, 15); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 2, -1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 3, -1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 4, -1); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 1, -3); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 2, -3); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 5, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 5, 1, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 5, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 9, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 11, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 1, 18); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 4, 15); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 8, 11); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 9, 10); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 10, 10); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 1, -4); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 2, -4); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 5, -4); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 6, -4); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 1, -8); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 2, -8); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 10, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 10, 1, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 1, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 10, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 19, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 20, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 21, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 1, 18); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 9, 10); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 18, 1); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 19, 0); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 20, 0); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 1, -9); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 5, -9); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 1, -18); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 2, -18); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 20, 0, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 20, 1, 19); - test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 10, 0, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 2, -2); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 4, -4); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 5, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 6, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 2, -2); -} - -void test46() -{ - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 3, -3); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 4, -4); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 5, -4); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 3, -3); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 4, -3); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, 2, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 5, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 9, -9); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 10, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 11, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 4, -4); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 8, -8); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 9, -9); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 10, -9); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 2, -2); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, 2, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 10, 1, "", 0, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "", 0, 1, 1); - test("abcdefghijklmnopqrst", 10, 1, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 2, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 4, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 6, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 2, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 3, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 5, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 1, 8); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 2, 8); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 3, 8); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 4, 8); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 1, 6); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 2, 6); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 5, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 5, 1, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 9, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 8, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 10, 9); -} - -void test47() -{ - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 1, 5); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 2, 5); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 4, 5); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 5, 5); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 6, 5); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 1, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 2, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10, 1, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 19, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 20, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 21, 10); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 18, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 19, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 20, 9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 1, 0); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 5, -4); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 9, -8); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 10, -9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 11, -9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 1, -9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 2, -9); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 10, 5, "", 0, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "", 0, 1, 5); - test("abcdefghijklmnopqrst", 10, 5, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 2, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 4, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 6, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 2, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 3, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 5, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 1, 8); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 2, 8); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 3, 8); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 4, 8); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 1, 6); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 2, 6); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 5, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 5, 1, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 9, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 8, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 10, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 1, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 2, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 4, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 5, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 6, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 1, 1); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 2, 1); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10, 1, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 19, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 20, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 21, 10); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 18, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 19, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 20, 9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 1, 4); -} - -void test48() -{ - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 5, 0); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 9, -4); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 10, -5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 11, -5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 1, -9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 2, -9); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 20, 0, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 20, 1, 5); - test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 10, 9, "", 0, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "", 0, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 2, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 4, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 6, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 2, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 3, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 5, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 1, 8); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 2, 8); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 3, 8); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 4, 8); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 1, 6); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 2, 6); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 5, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 5, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 9, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 8, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 10, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 1, 5); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 2, 5); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 4, 5); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 5, 5); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 6, 5); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 1, 1); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 2, 1); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 19, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 20, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 21, 10); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 18, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 19, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 20, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 1, 8); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 5, 4); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 9, 0); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 10, -1); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 11, -1); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 1, -9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 2, -9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 20, 0, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 20, 1, 9); - test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 10, 10, "", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 2, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 4, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 6, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 2, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 3, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 5, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 0, 10); -} - -void test49() -{ - test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 1, 8); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 2, 8); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 3, 8); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 4, 8); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 1, 6); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 2, 6); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 5, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 5, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 9, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 8, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 10, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 1, 5); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 2, 5); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 4, 5); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 5, 5); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 6, 5); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 1, 1); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 2, 1); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 19, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 20, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 21, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 18, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 19, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 20, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 1, 9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 5, 5); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 9, 1); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 10, 0); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 11, 0); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 1, -9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 2, -9); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 20, 0, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 20, 1, 10); - test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 10, 11, "", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 2, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 4, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 6, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 2, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 3, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 5, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 1, 8); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 2, 8); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 3, 8); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 4, 8); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 1, 6); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 2, 6); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 5, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 5, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 5, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 9, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 11, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 4, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 8, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 10, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 1, 5); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 2, 5); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 4, 5); -} - -void test50() -{ - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 5, 5); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 6, 5); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 1, 1); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 2, 1); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 10, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 19, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 20, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 21, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 1, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 9, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 18, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 19, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 20, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 1, 9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 5, 5); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 9, 1); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 10, 0); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 11, 0); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 1, -9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 2, -9); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 20, 0, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 20, 1, 10); - test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 19, 0, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 2, -2); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 4, -4); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 5, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 6, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 2, -2); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 3, -3); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 4, -4); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 5, -4); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 3, -3); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 4, -3); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, 2, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 5, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 9, -9); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 10, -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 11, -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 4, -4); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 8, -8); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 9, -9); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 10, -9); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 2, -2); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, 2, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 11, -10); -} - -void test51() -{ - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 19, 1, "", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "", 0, 1, 1); - test("abcdefghijklmnopqrst", 19, 1, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 1, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 2, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 4, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 5, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 6, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 1, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 2, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 3, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 4, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 5, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 1, 17); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 2, 17); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 3, 17); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 4, 17); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 1, 15); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 2, 15); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 5, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 5, 1, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 1, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 5, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 9, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 10, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 11, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 1, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 4, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 8, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 9, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 10, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 1, 14); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 2, 14); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 4, 14); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 5, 14); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 6, 14); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 1, 10); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 2, 10); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 10, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 10, 1, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 1, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 10, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 19, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 20, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 21, 19); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 1, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 9, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 18, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 19, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 20, 18); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 1, 9); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 5, 9); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 9, 9); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 10, 9); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 11, 9); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 1, 0); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 2, 0); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 19, 2, "", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "", 0, 1, 1); - test("abcdefghijklmnopqrst", 19, 2, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 1, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 2, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 4, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 5, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 6, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 1, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 2, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 3, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 4, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 5, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 1, 17); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 2, 17); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 3, 17); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 4, 17); -} - -void test52() -{ - test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 1, 15); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 2, 15); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 5, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 5, 1, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 1, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 5, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 9, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 10, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 11, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 1, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 4, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 8, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 9, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 10, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 1, 14); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 2, 14); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 4, 14); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 5, 14); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 6, 14); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 1, 10); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 2, 10); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 10, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 10, 1, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 1, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 10, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 19, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 20, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 21, 19); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 1, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 9, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 18, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 19, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 20, 18); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 1, 9); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 5, 9); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 9, 9); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 10, 9); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 11, 9); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 1, 0); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 2, 0); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 20, 0, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 20, 1, 1); - test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 20, 0, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 2, -2); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 4, -4); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 5, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 6, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 2, -2); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 3, -3); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 4, -4); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 5, -4); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 3, -3); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 4, -3); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, 2, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 5, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 9, -9); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 10, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 11, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 4, -4); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 8, -8); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 9, -9); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 10, -9); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 2, -2); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, 1, -1); -} - -void test53() -{ - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, 2, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 20, 1, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 2, -2); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 4, -4); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 5, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 6, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 2, -2); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 3, -3); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 4, -4); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 5, -4); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 2, -2); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 3, -3); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 4, -3); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, 2, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 5, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 9, -9); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 10, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 11, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 4, -4); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 8, -8); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 9, -9); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 10, -9); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 2, -2); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 4, -4); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 5, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 6, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, 2, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 10, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 19, -19); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 20, -20); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 21, -20); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 9, -9); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 18, -18); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 19, -19); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 20, -19); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 5, -5); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 9, -9); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 10, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 11, -10); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, 1, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, 2, -1); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 20, 0, 0); -} - -void test54() -{ - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 21, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "", 0, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "", 0, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "", 1, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 4, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 6, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 3, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 4, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 3, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 4, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 5, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 5, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcde", 6, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 9, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 10, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 11, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 4, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 8, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 9, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 10, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 4, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 6, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 10, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 10, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 11, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 10, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 19, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 20, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 21, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 9, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 18, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 19, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 20, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 5, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 9, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 10, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 11, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 2, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 20, 0, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 20, 1, 0); - test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 21, 0, 0); -} - - -int main () { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - - - { - test("abcde", 5, 1, "", 0, 0, 0); - test("abcde", 2, 4, "", 0, 0, 3); - test("abcde", 2, 4, "abcde", 3, 4, -2); - test("ABCde", 2, 4, "abcde", 2, 4, -1); - } - - { - test(L"abcde", 5, 1, L"", 0, 0, 0); - test(L"abcde", 2, 4, L"", 0, 0, 3); - test(L"abcde", 2, 4, L"abcde", 3, 4, -2); - test(L"ABCde", 2, 4, L"abcde", 2, 4, -1); - } - -#if TEST_STD_VER >= 11 - { - test(u"abcde", 5, 1, u"", 0, 0, 0); - test(u"abcde", 2, 4, u"", 0, 0, 3); - test(u"abcde", 2, 4, u"abcde", 3, 4, -2); - test(u"ABCde", 2, 4, u"abcde", 2, 4, -1); - } - - { - test(U"abcde", 5, 1, U"", 0, 0, 0); - test(U"abcde", 2, 4, U"", 0, 0, 3); - test(U"abcde", 2, 4, U"abcde", 3, 4, -2); - test(U"ABCde", 2, 4, U"abcde", 2, 4, -1); - } -#endif - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1 { "abcde", 5 }; - static_assert ( sv1.compare(5, 1, "", 0, 0) == 0, "" ); - static_assert ( sv1.compare(2, 4, "", 0, 0) == 1, "" ); - static_assert ( sv1.compare(2, 4, "abcde", 3, 4) == -1, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp deleted file mode 100644 index ff01daaf1..000000000 --- a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp +++ /dev/null @@ -1,122 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// -// constexpr int compare(basic_string_view str) const noexcept; - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); } - -template -void test1 ( std::experimental::basic_string_view sv1, - std::experimental::basic_string_view sv2, int expected ) { - assert ( sign( sv1.compare(sv2)) == sign(expected)); -} - - -template -void test ( const CharT *s1, const CharT *s2, int expected ) { - typedef std::experimental::basic_string_view string_view_t; - - string_view_t sv1 ( s1 ); - string_view_t sv2 ( s2 ); - test1(sv1, sv2, expected); -} - -int main () { - - test("", "", 0); - test("", "abcde", -5); - test("", "abcdefghij", -10); - test("", "abcdefghijklmnopqrst", -20); - test("abcde", "", 5); - test("abcde", "abcde", 0); - test("abcde", "abcdefghij", -5); - test("abcde", "abcdefghijklmnopqrst", -15); - test("abcdefghij", "", 10); - test("abcdefghij", "abcde", 5); - test("abcdefghij", "abcdefghij", 0); - test("abcdefghij", "abcdefghijklmnopqrst", -10); - test("abcdefghijklmnopqrst", "", 20); - test("abcdefghijklmnopqrst", "abcde", 15); - test("abcdefghijklmnopqrst", "abcdefghij", 10); - test("abcdefghijklmnopqrst", "abcdefghijklmnopqrst", 0); - - test(L"", L"", 0); - test(L"", L"abcde", -5); - test(L"", L"abcdefghij", -10); - test(L"", L"abcdefghijklmnopqrst", -20); - test(L"abcde", L"", 5); - test(L"abcde", L"abcde", 0); - test(L"abcde", L"abcdefghij", -5); - test(L"abcde", L"abcdefghijklmnopqrst", -15); - test(L"abcdefghij", L"", 10); - test(L"abcdefghij", L"abcde", 5); - test(L"abcdefghij", L"abcdefghij", 0); - test(L"abcdefghij", L"abcdefghijklmnopqrst", -10); - test(L"abcdefghijklmnopqrst", L"", 20); - test(L"abcdefghijklmnopqrst", L"abcde", 15); - test(L"abcdefghijklmnopqrst", L"abcdefghij", 10); - test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0); - -#if TEST_STD_VER >= 11 - test(u"", u"", 0); - test(u"", u"abcde", -5); - test(u"", u"abcdefghij", -10); - test(u"", u"abcdefghijklmnopqrst", -20); - test(u"abcde", u"", 5); - test(u"abcde", u"abcde", 0); - test(u"abcde", u"abcdefghij", -5); - test(u"abcde", u"abcdefghijklmnopqrst", -15); - test(u"abcdefghij", u"", 10); - test(u"abcdefghij", u"abcde", 5); - test(u"abcdefghij", u"abcdefghij", 0); - test(u"abcdefghij", u"abcdefghijklmnopqrst", -10); - test(u"abcdefghijklmnopqrst", u"", 20); - test(u"abcdefghijklmnopqrst", u"abcde", 15); - test(u"abcdefghijklmnopqrst", u"abcdefghij", 10); - test(u"abcdefghijklmnopqrst", u"abcdefghijklmnopqrst", 0); - - test(U"", U"", 0); - test(U"", U"abcde", -5); - test(U"", U"abcdefghij", -10); - test(U"", U"abcdefghijklmnopqrst", -20); - test(U"abcde", U"", 5); - test(U"abcde", U"abcde", 0); - test(U"abcde", U"abcdefghij", -5); - test(U"abcde", U"abcdefghijklmnopqrst", -15); - test(U"abcdefghij", U"", 10); - test(U"abcdefghij", U"abcde", 5); - test(U"abcdefghij", U"abcdefghij", 0); - test(U"abcdefghij", U"abcdefghijklmnopqrst", -10); - test(U"abcdefghijklmnopqrst", U"", 20); - test(U"abcdefghijklmnopqrst", U"abcde", 15); - test(U"abcdefghijklmnopqrst", U"abcdefghij", 10); - test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0); -#endif - -#if TEST_STD_VER > 11 - { - typedef std::experimental::basic_string_view> SV; - constexpr SV sv1 { "abcde", 5 }; - constexpr SV sv2 { "abcde", 5 }; - constexpr SV sv3 { "edcba0", 6 }; - static_assert ( sv1.compare(sv2) == 0, "" ); - static_assert ( sv2.compare(sv1) == 0, "" ); - static_assert ( sv3.compare(sv2) > 0, "" ); - static_assert ( sv2.compare(sv3) < 0, "" ); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/copy.pass.cpp b/test/std/experimental/string.view/string.view.ops/copy.pass.cpp deleted file mode 100644 index 0acd5bda4..000000000 --- a/test/std/experimental/string.view/string.view.ops/copy.pass.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// size_type copy(charT* s, size_type n, size_type pos = 0) const; - -// Throws: out_of_range if pos > size(). -// Remarks: Let rlen be the smaller of n and size() - pos. -// Requires: [s, s+rlen) is a valid range. -// Effects: Equivalent to std::copy_n(begin() + pos, rlen, s). -// Returns: rlen. - - -#include -#include - -#include "test_macros.h" - -template -void test1 ( std::experimental::basic_string_view sv, size_t n, size_t pos ) { - const size_t rlen = std::min ( n, sv.size() - pos ); - - CharT *dest1 = new CharT [rlen + 1]; dest1[rlen] = 0; - CharT *dest2 = new CharT [rlen + 1]; dest2[rlen] = 0; - - if (pos > sv.size()) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - sv.copy(dest1, n, pos); - assert(false); - } catch (const std::out_of_range&) { - } catch (...) { - assert(false); - } -#endif - } else { - sv.copy(dest1, n, pos); - std::copy_n(sv.begin() + pos, rlen, dest2); - for ( size_t i = 0; i <= rlen; ++i ) - assert ( dest1[i] == dest2[i] ); - } - delete [] dest1; - delete [] dest2; -} - - -template -void test ( const CharT *s ) { - typedef std::experimental::basic_string_view string_view_t; - - string_view_t sv1 ( s ); - - test1(sv1, 0, 0); - test1(sv1, 1, 0); - test1(sv1, 20, 0); - test1(sv1, sv1.size(), 0); - test1(sv1, 20, string_view_t::npos); - - test1(sv1, 0, 3); - test1(sv1, 2, 3); - test1(sv1, 100, 3); - test1(sv1, 100, string_view_t::npos); - - test1(sv1, sv1.size(), string_view_t::npos); - - test1(sv1, sv1.size() + 1, 0); - test1(sv1, sv1.size() + 1, 1); - test1(sv1, sv1.size() + 1, string_view_t::npos); - -} - -int main () { - test ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( "ABCDE"); - test ( "a" ); - test ( "" ); - - test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( L"ABCDE" ); - test ( L"a" ); - test ( L"" ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( u"ABCDE" ); - test ( u"a" ); - test ( u"" ); - - test ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( U"ABCDE" ); - test ( U"a" ); - test ( U"" ); -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp deleted file mode 100644 index a3a1dbf41..000000000 --- a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const; - -// Throws: out_of_range if pos > size(). -// Effects: Determines the effective length rlen of the string to reference as the smaller of n and size() - pos. -// Returns: basic_string_view(data()+pos, rlen). - -#include -#include - -#include "test_macros.h" - -template -void test1 ( std::experimental::basic_string_view sv, size_t n, size_t pos ) { - if (pos > sv.size()) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - std::experimental::basic_string_view sv1 = sv.substr(pos, n); - assert(false); - ((void)sv1); - } catch (const std::out_of_range&) { - return; - } catch (...) { - assert(false); - } -#endif - } else { - std::experimental::basic_string_view sv1 = sv.substr(pos, n); - const size_t rlen = std::min ( n, sv.size() - pos ); - assert ( sv1.size() == rlen ); - for ( size_t i = 0; i <= rlen; ++i ) - assert ( sv[pos+i] == sv1[i] ); - } -} - - -template -void test ( const CharT *s ) { - typedef std::experimental::basic_string_view string_view_t; - - string_view_t sv1 ( s ); - - test1(sv1, 0, 0); - test1(sv1, 1, 0); - test1(sv1, 20, 0); - test1(sv1, sv1.size(), 0); - - test1(sv1, 0, 3); - test1(sv1, 2, 3); - test1(sv1, 100, 3); - - test1(sv1, 0, string_view_t::npos); - test1(sv1, 2, string_view_t::npos); - test1(sv1, sv1.size(), string_view_t::npos); - - test1(sv1, sv1.size() + 1, 0); - test1(sv1, sv1.size() + 1, 1); - test1(sv1, sv1.size() + 1, string_view_t::npos); -} - -int main () { - test ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( "ABCDE"); - test ( "a" ); - test ( "" ); - - test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( L"ABCDE" ); - test ( L"a" ); - test ( L"" ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( u"ABCDE" ); - test ( u"a" ); - test ( u"" ); - - test ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( U"ABCDE" ); - test ( U"a" ); - test ( U"" ); -#endif - -#if TEST_STD_VER > 11 - { - constexpr std::experimental::string_view sv1 { "ABCDE", 5 }; - - { - constexpr std::experimental::string_view sv2 = sv1.substr ( 0, 3 ); - static_assert ( sv2.size() == 3, "" ); - static_assert ( sv2[0] == 'A', "" ); - static_assert ( sv2[1] == 'B', "" ); - static_assert ( sv2[2] == 'C', "" ); - } - - { - constexpr std::experimental::string_view sv2 = sv1.substr ( 3, 0 ); - static_assert ( sv2.size() == 0, "" ); - } - - { - constexpr std::experimental::string_view sv2 = sv1.substr ( 3, 3 ); - static_assert ( sv2.size() == 2, "" ); - static_assert ( sv2[0] == 'D', "" ); - static_assert ( sv2[1] == 'E', "" ); - } - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp b/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp deleted file mode 100644 index a32a2684c..000000000 --- a/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// - -// template -// explicit operator basic_string<_CharT, _Traits, Allocator> () const; -// template, class Allocator = allocator<_CharT> > -// basic_string<_CharT, _Traits, Allocator> to_string ( -// basic_string_view<_CharT, _Traits> _sv, const Allocator& _a = Allocator()) const; - -#include -#include -#include "min_allocator.h" - -template -void test ( const CharT *s ) { - typedef std::basic_string String ; - { - const std::experimental::basic_string_view sv1 ( s ); - String str1 = (String) sv1; - - assert ( sv1.size() == str1.size ()); - assert ( std::char_traits::compare ( sv1.data(), str1.data(), sv1.size()) == 0 ); - -#if TEST_STD_VER >= 11 - auto str2 = sv1.to_string(min_allocator()); - assert ( sv1.size() == str2.size ()); - assert ( std::char_traits::compare ( sv1.data(), str2.data(), sv1.size()) == 0 ); -#endif - } - - { - const std::experimental::basic_string_view sv1; - String str1 = (String) sv1; - - assert ( sv1.size() == 0); - assert ( sv1.size() == str1.size ()); - -#if TEST_STD_VER >= 11 - auto str2 = sv1.to_string(min_allocator()); - assert ( sv1.size() == str2.size ()); -#endif - } -} - -int main () { - test ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( "ABCDE"); - test ( "a" ); - test ( "" ); - - test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( L"ABCDE" ); - test ( L"a" ); - test ( L"" ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( u"ABCDE" ); - test ( u"a" ); - test ( u"" ); - - test ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" ); - test ( U"ABCDE" ); - test ( U"a" ); - test ( U"" ); -#endif -} diff --git a/test/std/experimental/string.view/string.view.synop/nothing_to_do.pass.cpp b/test/std/experimental/string.view/string.view.synop/nothing_to_do.pass.cpp deleted file mode 100644 index c21f8a701..000000000 --- a/test/std/experimental/string.view/string.view.synop/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -int main () {} diff --git a/test/std/experimental/string.view/string.view.template/nothing_to_do.pass.cpp b/test/std/experimental/string.view/string.view.template/nothing_to_do.pass.cpp deleted file mode 100644 index c21f8a701..000000000 --- a/test/std/experimental/string.view/string.view.template/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -int main () {} From 53095c720035134125541dbf4f142d4aed069917 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 5 Feb 2018 23:50:49 +0000 Subject: [PATCH 0341/1520] Add issues in 'Review' git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324292 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 7c4a27ba8..92053bec8 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -94,6 +94,17 @@ +

    Issues to "Review"

    + + + + + + + +
    Issue #Issue NameMeetingStatus
    2412promise::set_value() and promise::get_future() should not raceJacksonville
    2682filesystem::copy() won't create a symlink to a directoryJacksonville
    2697[concurr.ts] Behavior of future/shared_future unwrapping constructor when given an invalid futureJacksonville
    2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonville
    2936Path comparison is defined in terms of the generic formatJacksonville
    + +

    Comments about the issues

    • 2164 - Writing tests here will be fun.
    • @@ -121,8 +132,8 @@
    • 3030 - Wording changes only?? Do we handle exceptions correctly here?
    • 3034 - Need to check if our tests are correct.
    • 3035 - Easy to do
    • -
    • 3039 - We should implement P0777 first.
    • -
    • 3041 - We should implement P0777 first.
    • +
    • 3039 - Patch Ready
    • +
    • 3041 - Patch Ready
    • 3042 - We already do this.
    • 3043 - We have a 'TODO(ericwf)' here
    • 3045 - We haven't done the <atomic> rework yet.
    • @@ -130,7 +141,16 @@
    • 3051 - Fixing an inadvertent wording change
    -

    Last Updated: 29-Jan-2018

    +

    Comments about the "Review" issues

    +
      +
    • 2412 -
    • +
    • 2682 -
    • +
    • 2697 -
    • +
    • 2708 -
    • +
    • 2936 -
    • +
    + +

    Last Updated: 5-Feb-2018

    From 6c83c7ff6fa328a152f93a9a511a3e890b9e353f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 01:59:28 +0000 Subject: [PATCH 0342/1520] More patches ready git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324307 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 92053bec8..fadd4e8be 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -63,8 +63,8 @@ 2243istream::putback problemJacksonvilleComplete 2816resize_file has impossible postconditionJacksonvilleNothing to do 2843Unclear behavior of std::pmr::memory_resource::do_allocate()Jacksonville -2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?JacksonvilleNothing to do -2851std::filesystem enum classes are now underspecifiedJacksonvilleNothing to do +2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?JacksonvilleNothing to do +2851std::filesystem enum classes are now underspecifiedJacksonvilleNothing to do 2969polymorphic_allocator::construct() shouldn't pass resource()Jacksonville 2975Missing case for pair construction in scoped and polymorphic allocatorsJacksonville 2989path's stream insertion operator lets you insert everything under the sunJacksonvilleCompleted @@ -77,15 +77,15 @@ 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville 3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete 3014More noexcept issues with filesystem operationsJacksonvilleComplete - 3015copy_options::unspecified underspecifiedJacksonvilleNothing to do +3015copy_options::unspecified underspecifiedJacksonvilleNothing to do 3017list splice functions should use addressofJacksonville 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville 3030Who shall meet the requirements of try_lock?Jacksonville 3034P0767R1 breaks previously-standard-layout typesJacksonville -3035std::allocator's constructors should be constexprJacksonville -3039Unnecessary decay in thread and packaged_taskJacksonville -3041Unnecessary decay in reference_wrapperJacksonville +3035std::allocator's constructors should be constexprJacksonvillePatch Ready +3039Unnecessary decay in thread and packaged_taskJacksonvillePatch Ready +3041Unnecessary decay in reference_wrapperJacksonvillePatch Ready 3042is_literal_type_v should be inlineJacksonvilleComplete 3043Bogus postcondition for filesystem_error constructorJacksonville 3045atomic<floating-point> doesn't have value_type or difference_typeJacksonville @@ -131,7 +131,7 @@
  • 3026 - I think this is just wording cleanup - Eric?
  • 3030 - Wording changes only?? Do we handle exceptions correctly here?
  • 3034 - Need to check if our tests are correct.
  • -
  • 3035 - Easy to do
  • +
  • 3035 - Patch Ready
  • 3039 - Patch Ready
  • 3041 - Patch Ready
  • 3042 - We already do this.
  • From 610fc67809b52442079f1ec2fe357006dcc69d76 Mon Sep 17 00:00:00 2001 From: Nirav Dave Date: Tue, 6 Feb 2018 03:03:37 +0000 Subject: [PATCH 0343/1520] Revert "[libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types." Revert "Fix initialization of array with GCC." Revert "Make array non-CopyAssignable and make swap and fill ill-formed." This reverts commit r324182, r324185, and r324194 which were causing issues with zero-length std::arrays. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324309 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/array | 87 ++++------------- .../array/array.cons/default.pass.cpp | 17 ---- .../array/array.cons/implicit_copy.pass.cpp | 93 ------------------- .../sequences/array/array.data/data.pass.cpp | 18 ---- .../array/array.data/data_const.pass.cpp | 10 -- .../sequences/array/array.fill/fill.fail.cpp | 29 ------ .../sequences/array/array.swap/swap.fail.cpp | 30 ------ .../containers/sequences/array/begin.pass.cpp | 9 -- 8 files changed, 17 insertions(+), 276 deletions(-) delete mode 100644 test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp delete mode 100644 test/std/containers/sequences/array/array.fill/fill.fail.cpp delete mode 100644 test/std/containers/sequences/array/array.swap/swap.fail.cpp diff --git a/include/array b/include/array index 068ab506a..4eb2fe6fc 100644 --- a/include/array +++ b/include/array @@ -117,57 +117,6 @@ template const T&& get(const array&&) noexce _LIBCPP_BEGIN_NAMESPACE_STD -template -struct __array_traits { - typedef _Tp _StorageT[_Size]; - - _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX14 typename remove_const<_Tp>::type* - __data(typename remove_const<_StorageT>::type& __store) { - return __store; - } - - _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX14 _Tp const* __data(const _StorageT& __store) { - return __store; - } - - _LIBCPP_INLINE_VISIBILITY - static void __swap(_StorageT& __lhs, _StorageT& __rhs) { - std::swap_ranges(__lhs, __lhs + _Size, __rhs); - } - - _LIBCPP_INLINE_VISIBILITY - static void __fill(_StorageT& __arr, _Tp const& __val) { - _VSTD::fill_n(__arr, _Size, __val); - } -}; - -template -struct __array_traits<_Tp, 0> { - typedef typename aligned_storage::value>::type - _NonConstStorageT[1]; - typedef typename conditional::value, const _NonConstStorageT, - _NonConstStorageT>::type _StorageT; - typedef typename remove_const<_Tp>::type _NonConstTp; - - _LIBCPP_INLINE_VISIBILITY - static _NonConstTp* __data(_NonConstStorageT &__store) { - return reinterpret_cast<_NonConstTp*>(__store); - } - - _LIBCPP_INLINE_VISIBILITY - static const _Tp* __data(const _StorageT &__store) { - return reinterpret_cast(__store); - } - - _LIBCPP_INLINE_VISIBILITY - static void __swap(_StorageT&, _StorageT&) {} - - _LIBCPP_INLINE_VISIBILITY - static void __fill(_StorageT&, _Tp const&) {} -}; - template struct _LIBCPP_TEMPLATE_VIS array { @@ -185,33 +134,31 @@ struct _LIBCPP_TEMPLATE_VIS array typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - typedef __array_traits<_Tp, _Size> _Traits; - typename _Traits::_StorageT __elems_; + value_type __elems_[_Size > 0 ? _Size : 1]; // No explicit construct/copy/destroy for aggregate type - _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) { - static_assert(_Size != 0 || !is_const<_Tp>::value, - "cannot fill zero-sized array of type 'const T'"); - _Traits::__fill(__elems_, __u); - } + _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) + {_VSTD::fill_n(__elems_, _Size, __u);} + _LIBCPP_INLINE_VISIBILITY + void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) + { __swap_dispatch((std::integral_constant()), __a); } _LIBCPP_INLINE_VISIBILITY - void swap(array& __a) - _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) { - static_assert(_Size != 0 || !is_const<_Tp>::value, - "cannot swap zero-sized array of type 'const T'"); - _Traits::__swap(__elems_, __a.__elems_); - } + void __swap_dispatch(std::true_type, array&) {} + + _LIBCPP_INLINE_VISIBILITY + void __swap_dispatch(std::false_type, array& __a) + { _VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);} // iterators: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - iterator begin() _NOEXCEPT {return iterator(data());} + iterator begin() _NOEXCEPT {return iterator(__elems_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const_iterator begin() const _NOEXCEPT {return const_iterator(data());} + const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - iterator end() _NOEXCEPT {return iterator(data() + _Size);} + iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);} + const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -254,9 +201,9 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - value_type* data() _NOEXCEPT {return _Traits::__data(__elems_);} + value_type* data() _NOEXCEPT {return __elems_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const value_type* data() const _NOEXCEPT {return _Traits::__data(__elems_);} + const value_type* data() const _NOEXCEPT {return __elems_;} }; template diff --git a/test/std/containers/sequences/array/array.cons/default.pass.cpp b/test/std/containers/sequences/array/array.cons/default.pass.cpp index 9a2a6eaa3..7bc62b759 100644 --- a/test/std/containers/sequences/array/array.cons/default.pass.cpp +++ b/test/std/containers/sequences/array/array.cons/default.pass.cpp @@ -14,14 +14,6 @@ #include #include -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - -struct NoDefault { - NoDefault(int) {} -}; - int main() { { @@ -36,13 +28,4 @@ int main() C c; assert(c.size() == 0); } - { - typedef std::array C; - C c; - assert(c.size() == 0); - C c1 = {}; - assert(c1.size() == 0); - C c2 = {{}}; - assert(c2.size() == 0); - } } diff --git a/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp deleted file mode 100644 index a8434c018..000000000 --- a/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// implicitly generated array constructors / assignment operators - -#include -#include -#include -#include "test_macros.h" - -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - -// In C++03 the copy assignment operator is not deleted when the implicitly -// generated operator would be ill-formed; like in the case of a struct with a -// const member. -#if TEST_STD_VER < 11 -#define TEST_NOT_COPY_ASSIGNABLE(T) ((void)0) -#else -#define TEST_NOT_COPY_ASSIGNABLE(T) static_assert(!std::is_copy_assignable::value, "") -#endif - -struct NoDefault { - NoDefault(int) {} -}; - -int main() { - { - typedef double T; - typedef std::array C; - C c = {1.1, 2.2, 3.3}; - C c2 = c; - c2 = c; - static_assert(std::is_copy_constructible::value, ""); - static_assert(std::is_copy_assignable::value, ""); - } - { - typedef double T; - typedef std::array C; - C c = {1.1, 2.2, 3.3}; - C c2 = c; - ((void)c2); - static_assert(std::is_copy_constructible::value, ""); - TEST_NOT_COPY_ASSIGNABLE(C); - } - { - typedef double T; - typedef std::array C; - C c = {}; - C c2 = c; - c2 = c; - static_assert(std::is_copy_constructible::value, ""); - static_assert(std::is_copy_assignable::value, ""); - } - { - // const arrays of size 0 should disable the implicit copy assignment operator. - typedef double T; - typedef std::array C; - C c = {}; - C c2 = c; - ((void)c2); - static_assert(std::is_copy_constructible::value, ""); - TEST_NOT_COPY_ASSIGNABLE(C); - } - { - typedef NoDefault T; - typedef std::array C; - C c = {}; - C c2 = c; - c2 = c; - static_assert(std::is_copy_constructible::value, ""); - static_assert(std::is_copy_assignable::value, ""); - } - { - typedef NoDefault T; - typedef std::array C; - C c = {}; - C c2 = c; - ((void)c2); - static_assert(std::is_copy_constructible::value, ""); - TEST_NOT_COPY_ASSIGNABLE(C); - } - -} diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp index 452d6b7f3..d7aed70c9 100644 --- a/test/std/containers/sequences/array/array.data/data.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -36,22 +36,4 @@ int main() T* p = c.data(); (void)p; // to placate scan-build } - { - typedef double T; - typedef std::array C; - C c = {}; - const T* p = c.data(); - static_assert((std::is_same::value), ""); - (void)p; // to placate scan-build - } - { - struct NoDefault { - NoDefault(int) {} - }; - typedef NoDefault T; - typedef std::array C; - C c = {}; - T* p = c.data(); - assert(p != nullptr); - } } diff --git a/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/test/std/containers/sequences/array/array.data/data_const.pass.cpp index f10d51580..5be082eeb 100644 --- a/test/std/containers/sequences/array/array.data/data_const.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data_const.pass.cpp @@ -38,16 +38,6 @@ int main() const T* p = c.data(); (void)p; // to placate scan-build } - { - struct NoDefault { - NoDefault(int) {} - }; - typedef NoDefault T; - typedef std::array C; - const C c = {}; - const T* p = c.data(); - assert(p != nullptr); - } #if TEST_STD_VER > 14 { typedef std::array C; diff --git a/test/std/containers/sequences/array/array.fill/fill.fail.cpp b/test/std/containers/sequences/array/array.fill/fill.fail.cpp deleted file mode 100644 index 07816c7c7..000000000 --- a/test/std/containers/sequences/array/array.fill/fill.fail.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void fill(const T& u); - -#include -#include - -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - -int main() { - { - typedef double T; - typedef std::array C; - C c = {}; - // expected-error@array:* {{static_assert failed "cannot fill zero-sized array of type 'const T'"}} - c.fill(5.5); // expected-note {{requested here}} - } -} diff --git a/test/std/containers/sequences/array/array.swap/swap.fail.cpp b/test/std/containers/sequences/array/array.swap/swap.fail.cpp deleted file mode 100644 index 26febadb7..000000000 --- a/test/std/containers/sequences/array/array.swap/swap.fail.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void swap(array& a); - -#include -#include - -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - -int main() { - { - typedef double T; - typedef std::array C; - C c = {}; - C c2 = {}; - // expected-error@array:* {{static_assert failed "cannot swap zero-sized array of type 'const T'"}} - c.swap(c2); // expected-note {{requested here}} - } -} diff --git a/test/std/containers/sequences/array/begin.pass.cpp b/test/std/containers/sequences/array/begin.pass.cpp index 8cdef466a..b12ffc851 100644 --- a/test/std/containers/sequences/array/begin.pass.cpp +++ b/test/std/containers/sequences/array/begin.pass.cpp @@ -31,13 +31,4 @@ int main() *i = 5.5; assert(c[0] == 5.5); } - { - struct NoDefault { - NoDefault(int) {} - }; - typedef NoDefault T; - typedef std::array C; - C c = {}; - assert(c.begin() == c.end()); - } } From 4d839cb37e79867bc724836b69bf9b9c203d58f2 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 03:23:16 +0000 Subject: [PATCH 0344/1520] Mark issue 3034 as 'Patch Ready' git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324310 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index fadd4e8be..a17bce2e5 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -81,7 +81,7 @@ 3017list splice functions should use addressofJacksonville 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville -3030Who shall meet the requirements of try_lock?Jacksonville +3030Who shall meet the requirements of try_lock?JacksonvilleNothing to do 3034P0767R1 breaks previously-standard-layout typesJacksonville 3035std::allocator's constructors should be constexprJacksonvillePatch Ready 3039Unnecessary decay in thread and packaged_taskJacksonvillePatch Ready @@ -129,7 +129,7 @@
  • 3017 - We don't do the splicing stuff yet
  • 3020 - No networking TS implementation yet
  • 3026 - I think this is just wording cleanup - Eric?
  • -
  • 3030 - Wording changes only?? Do we handle exceptions correctly here?
  • +
  • 3030 - Wording changes only
  • 3034 - Need to check if our tests are correct.
  • 3035 - Patch Ready
  • 3039 - Patch Ready
  • From 46c8ec503efd01d6a13031532f76f14a7895d6d7 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 03:24:21 +0000 Subject: [PATCH 0345/1520] No, really this time mark 3034 as 'Patch Ready' git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324312 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index a17bce2e5..d148cd262 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -82,7 +82,7 @@ 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville 3030Who shall meet the requirements of try_lock?JacksonvilleNothing to do -3034P0767R1 breaks previously-standard-layout typesJacksonville +3034P0767R1 breaks previously-standard-layout typesJacksonvillePatch Ready 3035std::allocator's constructors should be constexprJacksonvillePatch Ready 3039Unnecessary decay in thread and packaged_taskJacksonvillePatch Ready 3041Unnecessary decay in reference_wrapperJacksonvillePatch Ready @@ -130,7 +130,7 @@
  • 3020 - No networking TS implementation yet
  • 3026 - I think this is just wording cleanup - Eric?
  • 3030 - Wording changes only
  • -
  • 3034 - Need to check if our tests are correct.
  • +
  • 3034 - Patch Ready
  • 3035 - Patch Ready
  • 3039 - Patch Ready
  • 3041 - Patch Ready
  • From f477af5fda63871733be081b7039f6850348e08f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 18:58:05 +0000 Subject: [PATCH 0346/1520] Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324378 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__string | 10 +++++----- include/algorithm | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/__string b/include/__string index d30c7fddc..44c55987f 100644 --- a/include/__string +++ b/include/__string @@ -266,7 +266,7 @@ const char* char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { if (__n == 0) - return NULL; + return nullptr; #if __has_feature(cxx_constexpr_string_builtins) return __builtin_char_memchr(__s, to_int_type(__a), __n); #elif _LIBCPP_STD_VER <= 14 @@ -278,7 +278,7 @@ char_traits::find(const char_type* __s, size_t __n, const char_type& __a) return __s; ++__s; } - return NULL; + return nullptr; #endif } @@ -372,9 +372,9 @@ const wchar_t* char_traits::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { if (__n == 0) - return NULL; + return nullptr; #if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wmemchr(__s, __a, __n); + return __builtin_wmemchr(__s, __a, __n); #elif _LIBCPP_STD_VER <= 14 return wmemchr(__s, __a, __n); #else @@ -384,7 +384,7 @@ char_traits::find(const char_type* __s, size_t __n, const char_type& __ return __s; ++__s; } - return NULL; + return nullptr; #endif } diff --git a/include/algorithm b/include/algorithm index 9d2690d5b..a94b07bda 100644 --- a/include/algorithm +++ b/include/algorithm @@ -4703,9 +4703,9 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1 ::new(__first2) value_type(_VSTD::move(*__first1)); return; case 2: - __destruct_n __d(0); + __destruct_n __d(0); unique_ptr __h2(__first2, __d); - if (__comp(*--__last1, *__first1)) + if (__comp(*--__last1, *__first1)) { ::new(__first2) value_type(_VSTD::move(*__last1)); __d.__incr((value_type*)0); From 68b20ca4d9c4bee2c2ad5a9240599b3e4b78d0ba Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 6 Feb 2018 19:17:41 +0000 Subject: [PATCH 0347/1520] Fix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 or lower. The 10.13 SDK always defines utimensat() (with an availability(macosx=10.13) annotation) and unconditionally defines UTIME_OMIT, so use the compile-time availability macros on Apple platforms instead. For people statically linking libc++, it might make sense to also provide an opt-in option for using __builtin_available() to dynamically check for the OS version, but for now let's do the smallest thing needed to unbreak the build. Based on a patch by Eric Fiselier : https://reviews.llvm.org/D34249 Fixes PR33469. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324385 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/experimental/filesystem/operations.cpp | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index 2bc28c21d..bd173893c 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -21,7 +21,34 @@ #include #include #include /* values for fchmodat */ -#if !defined(UTIME_OMIT) + +#if (__APPLE__) +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300 +#define _LIBCXX_USE_UTIMENSAT +#endif +#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) +#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 110000 +#define _LIBCXX_USE_UTIMENSAT +#endif +#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) +#if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 110000 +#define _LIBCXX_USE_UTIMENSAT +#endif +#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) +#if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 40000 +#define _LIBCXX_USE_UTIMENSAT +#endif +#endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__ +#else +// We can use the presence of UTIME_OMIT to detect platforms that provide +// utimensat. +#if defined(UTIME_OMIT) +#define _LIBCXX_USE_UTIMENSAT +#endif +#endif // __APPLE__ + +#if !defined(_LIBCXX_USE_UTIMENSAT) #include // for ::utimes as used in __last_write_time #endif @@ -560,9 +587,7 @@ void __last_write_time(const path& p, file_time_type new_time, using namespace std::chrono; std::error_code m_ec; - // We can use the presence of UTIME_OMIT to detect platforms that do not - // provide utimensat. -#if !defined(UTIME_OMIT) +#if !defined(_LIBCXX_USE_UTIMENSAT) // This implementation has a race condition between determining the // last access time and attempting to set it to the same value using // ::utimes From 52f9ca28a39aa02a2e78fa0eb5aa927ad046487f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 20:56:55 +0000 Subject: [PATCH 0348/1520] Implement P0777: Treating unnecessay decay git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324398 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/optional | 6 +++--- include/tuple | 8 ++++---- include/type_traits | 4 +--- include/variant | 8 ++++---- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/optional b/include/optional index 88fd6b5ab..1f8e491da 100644 --- a/include/optional +++ b/include/optional @@ -612,8 +612,8 @@ private: }; template using _CheckOptionalArgsCtor = conditional_t< - !is_same_v, in_place_t> && - !is_same_v, optional>, + !is_same_v<__uncvref_t<_Up>, in_place_t> && + !is_same_v<__uncvref_t<_Up>, optional>, _CheckOptionalArgsConstructor, __check_tuple_constructor_fail >; @@ -761,7 +761,7 @@ public: class = enable_if_t <__lazy_and< integral_constant, optional> && + !is_same_v<__uncvref_t<_Up>, optional> && !(is_same_v<_Up, value_type> && is_scalar_v) >, is_constructible, diff --git a/include/tuple b/include/tuple index 2e19f7ca8..b3a17e7b7 100644 --- a/include/tuple +++ b/include/tuple @@ -211,7 +211,7 @@ public: template ::type, __tuple_leaf>> + __lazy_not::type, __tuple_leaf>> , is_constructible<_Hp, _Tp> >::value >::type @@ -293,7 +293,7 @@ public: template ::type, __tuple_leaf>> + __lazy_not::type, __tuple_leaf>> , is_constructible<_Hp, _Tp> >::value >::type @@ -1383,7 +1383,7 @@ constexpr decltype(auto) apply(_Fn && __f, _Tuple && __t) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__apply_tuple_impl( _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t), - typename __make_tuple_indices>>::type{}) + typename __make_tuple_indices>>::type{}) ) template @@ -1398,7 +1398,7 @@ inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__make_from_tuple_impl<_Tp>(_VSTD::forward<_Tuple>(__t), - typename __make_tuple_indices>>::type{}) + typename __make_tuple_indices>>::type{}) ) #undef _LIBCPP_NOEXCEPT_RETURN diff --git a/include/type_traits b/include/type_traits index 13a771264..5cb3b5c63 100644 --- a/include/type_traits +++ b/include/type_traits @@ -1180,9 +1180,7 @@ struct __is_same_uncvref : is_same::type, #if _LIBCPP_STD_VER > 17 // aligned_union - same as __uncvref template -struct remove_cvref { - using type = remove_cv_t>; -}; +struct remove_cvref : public __uncvref<_Tp> {}; template using remove_cvref_t = typename remove_cvref<_Tp>::type; #endif diff --git a/include/variant b/include/variant index 987b8a798..63c7677c5 100644 --- a/include/variant +++ b/include/variant @@ -1143,9 +1143,9 @@ public: template < class _Arg, - enable_if_t, variant>, int> = 0, - enable_if_t>::value, int> = 0, - enable_if_t>::value, int> = 0, + enable_if_t, variant>, int> = 0, + enable_if_t>::value, int> = 0, + enable_if_t>::value, int> = 0, class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, @@ -1215,7 +1215,7 @@ public: template < class _Arg, - enable_if_t, variant>, int> = 0, + enable_if_t, variant>, int> = 0, class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, From c387931db547c76ec70229d320f9032b3948fc72 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 21:00:58 +0000 Subject: [PATCH 0349/1520] Mark P0777 as complete git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324399 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/cxx2a_status.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 684ed7da2..efe59106b 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -71,7 +71,7 @@ P0718R2LWGAtomic shared_ptrAlbuquerque P0767R1CWGDeprecate PODAlbuquerque P0768R1CWGLibrary Support for the Spaceship (Comparison) OperatorAlbuquerque - P0777R1LWGTreating Unnecessary decayAlbuquerque + P0777R1LWGTreating Unnecessary decayAlbuquerqueComplete7.0 @@ -135,7 +135,7 @@ -

    Last Updated: 31-Jan-2018

    +

    Last Updated: 6-Feb-2018

    From 31810d9c0b708561a50adcf88c7e49742d80dfde Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Feb 2018 23:13:48 +0000 Subject: [PATCH 0350/1520] Remove more of the std::experimental bits that are now in std::. All the _v type aliases, conjunction/disjunction, apply, etc. See https://libcxx.llvm.org/TS_deprecation.html git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324423 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/chrono | 50 +- include/experimental/ratio | 68 +-- include/experimental/system_error | 54 +- include/experimental/tuple | 73 +-- include/experimental/type_traits | 375 ------------- include/module.modulemap | 16 - test/libcxx/double_include.sh.cpp | 4 - .../header.ratio.synop/includes.pass.cpp | 23 - .../utilities/ratio/version.pass.cpp | 20 - .../includes.pass.cpp | 21 - .../utilities/syserror/version.pass.cpp | 20 - .../header.chrono.synop/includes.pass.cpp | 21 - .../utilities/time/version.pass.cpp | 20 - .../header.tuple.synop/includes.pass.cpp | 20 - .../utilities/tuple/version.pass.cpp | 20 - test/libcxx/min_max_macros.sh.cpp | 8 - .../meta/meta.logical/conjunction.pass.cpp | 68 --- .../meta/meta.logical/disjunction.pass.cpp | 68 --- .../meta/meta.logical/negation.pass.cpp | 41 -- .../meta/meta.type.synop/includes.pass.cpp | 21 - .../meta/meta.type.synop/meta.rel.pass.cpp | 62 --- .../meta.type.synop/meta.unary.cat.pass.cpp | 178 ------- .../meta.type.synop/meta.unary.comp.pass.cpp | 99 ---- .../meta.type.synop/meta.unary.prop.pass.cpp | 492 ------------------ .../meta.unary.prop.query.pass.cpp | 62 --- .../header.ratio.synop/includes.pass.cpp | 22 - .../header.ratio.synop/ratio_equal_v.pass.cpp | 47 -- .../ratio_greater_equal_v.pass.cpp | 61 --- .../ratio_greater_v.pass.cpp | 57 -- .../ratio_less_equal_v.pass.cpp | 57 -- .../header.ratio.synop/ratio_less_v.pass.cpp | 57 -- .../ratio_not_equal_v.pass.cpp | 47 -- .../utilities/ratio/nothing_to_do.pass.cpp | 13 - .../includes.pass.cpp | 21 - .../is_error_code_enum_v.pass.cpp | 37 -- .../is_error_condition_enum.pass.cpp | 38 -- .../header.chrono.synop/includes.pass.cpp | 19 - .../treat_as_floating_point_v.pass.cpp | 49 -- .../header.tuple.synop/includes.pass.cpp | 20 - .../tuple/tuple.apply/arg_type.pass.cpp | 187 ------- .../tuple.apply/constexpr_types.pass.cpp | 118 ----- .../tuple/tuple.apply/extended_types.pass.cpp | 427 --------------- .../tuple/tuple.apply/large_arity.pass.cpp | 146 ------ .../tuple/tuple.apply/ref_qualifiers.pass.cpp | 53 -- .../tuple/tuple.apply/return_type.pass.cpp | 70 --- .../tuple/tuple.apply/types.pass.cpp | 431 --------------- .../utilities/tuple/tuple_size_v.fail.cpp | 25 - .../utilities/tuple/tuple_size_v.pass.cpp | 45 -- .../utilities/tuple/tuple_size_v_2.fail.cpp | 25 - .../utilities/tuple/tuple_size_v_3.fail.cpp | 25 - 50 files changed, 4 insertions(+), 3997 deletions(-) delete mode 100644 test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/ratio/version.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/syserror/version.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/time/version.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp delete mode 100644 test/libcxx/experimental/utilities/tuple/version.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp delete mode 100644 test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp delete mode 100644 test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp delete mode 100644 test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp delete mode 100644 test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp delete mode 100644 test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp delete mode 100644 test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp delete mode 100644 test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/large_arity.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple_size_v.fail.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple_size_v.pass.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple_size_v_2.fail.cpp delete mode 100644 test/std/experimental/utilities/tuple/tuple_size_v_3.fail.cpp diff --git a/include/experimental/chrono b/include/experimental/chrono index ca9e5f852..591cf7160 100644 --- a/include/experimental/chrono +++ b/include/experimental/chrono @@ -8,52 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_CHRONO -#define _LIBCPP_EXPERIMENTAL_CHRONO - -/** - experimental/chrono synopsis - -// C++1y - -#include - -namespace std { -namespace chrono { -namespace experimental { -inline namespace fundamentals_v1 { - - // See C++14 20.12.4, customization traits - template constexpr bool treat_as_floating_point_v - = treat_as_floating_point::value; - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace chrono -} // namespace std - - */ - -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -#if _LIBCPP_STD_VER > 11 - -_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS - -#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES - -template _LIBCPP_CONSTEXPR bool treat_as_floating_point_v - = treat_as_floating_point<_Rep>::value; - -#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ - -_LIBCPP_END_NAMESPACE_CHRONO_LFTS - -#endif /* _LIBCPP_STD_VER > 11 */ - -#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */ +#error " has been removed. Use instead." diff --git a/include/experimental/ratio b/include/experimental/ratio index 757f24e08..9c2bf2e46 100644 --- a/include/experimental/ratio +++ b/include/experimental/ratio @@ -8,70 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_RATIO -#define _LIBCPP_EXPERIMENTAL_RATIO - -/** - experimental/ratio synopsis - C++1y -#include - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - - // See C++14 20.11.5, ratio comparison - template constexpr bool ratio_equal_v - = ratio_equal::value; - template constexpr bool ratio_not_equal_v - = ratio_not_equal::value; - template constexpr bool ratio_less_v - = ratio_less::value; - template constexpr bool ratio_less_equal_v - = ratio_less_equal::value; - template constexpr bool ratio_greater_v - = ratio_greater::value; - template constexpr bool ratio_greater_equal_v - = ratio_greater_equal::value; - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -*/ - -#include - -#if _LIBCPP_STD_VER > 11 - -#include - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES - -template _LIBCPP_CONSTEXPR bool ratio_equal_v - = ratio_equal<_R1, _R2>::value; - -template _LIBCPP_CONSTEXPR bool ratio_not_equal_v - = ratio_not_equal<_R1, _R2>::value; - -template _LIBCPP_CONSTEXPR bool ratio_less_v - = ratio_less<_R1, _R2>::value; - -template _LIBCPP_CONSTEXPR bool ratio_less_equal_v - = ratio_less_equal<_R1, _R2>::value; - -template _LIBCPP_CONSTEXPR bool ratio_greater_v - = ratio_greater<_R1, _R2>::value; - -template _LIBCPP_CONSTEXPR bool ratio_greater_equal_v - = ratio_greater_equal<_R1, _R2>::value; - -#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_STD_VER > 11 */ - -#endif // _LIBCPP_EXPERIMENTAL_RATIO +#error " has been removed. Use instead." diff --git a/include/experimental/system_error b/include/experimental/system_error index 2ec238544..7937357fa 100644 --- a/include/experimental/system_error +++ b/include/experimental/system_error @@ -8,56 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR -#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR - -/** - experimental/system_error synopsis - -// C++1y - -#include - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - - // See C++14 19.5, System error support - template constexpr bool is_error_code_enum_v - = is_error_code_enum::value; - template constexpr bool is_error_condition_enum_v - = is_error_condition_enum::value; - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -*/ - -#include - -#if _LIBCPP_STD_VER > 11 - -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES - -template _LIBCPP_CONSTEXPR bool is_error_code_enum_v - = is_error_code_enum<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_error_condition_enum_v - = is_error_condition_enum<_Tp>::value; - -#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_STD_VER > 11 */ - -#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */ +#error " has been removed. Use instead." diff --git a/include/experimental/tuple b/include/experimental/tuple index e00d2ec1a..1f37a6293 100644 --- a/include/experimental/tuple +++ b/include/experimental/tuple @@ -8,75 +8,4 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_TUPLE -#define _LIBCPP_EXPERIMENTAL_TUPLE - -/* - experimental/tuple synopsis - -// C++1y - -#include - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - - // See C++14 20.4.2.5, tuple helper classes - template constexpr size_t tuple_size_v - = tuple_size::value; - - // 3.2.2, Calling a function with a tuple of arguments - template - constexpr decltype(auto) apply(F&& f, Tuple&& t); - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -# include - -#if _LIBCPP_STD_VER > 11 - -# include -# include -# include <__functional_base> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -template -_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value; -#endif - -template -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR_AFTER_CXX11 -decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t, - integer_sequence) { - return _VSTD::__invoke_constexpr( - _VSTD::forward<_Fn>(__f), - _VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))... - ); -} - -template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -decltype(auto) apply(_Fn && __f, _Tuple && __t) { - return _VSTD_LFTS::__apply_tuple_impl( - _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t), - make_index_sequence::type>::value>() - ); -} - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_STD_VER > 11 */ - -#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */ +#error " has been removed. Use instead." diff --git a/include/experimental/type_traits b/include/experimental/type_traits index 3a7593620..afe491567 100644 --- a/include/experimental/type_traits +++ b/include/experimental/type_traits @@ -21,146 +21,6 @@ namespace std { namespace experimental { inline namespace fundamentals_v1 { - // See C++14 20.10.4.1, primary type categories - template constexpr bool is_void_v - = is_void::value; - template constexpr bool is_null_pointer_v - = is_null_pointer::value; - template constexpr bool is_integral_v - = is_integral::value; - template constexpr bool is_floating_point_v - = is_floating_point::value; - template constexpr bool is_array_v - = is_array::value; - template constexpr bool is_pointer_v - = is_pointer::value; - template constexpr bool is_lvalue_reference_v - = is_lvalue_reference::value; - template constexpr bool is_rvalue_reference_v - = is_rvalue_reference::value; - template constexpr bool is_member_object_pointer_v - = is_member_object_pointer::value; - template constexpr bool is_member_function_pointer_v - = is_member_function_pointer::value; - template constexpr bool is_enum_v - = is_enum::value; - template constexpr bool is_union_v - = is_union::value; - template constexpr bool is_class_v - = is_class::value; - template constexpr bool is_function_v - = is_function::value; - - // See C++14 20.10.4.2, composite type categories - template constexpr bool is_reference_v - = is_reference::value; - template constexpr bool is_arithmetic_v - = is_arithmetic::value; - template constexpr bool is_fundamental_v - = is_fundamental::value; - template constexpr bool is_object_v - = is_object::value; - template constexpr bool is_scalar_v - = is_scalar::value; - template constexpr bool is_compound_v - = is_compound::value; - template constexpr bool is_member_pointer_v - = is_member_pointer::value; - - // See C++14 20.10.4.3, type properties - template constexpr bool is_const_v - = is_const::value; - template constexpr bool is_volatile_v - = is_volatile::value; - template constexpr bool is_trivial_v - = is_trivial::value; - template constexpr bool is_trivially_copyable_v - = is_trivially_copyable::value; - template constexpr bool is_standard_layout_v - = is_standard_layout::value; - template constexpr bool is_pod_v - = is_pod::value; - template constexpr bool is_literal_type_v - = is_literal_type::value; - template constexpr bool is_empty_v - = is_empty::value; - template constexpr bool is_polymorphic_v - = is_polymorphic::value; - template constexpr bool is_abstract_v - = is_abstract::value; - template constexpr bool is_final_v - = is_final::value; - template constexpr bool is_signed_v - = is_signed::value; - template constexpr bool is_unsigned_v - = is_unsigned::value; - template constexpr bool is_constructible_v - = is_constructible::value; - template constexpr bool is_default_constructible_v - = is_default_constructible::value; - template constexpr bool is_copy_constructible_v - = is_copy_constructible::value; - template constexpr bool is_move_constructible_v - = is_move_constructible::value; - template constexpr bool is_assignable_v - = is_assignable::value; - template constexpr bool is_copy_assignable_v - = is_copy_assignable::value; - template constexpr bool is_move_assignable_v - = is_move_assignable::value; - template constexpr bool is_destructible_v - = is_destructible::value; - template constexpr bool is_trivially_constructible_v - = is_trivially_constructible::value; - template constexpr bool is_trivially_default_constructible_v - = is_trivially_default_constructible::value; - template constexpr bool is_trivially_copy_constructible_v - = is_trivially_copy_constructible::value; - template constexpr bool is_trivially_move_constructible_v - = is_trivially_move_constructible::value; - template constexpr bool is_trivially_assignable_v - = is_trivially_assignable::value; - template constexpr bool is_trivially_copy_assignable_v - = is_trivially_copy_assignable::value; - template constexpr bool is_trivially_move_assignable_v - = is_trivially_move_assignable::value; - template constexpr bool is_trivially_destructible_v - = is_trivially_destructible::value; - template constexpr bool is_nothrow_constructible_v - = is_nothrow_constructible::value; - template constexpr bool is_nothrow_default_constructible_v - = is_nothrow_default_constructible::value; - template constexpr bool is_nothrow_copy_constructible_v - = is_nothrow_copy_constructible::value; - template constexpr bool is_nothrow_move_constructible_v - = is_nothrow_move_constructible::value; - template constexpr bool is_nothrow_assignable_v - = is_nothrow_assignable::value; - template constexpr bool is_nothrow_copy_assignable_v - = is_nothrow_copy_assignable::value; - template constexpr bool is_nothrow_move_assignable_v - = is_nothrow_move_assignable::value; - template constexpr bool is_nothrow_destructible_v - = is_nothrow_destructible::value; - template constexpr bool has_virtual_destructor_v - = has_virtual_destructor::value; - - // See C++14 20.10.5, type property queries - template constexpr size_t alignment_of_v - = alignment_of::value; - template constexpr size_t rank_v - = rank::value; - template constexpr size_t extent_v - = extent::value; - - // See C++14 20.10.6, type relations - template constexpr bool is_same_v - = is_same::value; - template constexpr bool is_base_of_v - = is_base_of::value; - template constexpr bool is_convertible_v - = is_convertible::value; - // 3.3.2, Other type transformations template class invocation_type; // not defined template class invocation_type; @@ -172,14 +32,6 @@ inline namespace fundamentals_v1 { template using raw_invocation_type_t = typename raw_invocation_type::type; - // 3.3.3, Logical operator traits - template struct conjunction; - template constexpr bool conjunction_v = conjunction::value; - template struct disjunction; - template constexpr bool disjunction_v = disjunction::value; - template struct negation; - template constexpr bool negation_v = negation::value; - // 3.3.4, Detection idiom template using void_t = void; @@ -229,215 +81,6 @@ inline namespace fundamentals_v1 { _LIBCPP_BEGIN_NAMESPACE_LFTS -#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES - -// C++14 20.10.4.1, primary type categories - -template _LIBCPP_CONSTEXPR bool is_void_v - = is_void<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_null_pointer_v - = is_null_pointer<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_integral_v - = is_integral<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_floating_point_v - = is_floating_point<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_array_v - = is_array<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_pointer_v - = is_pointer<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_lvalue_reference_v - = is_lvalue_reference<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_rvalue_reference_v - = is_rvalue_reference<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_member_object_pointer_v - = is_member_object_pointer<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_member_function_pointer_v - = is_member_function_pointer<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_enum_v - = is_enum<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_union_v - = is_union<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_class_v - = is_class<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_function_v - = is_function<_Tp>::value; - -// C++14 20.10.4.2, composite type categories - -template _LIBCPP_CONSTEXPR bool is_reference_v - = is_reference<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_arithmetic_v - = is_arithmetic<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_fundamental_v - = is_fundamental<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_object_v - = is_object<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_scalar_v - = is_scalar<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_compound_v - = is_compound<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_member_pointer_v - = is_member_pointer<_Tp>::value; - -// C++14 20.10.4.3, type properties - -template _LIBCPP_CONSTEXPR bool is_const_v - = is_const<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_volatile_v - = is_volatile<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivial_v - = is_trivial<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_copyable_v - = is_trivially_copyable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_standard_layout_v - = is_standard_layout<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_pod_v - = is_pod<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_literal_type_v - = is_literal_type<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_empty_v - = is_empty<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_polymorphic_v - = is_polymorphic<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_abstract_v - = is_abstract<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_final_v - = is_final<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_signed_v - = is_signed<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_unsigned_v - = is_unsigned<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_constructible_v - = is_constructible<_Tp, _Ts...>::value; - -template _LIBCPP_CONSTEXPR bool is_default_constructible_v - = is_default_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_copy_constructible_v - = is_copy_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_move_constructible_v - = is_move_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_assignable_v - = is_assignable<_Tp, _Up>::value; - -template _LIBCPP_CONSTEXPR bool is_copy_assignable_v - = is_copy_assignable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_move_assignable_v - = is_move_assignable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_destructible_v - = is_destructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_constructible_v - = is_trivially_constructible<_Tp, _Ts...>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v - = is_trivially_default_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v - = is_trivially_copy_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v - = is_trivially_move_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_assignable_v - = is_trivially_assignable<_Tp, _Up>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v - = is_trivially_copy_assignable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v - = is_trivially_move_assignable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_trivially_destructible_v - = is_trivially_destructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v - = is_nothrow_constructible<_Tp, _Ts...>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v - = is_nothrow_default_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v - = is_nothrow_copy_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v - = is_nothrow_move_constructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v - = is_nothrow_assignable<_Tp, _Up>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v - = is_nothrow_copy_assignable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v - = is_nothrow_move_assignable<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v - = is_nothrow_destructible<_Tp>::value; - -template _LIBCPP_CONSTEXPR bool has_virtual_destructor_v - = has_virtual_destructor<_Tp>::value; - -// C++14 20.10.5, type properties queries - -template _LIBCPP_CONSTEXPR size_t alignment_of_v - = alignment_of<_Tp>::value; - -template _LIBCPP_CONSTEXPR size_t rank_v - = rank<_Tp>::value; - -template _LIBCPP_CONSTEXPR size_t extent_v - = extent<_Tp, _Id>::value; - -// C++14 20.10.6, type relations - -template _LIBCPP_CONSTEXPR bool is_same_v - = is_same<_Tp, _Up>::value; - -template _LIBCPP_CONSTEXPR bool is_base_of_v - = is_base_of<_Tp, _Up>::value; - -template _LIBCPP_CONSTEXPR bool is_convertible_v - = is_convertible<_Tp, _Up>::value; - -#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ - // 3.3.2, Other type transformations /* template @@ -459,24 +102,6 @@ template using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type; */ -// 3.3.3, Logical operator traits -template using void_t = void; - -template -struct conjunction : _VSTD::__and_<_Args...> {}; -template -_LIBCPP_CONSTEXPR bool conjunction_v = conjunction<_Args...>::value; - -template -struct disjunction : _VSTD::__or_<_Args...> {}; -template -_LIBCPP_CONSTEXPR bool disjunction_v = disjunction<_Args...>::value; - -template -struct negation : _VSTD::__not_<_Tp> {}; -template -_LIBCPP_CONSTEXPR bool negation_v = negation<_Tp>::value; - // 3.3.4, Detection idiom template using void_t = void; diff --git a/include/module.modulemap b/include/module.modulemap index 9775447ec..076ef2334 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -492,10 +492,6 @@ module std [system] { module algorithm { header "experimental/algorithm" export * - } - module chrono { - header "experimental/chrono" - export * } module coroutine { requires coroutines @@ -542,10 +538,6 @@ module std [system] { header "experimental/propagate_const" export * } - module ratio { - header "experimental/ratio" - export * - } module regex { header "experimental/regex" export * @@ -558,14 +550,6 @@ module std [system] { header "experimental/string" export * } - module system_error { - header "experimental/system_error" - export * - } - module tuple { - header "experimental/tuple" - export * - } module type_traits { header "experimental/type_traits" export * diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index d10849eb4..462c685e5 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -135,7 +135,6 @@ // experimental headers #if __cplusplus >= 201103L #include -#include #if defined(__cpp_coroutines) #include #endif @@ -149,12 +148,9 @@ #include #include #include -#include #include #include #include -#include -#include #include #include #include diff --git a/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp deleted file mode 100644 index ea7ef6cbc..000000000 --- a/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// Test that is included. - -#include - -#ifndef _LIBCPP_RATIO -# error " must include " -#endif - -int main() -{ -} diff --git a/test/libcxx/experimental/utilities/ratio/version.pass.cpp b/test/libcxx/experimental/utilities/ratio/version.pass.cpp deleted file mode 100644 index 8bc583fb6..000000000 --- a/test/libcxx/experimental/utilities/ratio/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp deleted file mode 100644 index be3aacdc3..000000000 --- a/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -#ifndef _LIBCPP_SYSTEM_ERROR -# error " must include " -#endif - -int main() -{ -} diff --git a/test/libcxx/experimental/utilities/syserror/version.pass.cpp b/test/libcxx/experimental/utilities/syserror/version.pass.cpp deleted file mode 100644 index 35f6a59c3..000000000 --- a/test/libcxx/experimental/utilities/syserror/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp deleted file mode 100644 index e91068c74..000000000 --- a/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -#ifndef _LIBCPP_CHRONO -# error " must include " -#endif - -int main() -{ -} diff --git a/test/libcxx/experimental/utilities/time/version.pass.cpp b/test/libcxx/experimental/utilities/time/version.pass.cpp deleted file mode 100644 index be97466f3..000000000 --- a/test/libcxx/experimental/utilities/time/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp deleted file mode 100644 index defa454d6..000000000 --- a/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -int main() -{ -#ifndef _LIBCPP_TUPLE -# error " must include " -#endif -} diff --git a/test/libcxx/experimental/utilities/tuple/version.pass.cpp b/test/libcxx/experimental/utilities/tuple/version.pass.cpp deleted file mode 100644 index 5a3fd2e39..000000000 --- a/test/libcxx/experimental/utilities/tuple/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp index f245d35c4..087aa3645 100644 --- a/test/libcxx/min_max_macros.sh.cpp +++ b/test/libcxx/min_max_macros.sh.cpp @@ -237,8 +237,6 @@ TEST_MACROS(); #if __cplusplus >= 201103L #include TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include @@ -259,18 +257,12 @@ TEST_MACROS(); TEST_MACROS(); #include TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include TEST_MACROS(); #include TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); #include TEST_MACROS(); #include diff --git a/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp deleted file mode 100644 index cb8db1feb..000000000 --- a/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template struct conjunction; // C++17 -// template -// constexpr bool conjunction_v = conjunction::value; // C++17 - -#include -#include - -namespace ex = std::experimental; - -struct True { static constexpr bool value = true; }; -struct False { static constexpr bool value = false; }; - -int main() -{ - static_assert ( ex::conjunction<>::value, "" ); - static_assert ( ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - - static_assert ( ex::conjunction_v<>, "" ); - static_assert ( ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - - static_assert ( ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - - static_assert ( ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - - static_assert ( ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - - static_assert ( ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); - - static_assert ( ex::conjunction::value, "" ); - static_assert (!ex::conjunction::value, "" ); - - static_assert ( ex::conjunction_v, "" ); - static_assert (!ex::conjunction_v, "" ); -} diff --git a/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp deleted file mode 100644 index dcdbf09fb..000000000 --- a/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template struct disjunction; -// template -// constexpr bool disjunction_v = disjunction::value; - -#include -#include - -namespace ex = std::experimental; - -struct True { static constexpr bool value = true; }; -struct False { static constexpr bool value = false; }; - -int main() -{ - static_assert (!ex::disjunction<>::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert (!ex::disjunction::value, "" ); - - static_assert (!ex::disjunction_v<>, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert (!ex::disjunction_v, "" ); - - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert (!ex::disjunction::value, "" ); - - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert (!ex::disjunction_v, "" ); - - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert ( ex::disjunction::value, "" ); - static_assert (!ex::disjunction::value, "" ); - - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert ( ex::disjunction_v, "" ); - static_assert (!ex::disjunction_v, "" ); - - static_assert ( ex::disjunction::value, "" ); - static_assert (!ex::disjunction::value, "" ); - - static_assert ( ex::disjunction_v, "" ); - static_assert (!ex::disjunction_v, "" ); -} diff --git a/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp deleted file mode 100644 index b0d43d7e5..000000000 --- a/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template struct negation; -// template -// constexpr bool negation_v = negation::value; - -#include -#include - -namespace ex = std::experimental; - -struct True { static constexpr bool value = true; }; -struct False { static constexpr bool value = false; }; - -int main() -{ - static_assert (!ex::negation::value, "" ); - static_assert ( ex::negation::value, "" ); - - static_assert (!ex::negation_v, "" ); - static_assert ( ex::negation_v, "" ); - - static_assert (!ex::negation::value, "" ); - static_assert ( ex::negation::value, "" ); - - static_assert (!ex::negation_v, "" ); - static_assert ( ex::negation_v, "" ); - - static_assert ( ex::negation>::value, "" ); - static_assert (!ex::negation>::value, "" ); -} diff --git a/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp deleted file mode 100644 index ddc82cb54..000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -#ifndef _LIBCPP_TYPE_TRAITS -# error " must include " -#endif - -int main() -{ -} diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp deleted file mode 100644 index 8edc91730..000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -namespace ex = std::experimental; - -struct base_type {}; -struct derived_type : base_type {}; - -int main() -{ - { - typedef int T; - typedef int U; - static_assert(ex::is_same_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_same_v == std::is_same::value, ""); - } - { - typedef int T; - typedef long U; - static_assert(!ex::is_same_v, ""); - static_assert(ex::is_same_v == std::is_same::value, ""); - } - { - typedef base_type T; - typedef derived_type U; - static_assert(ex::is_base_of_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_base_of_v == std::is_base_of::value, ""); - } - { - typedef int T; - typedef int U; - static_assert(!ex::is_base_of_v, ""); - static_assert(ex::is_base_of_v == std::is_base_of::value, ""); - } - { - typedef int T; - typedef long U; - static_assert(ex::is_convertible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_convertible_v == std::is_convertible::value, ""); - } - { - typedef void T; - typedef int U; - static_assert(!ex::is_convertible_v, ""); - static_assert(ex::is_convertible_v == std::is_convertible::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp deleted file mode 100644 index a4a91c136..000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp +++ /dev/null @@ -1,178 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -namespace ex = std::experimental; - -struct class_type {}; -enum enum_type {}; -union union_type {}; - -int main() -{ - { - typedef void T; - static_assert(ex::is_void_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_void_v == std::is_void::value, ""); - } - { - typedef int T; - static_assert(!ex::is_void_v, ""); - static_assert(ex::is_void_v == std::is_void::value, ""); - } - { - typedef decltype(nullptr) T; - static_assert(ex::is_null_pointer_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_null_pointer_v == std::is_null_pointer::value, ""); - } - { - typedef int T; - static_assert(!ex::is_null_pointer_v, ""); - static_assert(ex::is_null_pointer_v == std::is_null_pointer::value, ""); - } - { - typedef int T; - static_assert(ex::is_integral_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_integral_v == std::is_integral::value, ""); - } - { - typedef void T; - static_assert(!ex::is_integral_v, ""); - static_assert(ex::is_integral_v == std::is_integral::value, ""); - } - { - typedef float T; - static_assert(ex::is_floating_point_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_floating_point_v == std::is_floating_point::value, ""); - } - { - typedef int T; - static_assert(!ex::is_floating_point_v, ""); - static_assert(ex::is_floating_point_v == std::is_floating_point::value, ""); - } - { - typedef int(T)[42]; - static_assert(ex::is_array_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_array_v == std::is_array::value, ""); - } - { - typedef int T; - static_assert(!ex::is_array_v, ""); - static_assert(ex::is_array_v == std::is_array::value, ""); - } - { - typedef void* T; - static_assert(ex::is_pointer_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_pointer_v == std::is_pointer::value, ""); - } - { - typedef int T; - static_assert(!ex::is_pointer_v, ""); - static_assert(ex::is_pointer_v == std::is_pointer::value, ""); - } - { - typedef int & T; - static_assert(ex::is_lvalue_reference_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_lvalue_reference_v == std::is_lvalue_reference::value, ""); - } - { - typedef int T; - static_assert(!ex::is_lvalue_reference_v, ""); - static_assert(ex::is_lvalue_reference_v == std::is_lvalue_reference::value, ""); - } - { - typedef int && T; - static_assert(ex::is_rvalue_reference_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_rvalue_reference_v == std::is_rvalue_reference::value, ""); - } - { - typedef int T; - static_assert(!ex::is_rvalue_reference_v, ""); - static_assert(ex::is_rvalue_reference_v == std::is_rvalue_reference::value, ""); - } - { - typedef int class_type::*T; - static_assert(ex::is_member_object_pointer_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_member_object_pointer_v == std::is_member_object_pointer::value, ""); - } - { - typedef int T; - static_assert(!ex::is_member_object_pointer_v, ""); - static_assert(ex::is_member_object_pointer_v == std::is_member_object_pointer::value, ""); - } - { - typedef void(class_type::*T)(); - static_assert(ex::is_member_function_pointer_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_member_function_pointer_v == std::is_member_function_pointer::value, ""); - } - { - typedef int T; - static_assert(!ex::is_member_function_pointer_v, ""); - static_assert(ex::is_member_function_pointer_v == std::is_member_function_pointer::value, ""); - } - { - typedef enum_type T; - static_assert(ex::is_enum_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_enum_v == std::is_enum::value, ""); - } - { - typedef int T; - static_assert(!ex::is_enum_v, ""); - static_assert(ex::is_enum_v == std::is_enum::value, ""); - } - { - typedef union_type T; - static_assert(ex::is_union_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_union_v == std::is_union::value, ""); - } - { - typedef int T; - static_assert(!ex::is_union_v, ""); - static_assert(ex::is_union_v == std::is_union::value, ""); - } - { - typedef class_type T; - static_assert(ex::is_class_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_class_v == std::is_class::value, ""); - } - { - typedef int T; - static_assert(!ex::is_class_v, ""); - static_assert(ex::is_class_v == std::is_class::value, ""); - } - { - typedef void(T)(); - static_assert(ex::is_function_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_function_v == std::is_function::value, ""); - } - { - typedef int T; - static_assert(!ex::is_function_v, ""); - static_assert(ex::is_function_v == std::is_function::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp deleted file mode 100644 index b3927b120..000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -namespace ex = std::experimental; - -struct class_type {}; - -int main() -{ - { - typedef int & T; - static_assert(ex::is_reference_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_reference_v == std::is_reference::value, ""); - } - { - typedef int T; - static_assert(!ex::is_reference_v, ""); - static_assert(ex::is_reference_v == std::is_reference::value, ""); - } - { - typedef int T; - static_assert(ex::is_arithmetic_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_arithmetic_v == std::is_arithmetic::value, ""); - } - { - typedef void* T; - static_assert(!ex::is_arithmetic_v, ""); - static_assert(ex::is_arithmetic_v == std::is_arithmetic::value, ""); - } - { - typedef int T; - static_assert(ex::is_fundamental_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_fundamental_v == std::is_fundamental::value, ""); - } - { - typedef class_type T; - static_assert(!ex::is_fundamental_v, ""); - static_assert(ex::is_fundamental_v == std::is_fundamental::value, ""); - } - { - typedef class_type T; - static_assert(ex::is_object_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_object_v == std::is_object::value, ""); - } - { - typedef void T; - static_assert(!ex::is_object_v, ""); - static_assert(ex::is_object_v == std::is_object::value, ""); - } - { - typedef int T; - static_assert(ex::is_scalar_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_scalar_v == std::is_scalar::value, ""); - } - { - typedef void T; - static_assert(!ex::is_scalar_v, ""); - static_assert(ex::is_scalar_v == std::is_scalar::value, ""); - } - { - typedef void* T; - static_assert(ex::is_compound_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_compound_v == std::is_compound::value, ""); - } - { - typedef void T; - static_assert(!ex::is_compound_v, ""); - static_assert(ex::is_compound_v == std::is_compound::value, ""); - } - { - typedef int class_type::*T; - static_assert(ex::is_member_pointer_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_member_pointer_v == std::is_member_pointer::value, ""); - } - { - typedef int T; - static_assert(!ex::is_member_pointer_v, ""); - static_assert(ex::is_member_pointer_v == std::is_member_pointer::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp deleted file mode 100644 index bfd385a1b..000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp +++ /dev/null @@ -1,492 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// GCC returns true for __is_trivially_constructible(void, int) -// See gcc.gnu.org/PR80682 -// NOTE: This has been fixed in trunk and will be backported soon. -// XFAIL: gcc-7, gcc-6, gcc-5, gcc-4 - -// - -#include - -namespace ex = std::experimental; - -struct non_literal_type { non_literal_type() {} }; -struct empty_type {}; - -struct polymorphic_type -{ - virtual void foo() {} -}; - -struct abstract_type -{ - virtual void foo() = 0; -}; - -struct final_type final {}; - -struct virtual_dtor_type -{ - virtual ~virtual_dtor_type() {} -}; - -void type_properties_test() -{ - { - typedef const int T; - static_assert(ex::is_const_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_const_v == std::is_const::value, ""); - } - { - typedef int T; - static_assert(!ex::is_const_v, ""); - static_assert(ex::is_const_v == std::is_const::value, ""); - } - { - typedef volatile int T; - static_assert(ex::is_volatile_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_volatile_v == std::is_volatile::value, ""); - } - { - typedef int T; - static_assert(!ex::is_volatile_v, ""); - static_assert(ex::is_volatile_v == std::is_volatile::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivial_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivial_v == std::is_trivial::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_trivial_v, ""); - static_assert(ex::is_trivial_v == std::is_trivial::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_copyable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_copyable_v == std::is_trivially_copyable::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_trivially_copyable_v, ""); - static_assert(ex::is_trivially_copyable_v == std::is_trivially_copyable::value, ""); - } - { - typedef int T; - static_assert(ex::is_standard_layout_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_standard_layout_v == std::is_standard_layout::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_standard_layout_v, ""); - static_assert(ex::is_standard_layout_v == std::is_standard_layout::value, ""); - } - { - typedef int T; - static_assert(ex::is_pod_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_pod_v == std::is_pod::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_pod_v, ""); - static_assert(ex::is_pod_v == std::is_pod::value, ""); - } - { - typedef int T; - static_assert(ex::is_literal_type_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_literal_type_v == std::is_literal_type::value, ""); - } - { - typedef non_literal_type T; - static_assert(!ex::is_literal_type_v, ""); - static_assert(ex::is_literal_type_v == std::is_literal_type::value, ""); - } - { - typedef empty_type T; - static_assert(ex::is_empty_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_empty_v == std::is_empty::value, ""); - } - { - typedef int T; - static_assert(!ex::is_empty_v, ""); - static_assert(ex::is_empty_v == std::is_empty::value, ""); - } - { - typedef polymorphic_type T; - static_assert(ex::is_polymorphic_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_polymorphic_v == std::is_polymorphic::value, ""); - } - { - typedef int T; - static_assert(!ex::is_polymorphic_v, ""); - static_assert(ex::is_polymorphic_v == std::is_polymorphic::value, ""); - } - { - typedef abstract_type T; - static_assert(ex::is_abstract_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_abstract_v == std::is_abstract::value, ""); - } - { - typedef int T; - static_assert(!ex::is_abstract_v, ""); - static_assert(ex::is_abstract_v == std::is_abstract::value, ""); - } - { - typedef final_type T; - static_assert(ex::is_final_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_final_v == std::is_final::value, ""); - } - { - typedef int T; - static_assert(!ex::is_final_v, ""); - static_assert(ex::is_final_v == std::is_final::value, ""); - } - { - typedef int T; - static_assert(ex::is_signed_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_signed_v == std::is_signed::value, ""); - } - { - typedef unsigned T; - static_assert(!ex::is_signed_v, ""); - static_assert(ex::is_signed_v == std::is_signed::value, ""); - } - { - typedef unsigned T; - static_assert(ex::is_unsigned_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_unsigned_v == std::is_unsigned::value, ""); - } - { - typedef int T; - static_assert(!ex::is_unsigned_v, ""); - static_assert(ex::is_unsigned_v == std::is_unsigned::value, ""); - } -} - -void is_constructible_and_assignable_test() -{ - { - typedef int T; - static_assert(ex::is_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_constructible_v == std::is_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_constructible_v, ""); - static_assert(ex::is_constructible_v == std::is_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_default_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_default_constructible_v == std::is_default_constructible::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_default_constructible_v, ""); - static_assert(ex::is_default_constructible_v == std::is_default_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_copy_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_copy_constructible_v == std::is_copy_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_copy_constructible_v, ""); - static_assert(ex::is_copy_constructible_v == std::is_copy_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_move_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_move_constructible_v == std::is_move_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_move_constructible_v, ""); - static_assert(ex::is_move_constructible_v == std::is_move_constructible::value, ""); - } - { - typedef int & T; - typedef int U; - static_assert(ex::is_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_assignable_v == std::is_assignable::value, ""); - } - { - typedef int & T; - typedef void U; - static_assert(!ex::is_assignable_v, ""); - static_assert(ex::is_assignable_v == std::is_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_copy_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_copy_assignable_v == std::is_copy_assignable::value, ""); - } - { - typedef void T; - static_assert(!ex::is_copy_assignable_v, ""); - static_assert(ex::is_copy_assignable_v == std::is_copy_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_move_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_move_assignable_v == std::is_move_assignable::value, ""); - } - { - typedef void T; - static_assert(!ex::is_move_assignable_v, ""); - static_assert(ex::is_move_assignable_v == std::is_move_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_destructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_destructible_v == std::is_destructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_destructible_v, ""); - static_assert(ex::is_destructible_v == std::is_destructible::value, ""); - } -} - -void is_trivially_constructible_and_assignable_test() -{ - { - typedef int T; - static_assert(ex::is_trivially_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_constructible_v == std::is_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_constructible_v, ""); - static_assert(ex::is_trivially_constructible_v == std::is_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_default_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_default_constructible_v == std::is_default_constructible::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_trivially_default_constructible_v, ""); - static_assert(ex::is_trivially_default_constructible_v == std::is_default_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_copy_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_copy_constructible_v == std::is_copy_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_copy_constructible_v, ""); - static_assert(ex::is_trivially_copy_constructible_v == std::is_copy_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_move_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_move_constructible_v == std::is_move_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_move_constructible_v, ""); - static_assert(ex::is_trivially_move_constructible_v == std::is_move_constructible::value, ""); - } - { - typedef int & T; - typedef int U; - static_assert(ex::is_trivially_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_assignable_v == std::is_assignable::value, ""); - } - { - typedef int & T; - typedef void U; - static_assert(!ex::is_trivially_assignable_v, ""); - static_assert(ex::is_trivially_assignable_v == std::is_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_copy_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_copy_assignable_v == std::is_copy_assignable::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_copy_assignable_v, ""); - static_assert(ex::is_trivially_copy_assignable_v == std::is_copy_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_move_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_move_assignable_v == std::is_move_assignable::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_move_assignable_v, ""); - static_assert(ex::is_trivially_move_assignable_v == std::is_move_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_trivially_destructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_trivially_destructible_v == std::is_destructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_trivially_destructible_v, ""); - static_assert(ex::is_trivially_destructible_v == std::is_destructible::value, ""); - } -} - - - -void is_nothrow_constructible_and_assignable_test() -{ - { - typedef int T; - static_assert(ex::is_nothrow_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_constructible_v == std::is_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_constructible_v, ""); - static_assert(ex::is_nothrow_constructible_v == std::is_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_default_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_default_constructible_v == std::is_default_constructible::value, ""); - } - { - typedef int & T; - static_assert(!ex::is_nothrow_default_constructible_v, ""); - static_assert(ex::is_nothrow_default_constructible_v == std::is_default_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_copy_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_copy_constructible_v == std::is_copy_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_copy_constructible_v, ""); - static_assert(ex::is_nothrow_copy_constructible_v == std::is_copy_constructible::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_move_constructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_move_constructible_v == std::is_move_constructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_move_constructible_v, ""); - static_assert(ex::is_nothrow_move_constructible_v == std::is_move_constructible::value, ""); - } - { - typedef int & T; - typedef int U; - static_assert(ex::is_nothrow_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_assignable_v == std::is_assignable::value, ""); - } - { - typedef int & T; - typedef void U; - static_assert(!ex::is_nothrow_assignable_v, ""); - static_assert(ex::is_nothrow_assignable_v == std::is_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_copy_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_copy_assignable_v == std::is_copy_assignable::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_copy_assignable_v, ""); - static_assert(ex::is_nothrow_copy_assignable_v == std::is_copy_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_move_assignable_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_move_assignable_v == std::is_move_assignable::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_move_assignable_v, ""); - static_assert(ex::is_nothrow_move_assignable_v == std::is_move_assignable::value, ""); - } - { - typedef int T; - static_assert(ex::is_nothrow_destructible_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::is_nothrow_destructible_v == std::is_destructible::value, ""); - } - { - typedef void T; - static_assert(!ex::is_nothrow_destructible_v, ""); - static_assert(ex::is_nothrow_destructible_v == std::is_destructible::value, ""); - } -} - -int main() -{ - type_properties_test(); - is_constructible_and_assignable_test(); - is_trivially_constructible_and_assignable_test(); - is_nothrow_constructible_and_assignable_test(); - { - typedef virtual_dtor_type T; - static_assert(ex::has_virtual_destructor_v, ""); - static_assert(std::is_same), const bool>::value, ""); - static_assert(ex::has_virtual_destructor_v == std::has_virtual_destructor::value, ""); - } - { - typedef int T; - static_assert(!ex::has_virtual_destructor_v, ""); - static_assert(ex::has_virtual_destructor_v == std::has_virtual_destructor::value, ""); - } -} - diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp deleted file mode 100644 index f91667da5..000000000 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef char T; - static_assert(ex::alignment_of_v == 1, ""); - static_assert(std::is_same), const std::size_t>::value, ""); - static_assert(ex::alignment_of_v == std::alignment_of::value, ""); - } - { - typedef char(T)[1][1][1]; - static_assert(ex::rank_v == 3, ""); - static_assert(std::is_same), const std::size_t>::value, ""); - static_assert(ex::rank_v == std::rank::value, ""); - } - { - typedef void T; - static_assert(ex::rank_v == 0, ""); - static_assert(ex::rank_v == std::rank::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v == 2, ""); - static_assert(std::is_same), const std::size_t>::value, ""); - static_assert(ex::extent_v == std::extent::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v == 2, ""); - static_assert(ex::extent_v == std::extent::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v == 3, ""); - static_assert(ex::extent_v == std::extent::value, ""); - } - { - typedef char(T)[2][3][4]; - static_assert(ex::extent_v == 0, ""); - static_assert(ex::extent_v == std::extent::value, ""); - } - { - typedef void T; - static_assert(ex::extent_v == 0, ""); - static_assert(ex::extent_v == std::extent::value, ""); - } -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp deleted file mode 100644 index 485da33cd..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// Test that is included. - -#include - -int main() -{ - std::ratio<100> x; - ((void)x); -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp deleted file mode 100644 index 641e6ae22..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool ratio_equal_v; - -#include -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_equal_v, "" - ); - static_assert( - ex::ratio_equal_v == std::ratio_equal::value, "" - ); - static_assert( - std::is_same), const bool>::value - , "" - ); - } - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, -1> R2; - static_assert( - !ex::ratio_equal_v, "" - ); - static_assert( - ex::ratio_equal_v == std::ratio_equal::value, "" - ); - } -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp deleted file mode 100644 index 3896d0ac6..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool ratio_greater_equal_v; - -#include -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef std::ratio<1, 2> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_greater_equal_v, "" - ); - static_assert( - ex::ratio_greater_equal_v - == std::ratio_greater_equal::value, "" - ); - static_assert( - std::is_same< - decltype(ex::ratio_greater_equal_v), const bool>::value - , "" - ); - } - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_greater_equal_v, "" - ); - static_assert( - ex::ratio_greater_equal_v - == std::ratio_greater_equal::value, "" - ); - } - { - typedef std::ratio<2, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_greater_equal_v, "" - ); - static_assert( - ex::ratio_greater_equal_v - == std::ratio_greater_equal::value, "" - ); - } -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp deleted file mode 100644 index bdc54515f..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool ratio_greater_v; - -#include -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef std::ratio<1, 2> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_greater_v, "" - ); - static_assert( - ex::ratio_greater_v == std::ratio_greater::value, "" - ); - static_assert( - std::is_same), const bool>::value - , "" - ); - } - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_greater_v, "" - ); - static_assert( - ex::ratio_greater_v == std::ratio_greater::value, "" - ); - } - { - typedef std::ratio<2, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_greater_v, "" - ); - static_assert( - ex::ratio_greater_v == std::ratio_greater::value, "" - ); - } -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp deleted file mode 100644 index 50f213b01..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool ratio_less_equal_v; - -#include -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef std::ratio<1, 2> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_less_equal_v, "" - ); - static_assert( - ex::ratio_less_equal_v == std::ratio_less_equal::value, "" - ); - static_assert( - std::is_same), const bool>::value - , "" - ); - } - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_less_equal_v, "" - ); - static_assert( - ex::ratio_less_equal_v == std::ratio_less_equal::value, "" - ); - } - { - typedef std::ratio<2, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_less_equal_v, "" - ); - static_assert( - ex::ratio_less_equal_v == std::ratio_less_equal::value, "" - ); - } -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp deleted file mode 100644 index 7a6d7738b..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool ratio_less_v; - -#include -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef std::ratio<1, 2> R1; - typedef std::ratio<1, 1> R2; - static_assert( - ex::ratio_less_v, "" - ); - static_assert( - ex::ratio_less_v == std::ratio_less::value, "" - ); - static_assert( - std::is_same), const bool>::value - , "" - ); - } - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_less_v, "" - ); - static_assert( - ex::ratio_less_v == std::ratio_less::value, "" - ); - } - { - typedef std::ratio<2, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_less_v, "" - ); - static_assert( - ex::ratio_less_v == std::ratio_less::value, "" - ); - } -} diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp deleted file mode 100644 index b5296ff24..000000000 --- a/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool ratio_not_equal_v; - -#include -#include - -namespace ex = std::experimental; - -int main() -{ - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, -1> R2; - static_assert( - ex::ratio_not_equal_v, "" - ); - static_assert( - ex::ratio_not_equal_v == std::ratio_not_equal::value, "" - ); - static_assert( - std::is_same), const bool>::value - , "" - ); - } - { - typedef std::ratio<1, 1> R1; - typedef std::ratio<1, 1> R2; - static_assert( - !ex::ratio_not_equal_v, "" - ); - static_assert( - ex::ratio_not_equal_v == std::ratio_not_equal::value, "" - ); - } -} diff --git a/test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp b/test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp deleted file mode 100644 index 9a59227ab..000000000 --- a/test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp b/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp deleted file mode 100644 index de813925f..000000000 --- a/test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -#include - -int main() -{ - // Check that has been included - std::error_code ec; - ((void)ec); -} diff --git a/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp b/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp deleted file mode 100644 index f944123eb..000000000 --- a/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool is_error_code_enum_v; - -#include -#include /* for std::io_errc */ - -namespace ex = std::experimental; - -int main() { - { - static_assert(ex::is_error_code_enum_v, ""); - - static_assert(ex::is_error_code_enum_v == - std::is_error_code_enum ::value, ""); - - static_assert(std::is_same), - const bool>::value, ""); - } - { - static_assert(!ex::is_error_code_enum_v, ""); - - static_assert(ex::is_error_code_enum_v == - std::is_error_code_enum ::value, ""); - } -} diff --git a/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp b/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp deleted file mode 100644 index ee8dc57aa..000000000 --- a/test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool is_error_condition_enum_v; - -#include -#include -namespace ex = std::experimental; - -int main() { - { - static_assert(ex::is_error_condition_enum_v, ""); - - static_assert(ex::is_error_condition_enum_v == - std::is_error_condition_enum ::value, ""); - - static_assert( - std::is_same), - const bool>::value, - ""); - } - { - static_assert(!ex::is_error_condition_enum_v, ""); - - static_assert(ex::is_error_condition_enum_v == - std::is_error_condition_enum ::value, ""); - } -} diff --git a/test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp b/test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp deleted file mode 100644 index f6ad37f9e..000000000 --- a/test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -int main() -{ - // Check that has been included. - std::chrono::seconds s; - ((void)s); -} diff --git a/test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp b/test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp deleted file mode 100644 index 9ac9a2ed1..000000000 --- a/test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr bool treat_as_floating_point_v; - -#include -#include - -namespace ex = std::chrono::experimental; -namespace cr = std::chrono; - -template -void test() -{ - static_assert( - ex::treat_as_floating_point_v == Expect, "" - ); - static_assert( - ex::treat_as_floating_point_v == cr::treat_as_floating_point::value, "" - ); -} - -int main() -{ - { - static_assert( - std::is_same< - decltype(ex::treat_as_floating_point_v), const bool - >::value, "" - ); - } - test(); - test(); - test(); - test(); - test(); - test(); - test(); -} diff --git a/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp b/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp deleted file mode 100644 index 5cfb15e3d..000000000 --- a/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -#include - -int main() -{ - std::tuple x(1); - (void)x; -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp deleted file mode 100644 index cb44707fa..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp +++ /dev/null @@ -1,187 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Test with different ref/ptr/cv qualified argument types. - -#include -#include -#include -#include - -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - - -namespace ex = std::experimental; - -int call_with_value(int x, int y) { return (x + y); } -int call_with_ref(int & x, int & y) { return (x + y); } -int call_with_const_ref(int const & x, int const & y) { return (x + y); } -int call_with_rvalue_ref(int && x, int && y) { return (x + y); } -int call_with_pointer(int * x, int * y) { return (*x + *y); } -int call_with_const_pointer(int const* x, int const * y) { return (*x + *y); } - - -template -void test_values() -{ - { - Tuple t{1, 2}; - assert(3 == ex::apply(call_with_value, t)); - } - { - Tuple t{2, 2}; - assert(4 == ex::apply(call_with_ref, t)); - } - { - Tuple t{2, 3}; - assert(5 == ex::apply(call_with_const_ref, t)); - } - { - Tuple t{3, 3}; - assert(6 == ex::apply(call_with_rvalue_ref, static_cast(t))); - } - { - Tuple const t{4, 4}; - assert(8 == ex::apply(call_with_value, t)); - } - { - Tuple const t{4, 5}; - assert(9 == ex::apply(call_with_const_ref, t)); - } -} - -template -void test_refs() -{ - int x = 0; - int y = 0; - { - x = 1; y = 2; - Tuple t{x, y}; - assert(3 == ex::apply(call_with_value, t)); - } - { - x = 2; y = 2; - Tuple t{x, y}; - assert(4 == ex::apply(call_with_ref, t)); - } - { - x = 2; y = 3; - Tuple t{x, y}; - assert(5 == ex::apply(call_with_const_ref, t)); - } - { - x = 3; y = 3; - Tuple const t{x, y}; - assert(6 == ex::apply(call_with_value, t)); - } - { - x = 3; y = 4; - Tuple const t{x, y}; - assert(7 == ex::apply(call_with_const_ref, t)); - } -} - -template -void test_const_refs() -{ - int x = 0; - int y = 0; - { - x = 1; y = 2; - Tuple t{x, y}; - assert(3 == ex::apply(call_with_value, t)); - } - { - x = 2; y = 3; - Tuple t{x, y}; - assert(5 == ex::apply(call_with_const_ref, t)); - } - { - x = 3; y = 3; - Tuple const t{x, y}; - assert(6 == ex::apply(call_with_value, t)); - } - { - x = 3; y = 4; - Tuple const t{x, y}; - assert(7 == ex::apply(call_with_const_ref, t)); - } -} - - -template -void test_pointer() -{ - int x = 0; - int y = 0; - { - x = 2; y = 2; - Tuple t{&x, &y}; - assert(4 == ex::apply(call_with_pointer, t)); - } - { - x = 2; y = 3; - Tuple t{&x, &y}; - assert(5 == ex::apply(call_with_const_pointer, t)); - } - { - x = 3; y = 4; - Tuple const t{&x, &y}; - assert(7 == ex::apply(call_with_const_pointer, t)); - } -} - - -template -void test_const_pointer() -{ - int x = 0; - int y = 0; - { - x = 2; y = 3; - Tuple t{&x, &y}; - assert(5 == ex::apply(call_with_const_pointer, t)); - } - { - x = 3; y = 4; - Tuple const t{&x, &y}; - assert(7 == ex::apply(call_with_const_pointer, t)); - } -} - - -int main() -{ - test_values>(); - test_values>(); - test_values>(); - - test_refs>(); - test_refs>(); - - test_const_refs>(); - test_const_refs>(); - - test_pointer>(); - test_pointer>(); - test_pointer>(); - - test_const_pointer>(); - test_const_pointer>(); - test_const_pointer>(); -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp deleted file mode 100644 index 5b8a8f09d..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Testing constexpr evaluation - -#include -#include -#include - -constexpr int f_int_0() { return 1; } -constexpr int f_int_1(int x) { return x; } -constexpr int f_int_2(int x, int y) { return (x + y); } - -struct A_int_0 -{ - constexpr A_int_0() {} - constexpr int operator()() const { return 1; } -}; - -struct A_int_1 -{ - constexpr A_int_1() {} - constexpr int operator()(int x) const { return x; } -}; - -struct A_int_2 -{ - constexpr A_int_2() {} - constexpr int operator()(int x, int y) const { return (x + y); } -}; - -namespace ex = std::experimental; - -template -void test_0() -{ - // function - { - constexpr Tuple t{}; - static_assert(1 == ex::apply(f_int_0, t), ""); - } - // function pointer - { - constexpr Tuple t{}; - constexpr auto fp = &f_int_0; - static_assert(1 == ex::apply(fp, t), ""); - } - // functor - { - constexpr Tuple t{}; - constexpr A_int_0 a; - static_assert(1 == ex::apply(a, t), ""); - } -} - -template -void test_1() -{ - // function - { - constexpr Tuple t{1}; - static_assert(1 == ex::apply(f_int_1, t), ""); - } - // function pointer - { - constexpr Tuple t{2}; - constexpr int (*fp)(int) = f_int_1; - static_assert(2 == ex::apply(fp, t), ""); - } - // functor - { - constexpr Tuple t{3}; - constexpr A_int_1 fn; - static_assert(3 == ex::apply(fn, t), ""); - } -} - -template -void test_2() -{ - // function - { - constexpr Tuple t{1, 2}; - static_assert(3 == ex::apply(f_int_2, t), ""); - } - // function pointer - { - constexpr Tuple t{2, 3}; - constexpr auto fp = &f_int_2; - static_assert(5 == ex::apply(fp, t), ""); - } - // functor - { - constexpr Tuple t{3, 4}; - constexpr A_int_2 a; - static_assert(7 == ex::apply(a, t), ""); - } -} - -int main() -{ - test_0>(); - test_1>(); - test_2>(); - test_2>(); -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp deleted file mode 100644 index 57dff4497..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp +++ /dev/null @@ -1,427 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Testing extended function types. The extended function types are those -// named by INVOKE but that are not actual callable objects. These include -// bullets 1-4 of invoke. - -#include -#include -#include -#include - -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - -int count = 0; - -struct A_int_0 -{ - A_int_0() : obj1(0){} - A_int_0(int x) : obj1(x) {} - int mem1() { return ++count; } - int mem2() const { return ++count; } - int const obj1; -}; - -struct A_int_1 -{ - A_int_1() {} - A_int_1(int) {} - int mem1(int x) { return count += x; } - int mem2(int x) const { return count += x; } -}; - -struct A_int_2 -{ - A_int_2() {} - A_int_2(int) {} - int mem1(int x, int y) { return count += (x + y); } - int mem2(int x, int y) const { return count += (x + y); } -}; - -template -struct A_wrap -{ - A_wrap() {} - A_wrap(int x) : m_a(x) {} - A & operator*() { return m_a; } - A const & operator*() const { return m_a; } - A m_a; -}; - -typedef A_wrap A_wrap_0; -typedef A_wrap A_wrap_1; -typedef A_wrap A_wrap_2; - - -template -struct A_base : public A -{ - A_base() : A() {} - A_base(int x) : A(x) {} -}; - -typedef A_base A_base_0; -typedef A_base A_base_1; -typedef A_base A_base_2; - -namespace ex = std::experimental; - -template < - class Tuple, class ConstTuple - , class TuplePtr, class ConstTuplePtr - , class TupleWrap, class ConstTupleWrap - , class TupleBase, class ConstTupleBase - > -void test_ext_int_0() -{ - count = 0; - typedef A_int_0 T; - typedef A_wrap_0 Wrap; - typedef A_base_0 Base; - - typedef int(T::*mem1_t)(); - mem1_t mem1 = &T::mem1; - - typedef int(T::*mem2_t)() const; - mem2_t mem2 = &T::mem2; - - typedef int const T::*obj1_t; - obj1_t obj1 = &T::obj1; - - // member function w/ref - { - T a; - Tuple t{a}; - assert(1 == ex::apply(mem1, t)); - assert(count == 1); - } - count = 0; - // member function w/pointer - { - T a; - TuplePtr t{&a}; - assert(1 == ex::apply(mem1, t)); - assert(count == 1); - } - count = 0; - // member function w/base - { - Base a; - TupleBase t{a}; - assert(1 == ex::apply(mem1, t)); - assert(count == 1); - } - count = 0; - // member function w/wrap - { - Wrap a; - TupleWrap t{a}; - assert(1 == ex::apply(mem1, t)); - assert(count == 1); - } - count = 0; - // const member function w/ref - { - T const a; - ConstTuple t{a}; - assert(1 == ex::apply(mem2, t)); - assert(count == 1); - } - count = 0; - // const member function w/pointer - { - T const a; - ConstTuplePtr t{&a}; - assert(1 == ex::apply(mem2, t)); - assert(count == 1); - } - count = 0; - // const member function w/base - { - Base const a; - ConstTupleBase t{a}; - assert(1 == ex::apply(mem2, t)); - assert(count == 1); - } - count = 0; - // const member function w/wrapper - { - Wrap const a; - ConstTupleWrap t{a}; - assert(1 == ex::apply(mem2, t)); - assert(1 == count); - } - // member object w/ref - { - T a{42}; - Tuple t{a}; - assert(42 == ex::apply(obj1, t)); - } - // member object w/pointer - { - T a{42}; - TuplePtr t{&a}; - assert(42 == ex::apply(obj1, t)); - } - // member object w/base - { - Base a{42}; - TupleBase t{a}; - assert(42 == ex::apply(obj1, t)); - } - // member object w/wrapper - { - Wrap a{42}; - TupleWrap t{a}; - assert(42 == ex::apply(obj1, t)); - } -} - - -template < - class Tuple, class ConstTuple - , class TuplePtr, class ConstTuplePtr - , class TupleWrap, class ConstTupleWrap - , class TupleBase, class ConstTupleBase - > -void test_ext_int_1() -{ - count = 0; - typedef A_int_1 T; - typedef A_wrap_1 Wrap; - typedef A_base_1 Base; - - typedef int(T::*mem1_t)(int); - mem1_t mem1 = &T::mem1; - - typedef int(T::*mem2_t)(int) const; - mem2_t mem2 = &T::mem2; - - // member function w/ref - { - T a; - Tuple t{a, 2}; - assert(2 == ex::apply(mem1, t)); - assert(count == 2); - } - count = 0; - // member function w/pointer - { - T a; - TuplePtr t{&a, 3}; - assert(3 == ex::apply(mem1, t)); - assert(count == 3); - } - count = 0; - // member function w/base - { - Base a; - TupleBase t{a, 4}; - assert(4 == ex::apply(mem1, t)); - assert(count == 4); - } - count = 0; - // member function w/wrap - { - Wrap a; - TupleWrap t{a, 5}; - assert(5 == ex::apply(mem1, t)); - assert(count == 5); - } - count = 0; - // const member function w/ref - { - T const a; - ConstTuple t{a, 6}; - assert(6 == ex::apply(mem2, t)); - assert(count == 6); - } - count = 0; - // const member function w/pointer - { - T const a; - ConstTuplePtr t{&a, 7}; - assert(7 == ex::apply(mem2, t)); - assert(count == 7); - } - count = 0; - // const member function w/base - { - Base const a; - ConstTupleBase t{a, 8}; - assert(8 == ex::apply(mem2, t)); - assert(count == 8); - } - count = 0; - // const member function w/wrapper - { - Wrap const a; - ConstTupleWrap t{a, 9}; - assert(9 == ex::apply(mem2, t)); - assert(9 == count); - } -} - - -template < - class Tuple, class ConstTuple - , class TuplePtr, class ConstTuplePtr - , class TupleWrap, class ConstTupleWrap - , class TupleBase, class ConstTupleBase - > -void test_ext_int_2() -{ - count = 0; - typedef A_int_2 T; - typedef A_wrap_2 Wrap; - typedef A_base_2 Base; - - typedef int(T::*mem1_t)(int, int); - mem1_t mem1 = &T::mem1; - - typedef int(T::*mem2_t)(int, int) const; - mem2_t mem2 = &T::mem2; - - // member function w/ref - { - T a; - Tuple t{a, 1, 1}; - assert(2 == ex::apply(mem1, t)); - assert(count == 2); - } - count = 0; - // member function w/pointer - { - T a; - TuplePtr t{&a, 1, 2}; - assert(3 == ex::apply(mem1, t)); - assert(count == 3); - } - count = 0; - // member function w/base - { - Base a; - TupleBase t{a, 2, 2}; - assert(4 == ex::apply(mem1, t)); - assert(count == 4); - } - count = 0; - // member function w/wrap - { - Wrap a; - TupleWrap t{a, 2, 3}; - assert(5 == ex::apply(mem1, t)); - assert(count == 5); - } - count = 0; - // const member function w/ref - { - T const a; - ConstTuple t{a, 3, 3}; - assert(6 == ex::apply(mem2, t)); - assert(count == 6); - } - count = 0; - // const member function w/pointer - { - T const a; - ConstTuplePtr t{&a, 3, 4}; - assert(7 == ex::apply(mem2, t)); - assert(count == 7); - } - count = 0; - // const member function w/base - { - Base const a; - ConstTupleBase t{a, 4, 4}; - assert(8 == ex::apply(mem2, t)); - assert(count == 8); - } - count = 0; - // const member function w/wrapper - { - Wrap const a; - ConstTupleWrap t{a, 4, 5}; - assert(9 == ex::apply(mem2, t)); - assert(9 == count); - } -} - -int main() -{ - { - test_ext_int_0< - std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - >(); - test_ext_int_0< - std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - >(); - test_ext_int_0< - std::array, std::array - , std::array, std::array - , std::array, std::array - , std::array, std::array - >(); - } - { - test_ext_int_1< - std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - >(); - test_ext_int_1< - std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - >(); - test_ext_int_1< - std::pair, std::pair - , std::pair, std::pair - , std::pair, std::pair - , std::pair, std::pair - >(); - test_ext_int_1< - std::pair, std::pair - , std::pair, std::pair - , std::pair, std::pair - , std::pair, std::pair - >(); - } - { - test_ext_int_2< - std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - >(); - test_ext_int_2< - std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - , std::tuple, std::tuple - >(); - } -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/large_arity.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/large_arity.pass.cpp deleted file mode 100644 index 027258ad8..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/large_arity.pass.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Stress testing large arities with tuple and array. - -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -template -struct always_imp -{ - typedef T type; -}; - -template -using always_t = typename always_imp::type; - -//////////////////////////////////////////////////////////////////////////////// -template -struct make_function; - -template -struct make_function> -{ - using type = bool (*)(always_t...); -}; - -template -using make_function_t = typename make_function>::type; - -//////////////////////////////////////////////////////////////////////////////// -template -struct make_tuple_imp; - -//////////////////////////////////////////////////////////////////////////////// -template -struct make_tuple_imp> -{ - using type = std::tuple...>; -}; - -template -using make_tuple_t = typename make_tuple_imp>::type; - -template -bool test_apply_fn(Types...) { return true; } - -namespace ex = std::experimental; - -template -void test_all() -{ - - using A = std::array; - using ConstA = std::array; - - using Tuple = make_tuple_t; - using CTuple = make_tuple_t; - - using ValFn = make_function_t; - ValFn val_fn = &test_apply_fn; - - using RefFn = make_function_t; - RefFn ref_fn = &test_apply_fn; - - using CRefFn = make_function_t; - CRefFn cref_fn = &test_apply_fn; - - using RRefFn = make_function_t; - RRefFn rref_fn = &test_apply_fn; - - { - A a{}; - assert(ex::apply(val_fn, a)); - assert(ex::apply(ref_fn, a)); - assert(ex::apply(cref_fn, a)); - assert(ex::apply(rref_fn, std::move(a))); - } - { - ConstA a{}; - assert(ex::apply(val_fn, a)); - assert(ex::apply(cref_fn, a)); - } - { - Tuple a{}; - assert(ex::apply(val_fn, a)); - assert(ex::apply(ref_fn, a)); - assert(ex::apply(cref_fn, a)); - assert(ex::apply(rref_fn, std::move(a))); - } - { - CTuple a{}; - assert(ex::apply(val_fn, a)); - assert(ex::apply(cref_fn, a)); - } - -} - - -template -void test_one() -{ - using A = std::array; - using Tuple = make_tuple_t; - - using ValFn = make_function_t; - ValFn val_fn = &test_apply_fn; - - { - A a{}; - assert(ex::apply(val_fn, a)); - } - { - Tuple a{}; - assert(ex::apply(val_fn, a)); - } -} - -int main() -{ - // Instantiate with 1-5 arguments. - test_all<1>(); - test_all<2>(); - test_all<3>(); - test_all<4>(); - test_all<5>(); - - // Stress test with 128. - test_one<128>(); - //test_one<256>(); -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp deleted file mode 100644 index 3cf259f53..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Testing ref qualified functions - -#include -#include - -struct func_obj -{ - constexpr func_obj() {} - - constexpr int operator()() const & { return 1; } - constexpr int operator()() const && { return 2; } - constexpr int operator()() & { return 3; } - constexpr int operator()() && { return 4; } -}; - -namespace ex = std::experimental; - -int main() -{ -// TODO(ericwf): Re-enable constexpr support -/* - { - constexpr func_obj f; - constexpr std::tuple<> tp; - - static_assert(1 == ex::apply(static_cast(f), tp), ""); - static_assert(2 == ex::apply(static_cast(f), tp), ""); - } -*/ - { - func_obj f; - std::tuple<> tp; - assert(1 == ex::apply(static_cast(f), tp)); - assert(2 == ex::apply(static_cast(f), tp)); - assert(3 == ex::apply(static_cast(f), tp)); - assert(4 == ex::apply(static_cast(f), tp)); - } -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp deleted file mode 100644 index 01d36637e..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Test the return type deduction. - -#include -#include - -static int my_int = 42; - -template struct index_t {}; - -void f(index_t<0>) {} - -int f(index_t<1>) { return 0; } - -int & f(index_t<2>) { return static_cast(my_int); } -int const & f(index_t<3>) { return static_cast(my_int); } -int volatile & f(index_t<4>) { return static_cast(my_int); } -int const volatile & f(index_t<5>) { return static_cast(my_int); } - -int && f(index_t<6>) { return static_cast(my_int); } -int const && f(index_t<7>) { return static_cast(my_int); } -int volatile && f(index_t<8>) { return static_cast(my_int); } -int const volatile && f(index_t<9>) { return static_cast(my_int); } - -int * f(index_t<10>) { return static_cast(&my_int); } -int const * f(index_t<11>) { return static_cast(&my_int); } -int volatile * f(index_t<12>) { return static_cast(&my_int); } -int const volatile * f(index_t<13>) { return static_cast(&my_int); } - - -template -void test() -{ - using F = decltype(f(index_t{})); - static_assert(std::is_same::value, ""); -} - -namespace ex = std::experimental; - -int main() -{ - test<0, void>(); - test<1, int>(); - test<2, int &>(); - test<3, int const &>(); - test<4, int volatile &>(); - test<5, int const volatile &>(); - test<6, int &&>(); - test<7, int const &&>(); - test<8, int volatile &&>(); - test<9, int const volatile &&>(); - test<10, int *>(); - test<11, int const *>(); - test<12, int volatile *>(); - test<13, int const volatile *>(); -} diff --git a/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp deleted file mode 100644 index 52eec2763..000000000 --- a/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp +++ /dev/null @@ -1,431 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr decltype(auto) apply(F &&, T &&) - -// Test function types. - -#include -#include -#include -#include - -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - -namespace ex = std::experimental; - -int count = 0; - -void f_void_0() { ++count; } -void f_void_1(int i) { count += i; } -void f_void_2(int x, int y) { count += (x + y); } -void f_void_3(int x, int y, int z) { count += (x + y + z); } - -int f_int_0() { return ++count; } -int f_int_1(int x) { return count += x; } -int f_int_2(int x, int y) { return count += (x + y); } -int f_int_3(int x, int y, int z) { return count += (x + y + z); } - -struct A_void_0 -{ - A_void_0() {} - void operator()() { ++count; } - void operator()() const { ++count; ++count; } -}; - -struct A_void_1 -{ - A_void_1() {} - void operator()(int x) { count += x; } - void operator()(int x) const { count += x + 1; } -}; - -struct A_void_2 -{ - A_void_2() {} - void operator()(int x, int y) { count += (x + y); } - void operator()(int x, int y) const { count += (x + y) + 1; } -}; - -struct A_void_3 -{ - A_void_3() {} - void operator()(int x, int y, int z) { count += (x + y + z); } - void operator()(int x, int y, int z) const { count += (x + y + z) + 1; } -}; - - -struct A_int_0 -{ - A_int_0() {} - int operator()() { return ++count; } - int operator()() const { ++count; return ++count; } -}; - -struct A_int_1 -{ - A_int_1() {} - int operator()(int x) { return count += x; } - int operator()(int x) const { return count += (x + 1); } - -}; - -struct A_int_2 -{ - A_int_2() {} - int operator()(int x, int y) { return count += (x + y); } - int operator()(int x, int y) const { return count += (x + y + 1); } -}; - -struct A_int_3 -{ - A_int_3() {} - int operator()(int x, int y, int z) { return count += (x + y + z); } - int operator()(int x, int y, int z) const { return count += (x + y + z + 1); } -}; - - -template -void test_void_0() -{ - count = 0; - // function - { - Tuple t{}; - ex::apply(f_void_0, t); - assert(count == 1); - } - count = 0; - // function pointer - { - Tuple t{}; - auto fp = &f_void_0; - ex::apply(fp, t); - assert(count == 1); - } - count = 0; - // functor - { - Tuple t{}; - A_void_0 a; - ex::apply(a, t); - assert(count == 1); - } - count = 0; - // const functor - { - Tuple t{}; - A_void_0 const a; - ex::apply(a, t); - assert(count == 2); - } -} - -template -void test_void_1() -{ - count = 0; - // function - { - Tuple t{1}; - ex::apply(f_void_1, t); - assert(count == 1); - } - count = 0; - // function pointer - { - Tuple t{2}; - void (*fp)(int) = f_void_1; - ex::apply(fp, t); - assert(count == 2); - } - count = 0; - // functor - { - Tuple t{3}; - A_void_1 fn; - ex::apply(fn, t); - assert(count == 3); - } - count = 0; - // const functor - { - Tuple t{4}; - A_void_1 const a; - ex::apply(a, t); - assert(count == 5); - } -} - -template -void test_void_2() -{ - count = 0; - // function - { - Tuple t{1, 2}; - ex::apply(f_void_2, t); - assert(count == 3); - } - count = 0; - // function pointer - { - Tuple t{2, 3}; - auto fp = &f_void_2; - ex::apply(fp, t); - assert(count == 5); - } - count = 0; - // functor - { - Tuple t{3, 4}; - A_void_2 a; - ex::apply(a, t); - assert(count == 7); - } - count = 0; - // const functor - { - Tuple t{4, 5}; - A_void_2 const a; - ex::apply(a, t); - assert(count == 10); - } -} - -template -void test_void_3() -{ - count = 0; - // function - { - Tuple t{1, 2, 3}; - ex::apply(f_void_3, t); - assert(count == 6); - } - count = 0; - // function pointer - { - Tuple t{2, 3, 4}; - auto fp = &f_void_3; - ex::apply(fp, t); - assert(count == 9); - } - count = 0; - // functor - { - Tuple t{3, 4, 5}; - A_void_3 a; - ex::apply(a, t); - assert(count == 12); - } - count = 0; - // const functor - { - Tuple t{4, 5, 6}; - A_void_3 const a; - ex::apply(a, t); - assert(count == 16); - } -} - - - -template -void test_int_0() -{ - count = 0; - // function - { - Tuple t{}; - assert(1 == ex::apply(f_int_0, t)); - assert(count == 1); - } - count = 0; - // function pointer - { - Tuple t{}; - auto fp = &f_int_0; - assert(1 == ex::apply(fp, t)); - assert(count == 1); - } - count = 0; - // functor - { - Tuple t{}; - A_int_0 a; - assert(1 == ex::apply(a, t)); - assert(count == 1); - } - count = 0; - // const functor - { - Tuple t{}; - A_int_0 const a; - assert(2 == ex::apply(a, t)); - assert(count == 2); - } -} - -template -void test_int_1() -{ - count = 0; - // function - { - Tuple t{1}; - assert(1 == ex::apply(f_int_1, t)); - assert(count == 1); - } - count = 0; - // function pointer - { - Tuple t{2}; - int (*fp)(int) = f_int_1; - assert(2 == ex::apply(fp, t)); - assert(count == 2); - } - count = 0; - // functor - { - Tuple t{3}; - A_int_1 fn; - assert(3 == ex::apply(fn, t)); - assert(count == 3); - } - count = 0; - // const functor - { - Tuple t{4}; - A_int_1 const a; - assert(5 == ex::apply(a, t)); - assert(count == 5); - } -} - -template -void test_int_2() -{ - count = 0; - // function - { - Tuple t{1, 2}; - assert(3 == ex::apply(f_int_2, t)); - assert(count == 3); - } - count = 0; - // function pointer - { - Tuple t{2, 3}; - auto fp = &f_int_2; - assert(5 == ex::apply(fp, t)); - assert(count == 5); - } - count = 0; - // functor - { - Tuple t{3, 4}; - A_int_2 a; - assert(7 == ex::apply(a, t)); - assert(count == 7); - } - count = 0; - // const functor - { - Tuple t{4, 5}; - A_int_2 const a; - assert(10 == ex::apply(a, t)); - assert(count == 10); - } -} - -template -void test_int_3() -{ - count = 0; - // function - { - Tuple t{1, 2, 3}; - assert(6 == ex::apply(f_int_3, t)); - assert(count == 6); - } - count = 0; - // function pointer - { - Tuple t{2, 3, 4}; - auto fp = &f_int_3; - assert(9 == ex::apply(fp, t)); - assert(count == 9); - } - count = 0; - // functor - { - Tuple t{3, 4, 5}; - A_int_3 a; - assert(12 == ex::apply(a, t)); - assert(count == 12); - } - count = 0; - // const functor - { - Tuple t{4, 5, 6}; - A_int_3 const a; - assert(16 == ex::apply(a, t)); - assert(count == 16); - } -} - -template -void test_0() -{ - test_void_0(); - test_int_0(); -} - -template -void test_1() -{ - test_void_1(); - test_int_1(); -} - -template -void test_2() -{ - test_void_2(); - test_int_2(); -} - -template -void test_3() -{ - test_void_3(); - test_int_3(); -} - -int main() -{ - test_0>(); - - test_1>(); - test_1>(); - - test_2>(); - test_2>(); - test_2>(); - - test_3>(); - test_3>(); -} diff --git a/test/std/experimental/utilities/tuple/tuple_size_v.fail.cpp b/test/std/experimental/utilities/tuple/tuple_size_v.fail.cpp deleted file mode 100644 index a25b18cf5..000000000 --- a/test/std/experimental/utilities/tuple/tuple_size_v.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr size_t tuple_size_v = tuple_size::value; - -// Test with reference - -#include - -namespace ex = std::experimental; - -int main() -{ - auto x = ex::tuple_size_v &>; -} diff --git a/test/std/experimental/utilities/tuple/tuple_size_v.pass.cpp b/test/std/experimental/utilities/tuple/tuple_size_v.pass.cpp deleted file mode 100644 index d7a5aa679..000000000 --- a/test/std/experimental/utilities/tuple/tuple_size_v.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr size_t tuple_size_v = tuple_size::value; - -#include -#include -#include - -namespace ex = std::experimental; - -template -void test() -{ - static_assert(ex::tuple_size_v == Expect, ""); - static_assert(ex::tuple_size_v == std::tuple_size::value, ""); - static_assert(ex::tuple_size_v == std::tuple_size::value, ""); - static_assert(ex::tuple_size_v == std::tuple_size::value, ""); - static_assert(ex::tuple_size_v == std::tuple_size::value, ""); -} - -int main() -{ - test, 0>(); - - test, 1>(); - test, 1>(); - - test, 2>(); - test, 2>(); - test, 2>(); - - test, 3>(); - test, 3>(); -} diff --git a/test/std/experimental/utilities/tuple/tuple_size_v_2.fail.cpp b/test/std/experimental/utilities/tuple/tuple_size_v_2.fail.cpp deleted file mode 100644 index a95ac49ff..000000000 --- a/test/std/experimental/utilities/tuple/tuple_size_v_2.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr size_t tuple_size_v = tuple_size::value; - -// Test with non tuple type - -#include - -namespace ex = std::experimental; - -int main() -{ - auto x = ex::tuple_size_v; -} diff --git a/test/std/experimental/utilities/tuple/tuple_size_v_3.fail.cpp b/test/std/experimental/utilities/tuple/tuple_size_v_3.fail.cpp deleted file mode 100644 index 7c2f0cc23..000000000 --- a/test/std/experimental/utilities/tuple/tuple_size_v_3.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template constexpr size_t tuple_size_v = tuple_size::value; - -// Test with pointer - -#include - -namespace ex = std::experimental; - -int main() -{ - auto x = ex::tuple_size_v*>; -} From f003d63c40befd4aab6057a43797bf00cf8eaf90 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 7 Feb 2018 19:24:37 +0000 Subject: [PATCH 0351/1520] Comment on 'Review' issues git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324503 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index d148cd262..88d2d9d30 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -32,7 +32,7 @@
    -

    libc++ Upcoming Metting Status

    +

    libc++ Upcoming Meeting Status

    This is a temporary page; please check the c++1z status here

    @@ -97,7 +97,7 @@

    Issues to "Review"

    - + @@ -143,14 +143,14 @@

    Comments about the "Review" issues

      -
    • 2412 -
    • -
    • 2682 -
    • -
    • 2697 -
    • -
    • 2708 -
    • -
    • 2936 -
    • +
    • 2412 - I think we do this already
    • +
    • 2682 - Eric - don't we do this already?
    • +
    • 2697 - No concurrency TS implementation yet
    • +
    • 2708 - Eric?
    • +
    • 2936 - Eric - don't we do this already?
    -

    Last Updated: 5-Feb-2018

    +

    Last Updated: 7-Feb-2018

    From 6cb35ede819b18376cc2e08d7bd83e86d4874755 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 7 Feb 2018 21:06:13 +0000 Subject: [PATCH 0352/1520] [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324526 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 9 +- include/array | 167 +++++++++++++++--- .../array/array.zero/db_back.pass.cpp | 49 +++++ .../array/array.zero/db_front.pass.cpp | 49 +++++ .../array/array.zero/db_indexing.pass.cpp | 53 ++++++ .../array/array.cons/default.pass.cpp | 17 ++ .../array/array.cons/implicit_copy.pass.cpp | 93 ++++++++++ .../sequences/array/array.data/data.pass.cpp | 30 +++- .../array/array.data/data_const.pass.cpp | 19 ++ .../sequences/array/array.fill/fill.fail.cpp | 29 +++ .../sequences/array/array.swap/swap.fail.cpp | 30 ++++ .../containers/sequences/array/at.pass.cpp | 20 +++ .../containers/sequences/array/begin.pass.cpp | 10 ++ .../sequences/array/compare.fail.cpp | 71 ++++++++ .../sequences/array/compare.pass.cpp | 63 +++++++ .../containers/sequences/array/empty.fail.cpp | 5 +- .../sequences/array/front_back.pass.cpp | 33 +++- .../sequences/array/indexing.pass.cpp | 29 ++- .../array/size_and_alignment.pass.cpp | 55 ++++++ 19 files changed, 805 insertions(+), 26 deletions(-) create mode 100644 test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp create mode 100644 test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp create mode 100644 test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp create mode 100644 test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp create mode 100644 test/std/containers/sequences/array/array.fill/fill.fail.cpp create mode 100644 test/std/containers/sequences/array/array.swap/swap.fail.cpp create mode 100644 test/std/containers/sequences/array/compare.fail.cpp create mode 100644 test/std/containers/sequences/array/compare.pass.cpp create mode 100644 test/std/containers/sequences/array/size_and_alignment.pass.cpp diff --git a/include/__config b/include/__config index 470b22dde..a4acbcaf1 100644 --- a/include/__config +++ b/include/__config @@ -793,8 +793,13 @@ namespace std { # if !defined(_LIBCPP_DEBUG) # error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined # endif -# define _NOEXCEPT_DEBUG noexcept(false) -# define _NOEXCEPT_DEBUG_(x) noexcept(false) +# ifdef _LIBCPP_HAS_NO_NOEXCEPT +# define _NOEXCEPT_DEBUG +# define _NOEXCEPT_DEBUG_(x) +# else +# define _NOEXCEPT_DEBUG noexcept(false) +# define _NOEXCEPT_DEBUG_(x) noexcept(false) +#endif #else # define _NOEXCEPT_DEBUG _NOEXCEPT # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) diff --git a/include/array b/include/array index 4eb2fe6fc..706e573db 100644 --- a/include/array +++ b/include/array @@ -108,6 +108,8 @@ template const T&& get(const array&&) noexce #include #include #include +#include // for _LIBCPP_UNREACHABLE +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -117,6 +119,7 @@ template const T&& get(const array&&) noexce _LIBCPP_BEGIN_NAMESPACE_STD + template struct _LIBCPP_TEMPLATE_VIS array { @@ -134,31 +137,27 @@ struct _LIBCPP_TEMPLATE_VIS array typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - value_type __elems_[_Size > 0 ? _Size : 1]; + _Tp __elems_[_Size]; // No explicit construct/copy/destroy for aggregate type - _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) - {_VSTD::fill_n(__elems_, _Size, __u);} - _LIBCPP_INLINE_VISIBILITY - void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) - { __swap_dispatch((std::integral_constant()), __a); } + _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) { + _VSTD::fill_n(__elems_, _Size, __u); + } _LIBCPP_INLINE_VISIBILITY - void __swap_dispatch(std::true_type, array&) {} - - _LIBCPP_INLINE_VISIBILITY - void __swap_dispatch(std::false_type, array& __a) - { _VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);} + void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { + std::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_); + } // iterators: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - iterator begin() _NOEXCEPT {return iterator(__elems_);} + iterator begin() _NOEXCEPT {return iterator(data());} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);} + const_iterator begin() const _NOEXCEPT {return const_iterator(data());} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);} + iterator end() _NOEXCEPT {return iterator(data() + _Size);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);} + const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -184,7 +183,7 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;} _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} + _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return false; } // element access: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 @@ -197,8 +196,8 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size - 1];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size - 1];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 value_type* data() _NOEXCEPT {return __elems_;} @@ -206,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array const value_type* data() const _NOEXCEPT {return __elems_;} }; + template _LIBCPP_CONSTEXPR_AFTER_CXX14 typename array<_Tp, _Size>::reference @@ -227,12 +227,138 @@ array<_Tp, _Size>::at(size_type __n) const return __elems_[__n]; } +template +struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> +{ + // types: + typedef array __self; + typedef _Tp value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + + typedef typename conditional::value, const char, + char>::type _CharType; + _ALIGNAS(alignment_of<_Tp[1]>::value) _CharType __elems_[sizeof(_Tp[1])]; + + // No explicit construct/copy/destroy for aggregate type + _LIBCPP_INLINE_VISIBILITY void fill(const value_type&) { + static_assert(!is_const<_Tp>::value, + "cannot fill zero-sized array of type 'const T'"); + } + + _LIBCPP_INLINE_VISIBILITY + void swap(array&) _NOEXCEPT { + static_assert(!is_const<_Tp>::value, + "cannot swap zero-sized array of type 'const T'"); + } + + // iterators: + _LIBCPP_INLINE_VISIBILITY + iterator begin() _NOEXCEPT {return iterator(data());} + _LIBCPP_INLINE_VISIBILITY + const_iterator begin() const _NOEXCEPT {return const_iterator(data());} + _LIBCPP_INLINE_VISIBILITY + iterator end() _NOEXCEPT {return iterator(data());} + _LIBCPP_INLINE_VISIBILITY + const_iterator end() const _NOEXCEPT {return const_iterator(data());} + + _LIBCPP_INLINE_VISIBILITY + reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} + _LIBCPP_INLINE_VISIBILITY + reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());} + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());} + + _LIBCPP_INLINE_VISIBILITY + const_iterator cbegin() const _NOEXCEPT {return begin();} + _LIBCPP_INLINE_VISIBILITY + const_iterator cend() const _NOEXCEPT {return end();} + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} + _LIBCPP_INLINE_VISIBILITY + const_reverse_iterator crend() const _NOEXCEPT {return rend();} + + // capacity: + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return 0; } + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return 0;} + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return true;} + + // element access: + _LIBCPP_INLINE_VISIBILITY + reference operator[](size_type) { + _LIBCPP_ASSERT(false, "cannot call array::operator[] on a zero-sized array"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const_reference operator[](size_type) const { + _LIBCPP_ASSERT(false, "cannot call array::operator[] on a zero-sized array"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + reference at(size_type) { + __throw_out_of_range("array::at"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + const_reference at(size_type) const { + __throw_out_of_range("array::at"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + reference front() { + _LIBCPP_ASSERT(false, "cannot call array::front() on a zero-sized array"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + const_reference front() const { + _LIBCPP_ASSERT(false, "cannot call array::front() on a zero-sized array"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + reference back() { + _LIBCPP_ASSERT(false, "cannot call array::back() on a zero-sized array"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + const_reference back() const { + _LIBCPP_ASSERT(false, "cannot call array::back() on a zero-sized array"); + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + value_type* data() _NOEXCEPT {return reinterpret_cast(__elems_);} + _LIBCPP_INLINE_VISIBILITY + const value_type* data() const _NOEXCEPT {return reinterpret_cast(__elems_);} +}; + + template inline _LIBCPP_INLINE_VISIBILITY bool operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { - return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_); + return _VSTD::equal(__x.begin(), __x.end(), __y.begin()); } template @@ -248,7 +374,8 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { - return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size); + return _VSTD::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); } template diff --git a/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp b/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp new file mode 100644 index 000000000..465523f84 --- /dev/null +++ b/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-no-exceptions +// MODULES_DEFINES: _LIBCPP_DEBUG=1 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS + +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + +// test array::front() throws a debug exception. + +#define _LIBCPP_DEBUG 1 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS +#include + +template +inline bool CheckDebugThrows(Array& Arr) { + try { + Arr.back(); + } catch (std::__libcpp_debug_exception const&) { + return true; + } + return false; +} + +int main() +{ + { + typedef std::array C; + C c = {}; + C const& cc = c; + assert(CheckDebugThrows(c)); + assert(CheckDebugThrows(cc)); + } + { + typedef std::array C; + C c = {{}}; + C const& cc = c; + assert(CheckDebugThrows(c)); + assert(CheckDebugThrows(cc)); + } +} diff --git a/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp b/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp new file mode 100644 index 000000000..d49b3a763 --- /dev/null +++ b/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-no-exceptions +// MODULES_DEFINES: _LIBCPP_DEBUG=1 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS + +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + +// test array::front() throws a debug exception. + +#define _LIBCPP_DEBUG 1 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS +#include + +template +inline bool CheckDebugThrows(Array& Arr) { + try { + Arr.front(); + } catch (std::__libcpp_debug_exception const&) { + return true; + } + return false; +} + +int main() +{ + { + typedef std::array C; + C c = {}; + C const& cc = c; + assert(CheckDebugThrows(c)); + assert(CheckDebugThrows(cc)); + } + { + typedef std::array C; + C c = {{}}; + C const& cc = c; + assert(CheckDebugThrows(c)); + assert(CheckDebugThrows(cc)); + } +} diff --git a/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp b/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp new file mode 100644 index 000000000..4d6ad6907 --- /dev/null +++ b/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-no-exceptions +// MODULES_DEFINES: _LIBCPP_DEBUG=1 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS + +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + +// test array::operator[] throws a debug exception. + +#define _LIBCPP_DEBUG 1 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS +#include + +template +inline bool CheckDebugThrows(Array& Arr, size_t Index) { + try { + Arr[Index]; + } catch (std::__libcpp_debug_exception const&) { + return true; + } + return false; +} + +int main() +{ + { + typedef std::array C; + C c = {}; + C const& cc = c; + assert(CheckDebugThrows(c, 0)); + assert(CheckDebugThrows(c, 1)); + assert(CheckDebugThrows(cc, 0)); + assert(CheckDebugThrows(cc, 1)); + } + { + typedef std::array C; + C c = {{}}; + C const& cc = c; + assert(CheckDebugThrows(c, 0)); + assert(CheckDebugThrows(c, 1)); + assert(CheckDebugThrows(cc, 0)); + assert(CheckDebugThrows(cc, 1)); + } +} diff --git a/test/std/containers/sequences/array/array.cons/default.pass.cpp b/test/std/containers/sequences/array/array.cons/default.pass.cpp index 7bc62b759..9a2a6eaa3 100644 --- a/test/std/containers/sequences/array/array.cons/default.pass.cpp +++ b/test/std/containers/sequences/array/array.cons/default.pass.cpp @@ -14,6 +14,14 @@ #include #include +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +struct NoDefault { + NoDefault(int) {} +}; + int main() { { @@ -28,4 +36,13 @@ int main() C c; assert(c.size() == 0); } + { + typedef std::array C; + C c; + assert(c.size() == 0); + C c1 = {}; + assert(c1.size() == 0); + C c2 = {{}}; + assert(c2.size() == 0); + } } diff --git a/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp new file mode 100644 index 000000000..7814085e8 --- /dev/null +++ b/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp @@ -0,0 +1,93 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// implicitly generated array constructors / assignment operators + +#include +#include +#include +#include "test_macros.h" + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +// In C++03 the copy assignment operator is not deleted when the implicitly +// generated operator would be ill-formed; like in the case of a struct with a +// const member. +#if TEST_STD_VER < 11 +#define TEST_NOT_COPY_ASSIGNABLE(T) ((void)0) +#else +#define TEST_NOT_COPY_ASSIGNABLE(T) static_assert(!std::is_copy_assignable::value, "") +#endif + +struct NoDefault { + NoDefault(int) {} +}; + +int main() { + { + typedef double T; + typedef std::array C; + C c = {1.1, 2.2, 3.3}; + C c2 = c; + c2 = c; + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + typedef double T; + typedef std::array C; + C c = {1.1, 2.2, 3.3}; + C c2 = c; + ((void)c2); + static_assert(std::is_copy_constructible::value, ""); + TEST_NOT_COPY_ASSIGNABLE(C); + } + { + typedef double T; + typedef std::array C; + C c = {}; + C c2 = c; + c2 = c; + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + // const arrays of size 0 should disable the implicit copy assignment operator. + typedef double T; + typedef std::array C; + C c = {{}}; + C c2 = c; + ((void)c2); + static_assert(std::is_copy_constructible::value, ""); + TEST_NOT_COPY_ASSIGNABLE(C); + } + { + typedef NoDefault T; + typedef std::array C; + C c = {}; + C c2 = c; + c2 = c; + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + typedef NoDefault T; + typedef std::array C; + C c = {{}}; + C c2 = c; + ((void)c2); + static_assert(std::is_copy_constructible::value, ""); + TEST_NOT_COPY_ASSIGNABLE(C); + } + +} diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp index d7aed70c9..714894308 100644 --- a/test/std/containers/sequences/array/array.data/data.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -13,6 +13,7 @@ #include #include +#include "test_macros.h" // std::array is explicitly allowed to be initialized with A a = { init-list };. // Disable the missing braces warning for this reason. @@ -34,6 +35,33 @@ int main() typedef std::array C; C c = {}; T* p = c.data(); - (void)p; // to placate scan-build + assert(p != nullptr); + } + { + typedef double T; + typedef std::array C; + C c = {{}}; + const T* p = c.data(); + static_assert((std::is_same::value), ""); + assert(p != nullptr); + } + { + typedef std::max_align_t T; + typedef std::array C; + const C c = {}; + const T* p = c.data(); + assert(p != nullptr); + std::uintptr_t pint = reinterpret_cast(p); + assert(pint % TEST_ALIGNOF(std::max_align_t) == 0); + } + { + struct NoDefault { + NoDefault(int) {} + }; + typedef NoDefault T; + typedef std::array C; + C c = {}; + T* p = c.data(); + assert(p != nullptr); } } diff --git a/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/test/std/containers/sequences/array/array.data/data_const.pass.cpp index 5be082eeb..b99bf6af8 100644 --- a/test/std/containers/sequences/array/array.data/data_const.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data_const.pass.cpp @@ -38,6 +38,25 @@ int main() const T* p = c.data(); (void)p; // to placate scan-build } + { + struct NoDefault { + NoDefault(int) {} + }; + typedef NoDefault T; + typedef std::array C; + const C c = {}; + const T* p = c.data(); + assert(p != nullptr); + } + { + typedef std::max_align_t T; + typedef std::array C; + const C c = {}; + const T* p = c.data(); + assert(p != nullptr); + std::uintptr_t pint = reinterpret_cast(p); + assert(pint % TEST_ALIGNOF(std::max_align_t) == 0); + } #if TEST_STD_VER > 14 { typedef std::array C; diff --git a/test/std/containers/sequences/array/array.fill/fill.fail.cpp b/test/std/containers/sequences/array/array.fill/fill.fail.cpp new file mode 100644 index 000000000..039992fbb --- /dev/null +++ b/test/std/containers/sequences/array/array.fill/fill.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void fill(const T& u); + +#include +#include + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +int main() { + { + typedef double T; + typedef std::array C; + C c = {}; + // expected-error-re@array:* {{static_assert failed {{.*}} "cannot fill zero-sized array of type 'const T'"}} + c.fill(5.5); // expected-note {{requested here}} + } +} diff --git a/test/std/containers/sequences/array/array.swap/swap.fail.cpp b/test/std/containers/sequences/array/array.swap/swap.fail.cpp new file mode 100644 index 000000000..c54905bae --- /dev/null +++ b/test/std/containers/sequences/array/array.swap/swap.fail.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void swap(array& a); + +#include +#include + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +int main() { + { + typedef double T; + typedef std::array C; + C c = {}; + C c2 = {}; + // expected-error-re@array:* {{static_assert failed {{.*}} "cannot swap zero-sized array of type 'const T'"}} + c.swap(c2); // expected-note {{requested here}} + } +} diff --git a/test/std/containers/sequences/array/at.pass.cpp b/test/std/containers/sequences/array/at.pass.cpp index 27b326fa7..84a8d6f9d 100644 --- a/test/std/containers/sequences/array/at.pass.cpp +++ b/test/std/containers/sequences/array/at.pass.cpp @@ -56,6 +56,26 @@ int main() catch (const std::out_of_range &) {} #endif } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + typedef double T; + typedef std::array C; + C c = {}; + C const& cc = c; + try + { + TEST_IGNORE_NODISCARD c.at(0); + assert(false); + } + catch (const std::out_of_range &) {} + try + { + TEST_IGNORE_NODISCARD cc.at(0); + assert(false); + } + catch (const std::out_of_range &) {} + } +#endif { typedef double T; typedef std::array C; diff --git a/test/std/containers/sequences/array/begin.pass.cpp b/test/std/containers/sequences/array/begin.pass.cpp index b12ffc851..282a947fe 100644 --- a/test/std/containers/sequences/array/begin.pass.cpp +++ b/test/std/containers/sequences/array/begin.pass.cpp @@ -18,6 +18,7 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" + int main() { { @@ -31,4 +32,13 @@ int main() *i = 5.5; assert(c[0] == 5.5); } + { + struct NoDefault { + NoDefault(int) {} + }; + typedef NoDefault T; + typedef std::array C; + C c = {}; + assert(c.begin() == c.end()); + } } diff --git a/test/std/containers/sequences/array/compare.fail.cpp b/test/std/containers/sequences/array/compare.fail.cpp new file mode 100644 index 000000000..2aa7cd896 --- /dev/null +++ b/test/std/containers/sequences/array/compare.fail.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// bool operator==(array const&, array const&); +// bool operator!=(array const&, array const&); +// bool operator<(array const&, array const&); +// bool operator<=(array const&, array const&); +// bool operator>(array const&, array const&); +// bool operator>=(array const&, array const&); + + +#include +#include +#include + +#include "test_macros.h" + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +template +void test_compare(const Array& LHS, const Array& RHS) { + typedef std::vector Vector; + const Vector LHSV(LHS.begin(), LHS.end()); + const Vector RHSV(RHS.begin(), RHS.end()); + assert((LHS == RHS) == (LHSV == RHSV)); + assert((LHS != RHS) == (LHSV != RHSV)); + assert((LHS < RHS) == (LHSV < RHSV)); + assert((LHS <= RHS) == (LHSV <= RHSV)); + assert((LHS > RHS) == (LHSV > RHSV)); + assert((LHS >= RHS) == (LHSV >= RHSV)); +} + +template struct NoCompare {}; + +int main() +{ + { + typedef NoCompare<0> T; + typedef std::array C; + C c1 = {{}}; + // expected-error@algorithm:* 2 {{invalid operands to binary expression}} + TEST_IGNORE_NODISCARD (c1 == c1); + TEST_IGNORE_NODISCARD (c1 < c1); + } + { + typedef NoCompare<1> T; + typedef std::array C; + C c1 = {{}}; + // expected-error@algorithm:* 2 {{invalid operands to binary expression}} + TEST_IGNORE_NODISCARD (c1 != c1); + TEST_IGNORE_NODISCARD (c1 > c1); + } + { + typedef NoCompare<2> T; + typedef std::array C; + C c1 = {{}}; + // expected-error@algorithm:* 2 {{invalid operands to binary expression}} + TEST_IGNORE_NODISCARD (c1 == c1); + TEST_IGNORE_NODISCARD (c1 < c1); + } +} diff --git a/test/std/containers/sequences/array/compare.pass.cpp b/test/std/containers/sequences/array/compare.pass.cpp new file mode 100644 index 000000000..c8bcf75a0 --- /dev/null +++ b/test/std/containers/sequences/array/compare.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// bool operator==(array const&, array const&); +// bool operator!=(array const&, array const&); +// bool operator<(array const&, array const&); +// bool operator<=(array const&, array const&); +// bool operator>(array const&, array const&); +// bool operator>=(array const&, array const&); + + +#include +#include +#include + +#include "test_macros.h" + +// std::array is explicitly allowed to be initialized with A a = { init-list };. +// Disable the missing braces warning for this reason. +#include "disable_missing_braces_warning.h" + +template +void test_compare(const Array& LHS, const Array& RHS) { + typedef std::vector Vector; + const Vector LHSV(LHS.begin(), LHS.end()); + const Vector RHSV(RHS.begin(), RHS.end()); + assert((LHS == RHS) == (LHSV == RHSV)); + assert((LHS != RHS) == (LHSV != RHSV)); + assert((LHS < RHS) == (LHSV < RHSV)); + assert((LHS <= RHS) == (LHSV <= RHSV)); + assert((LHS > RHS) == (LHSV > RHSV)); + assert((LHS >= RHS) == (LHSV >= RHSV)); +} + +int main() +{ + { + typedef int T; + typedef std::array C; + C c1 = {1, 2, 3}; + C c2 = {1, 2, 3}; + C c3 = {3, 2, 1}; + C c4 = {1, 2, 1}; + test_compare(c1, c2); + test_compare(c1, c3); + test_compare(c1, c4); + } + { + typedef int T; + typedef std::array C; + C c1 = {}; + C c2 = {}; + test_compare(c1, c2); + } +} diff --git a/test/std/containers/sequences/array/empty.fail.cpp b/test/std/containers/sequences/array/empty.fail.cpp index 85bf5a7c9..fe118c5f1 100644 --- a/test/std/containers/sequences/array/empty.fail.cpp +++ b/test/std/containers/sequences/array/empty.fail.cpp @@ -23,6 +23,9 @@ int main () { + std::array c; - c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} + c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} + std::array c0; + c0.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} } diff --git a/test/std/containers/sequences/array/front_back.pass.cpp b/test/std/containers/sequences/array/front_back.pass.cpp index 0591ca7fa..443f28ddf 100644 --- a/test/std/containers/sequences/array/front_back.pass.cpp +++ b/test/std/containers/sequences/array/front_back.pass.cpp @@ -64,7 +64,38 @@ int main() C::const_reference r2 = c.back(); assert(r2 == 3.5); } - + { + typedef double T; + typedef std::array C; + C c = {}; + C const& cc = c; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + if (c.size() > (0)) { // always false + TEST_IGNORE_NODISCARD c.front(); + TEST_IGNORE_NODISCARD c.back(); + TEST_IGNORE_NODISCARD cc.front(); + TEST_IGNORE_NODISCARD cc.back(); + } + } + { + typedef double T; + typedef std::array C; + C c = {{}}; + C const& cc = c; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + if (c.size() > (0)) { + TEST_IGNORE_NODISCARD c.front(); + TEST_IGNORE_NODISCARD c.back(); + TEST_IGNORE_NODISCARD cc.front(); + TEST_IGNORE_NODISCARD cc.back(); + } + } #if TEST_STD_VER > 11 { typedef double T; diff --git a/test/std/containers/sequences/array/indexing.pass.cpp b/test/std/containers/sequences/array/indexing.pass.cpp index 43c494777..7718b92f9 100644 --- a/test/std/containers/sequences/array/indexing.pass.cpp +++ b/test/std/containers/sequences/array/indexing.pass.cpp @@ -56,7 +56,34 @@ int main() C::const_reference r2 = c[2]; assert(r2 == 3.5); } - + { // Test operator[] "works" on zero sized arrays + typedef double T; + typedef std::array C; + C c = {}; + C const& cc = c; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + if (c.size() > (0)) { // always false + C::reference r1 = c[0]; + C::const_reference r2 = cc[0]; + ((void)r1); + ((void)r2); + } + } + { // Test operator[] "works" on zero sized arrays + typedef double T; + typedef std::array C; + C c = {{}}; + C const& cc = c; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + if (c.size() > (0)) { // always false + C::reference r1 = c[0]; + C::const_reference r2 = cc[0]; + ((void)r1); + ((void)r2); + } + } #if TEST_STD_VER > 11 { typedef double T; diff --git a/test/std/containers/sequences/array/size_and_alignment.pass.cpp b/test/std/containers/sequences/array/size_and_alignment.pass.cpp new file mode 100644 index 000000000..d01e1ceb7 --- /dev/null +++ b/test/std/containers/sequences/array/size_and_alignment.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// struct array + +// Test the size and alignment matches that of an array of a given type. + +#include +#include +#include +#include + +#include "test_macros.h" + +template +void test() { + typedef T CArrayT[Size == 0 ? 1 : Size]; + typedef std::array ArrayT; + static_assert(sizeof(CArrayT) == sizeof(ArrayT), ""); + static_assert(TEST_ALIGNOF(CArrayT) == TEST_ALIGNOF(ArrayT), ""); +} + +template +void test_type() { + test(); + test(); + test(); +} + +struct TEST_ALIGNAS(TEST_ALIGNOF(std::max_align_t) * 2) TestType1 { + +}; + +struct TEST_ALIGNAS(TEST_ALIGNOF(std::max_align_t) * 2) TestType2 { + char data[1000]; +}; + +int main() { + test_type(); + test_type(); + test_type(); + test_type(); + test_type(); + test_type(); + test_type(); +} From 2e1fa09f682befb69d4f3f13559031220250a28e Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 7 Feb 2018 21:25:25 +0000 Subject: [PATCH 0353/1520] Fix -verify static assert messages for older Clang versions git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324529 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/containers/sequences/array/array.fill/fill.fail.cpp | 2 +- test/std/containers/sequences/array/array.swap/swap.fail.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/containers/sequences/array/array.fill/fill.fail.cpp b/test/std/containers/sequences/array/array.fill/fill.fail.cpp index 039992fbb..4cd8e60ac 100644 --- a/test/std/containers/sequences/array/array.fill/fill.fail.cpp +++ b/test/std/containers/sequences/array/array.fill/fill.fail.cpp @@ -23,7 +23,7 @@ int main() { typedef double T; typedef std::array C; C c = {}; - // expected-error-re@array:* {{static_assert failed {{.*}} "cannot fill zero-sized array of type 'const T'"}} + // expected-error-re@array:* {{static_assert failed {{.*}}"cannot fill zero-sized array of type 'const T'"}} c.fill(5.5); // expected-note {{requested here}} } } diff --git a/test/std/containers/sequences/array/array.swap/swap.fail.cpp b/test/std/containers/sequences/array/array.swap/swap.fail.cpp index c54905bae..638c5b321 100644 --- a/test/std/containers/sequences/array/array.swap/swap.fail.cpp +++ b/test/std/containers/sequences/array/array.swap/swap.fail.cpp @@ -24,7 +24,7 @@ int main() { typedef std::array C; C c = {}; C c2 = {}; - // expected-error-re@array:* {{static_assert failed {{.*}} "cannot swap zero-sized array of type 'const T'"}} + // expected-error-re@array:* {{static_assert failed {{.*}}"cannot swap zero-sized array of type 'const T'"}} c.swap(c2); // expected-note {{requested here}} } } From 088e6015b20fd097f7b00bb330c359added2c9c5 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 7 Feb 2018 21:30:17 +0000 Subject: [PATCH 0354/1520] Fix PR#31454 - 'basic_string::push_back() crashes if sizeof(T)>sizeof(long long)'. We were mishandling the small-string optimization calculations for very large 'characters'. This may be an ABI change (change the size of) strings of very large 'characters', but since they never worked, I'm not too concerned. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324531 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 10 +++++++--- .../string.modifiers/string_append/push_back.pass.cpp | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/string b/include/string index b213cd411..f89ef5741 100644 --- a/include/string +++ b/include/string @@ -1363,9 +1363,13 @@ private: enum {__alignment = 16}; static _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __s) _NOEXCEPT - {return (__s < __min_cap ? static_cast(__min_cap) : - __align_it (__s+1)) - 1;} + { + if (__s < __min_cap) return static_cast(__min_cap) - 1; + size_type __guess = __align_it (__s+1) - 1; + if (__guess == __min_cap) ++__guess; + return __guess; + } inline void __init(const value_type* __s, size_type __sz, size_type __reserve); diff --git a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp index 5ca5aaf86..128446534 100644 --- a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -48,7 +48,7 @@ int main() test(S("12345678901234567890"), 'a', S("12345678901234567890a")); } #endif -#if 0 + { // https://bugs.llvm.org/show_bug.cgi?id=31454 std::basic_string s; @@ -57,5 +57,4 @@ int main() s.push_back(vl); s.push_back(vl); } -#endif } From 73660f725a7479d33f5ebb1517608e4d4c9fb103 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 7 Feb 2018 21:58:48 +0000 Subject: [PATCH 0355/1520] Stop using __strtonum_fallback on Android. Fallback implementations are now provided by bionic when necessary, which these may conflict with. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324534 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/support/android/locale_bionic.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/support/android/locale_bionic.h b/include/support/android/locale_bionic.h index 482e23433..081035d45 100644 --- a/include/support/android/locale_bionic.h +++ b/include/support/android/locale_bionic.h @@ -25,7 +25,6 @@ extern "C" { #endif #include -#include #endif // defined(__BIONIC__) #endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H From c0acd34e9aab8e28f2d7ba49529d36906dff0c10 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 7 Feb 2018 23:50:25 +0000 Subject: [PATCH 0356/1520] Fix size and alignment of array. An array T[1] isn't necessarily the same say when it's a member of a struct. This patch addresses that problem and corrects the tests to deal with it. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324545 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 1 + include/array | 5 +++-- .../array/size_and_alignment.pass.cpp | 20 +++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/__config b/include/__config index a4acbcaf1..cfe4ef08c 100644 --- a/include/__config +++ b/include/__config @@ -582,6 +582,7 @@ namespace std { #define __alignof__ __alignof #define _LIBCPP_NORETURN __declspec(noreturn) #define _ALIGNAS(x) __declspec(align(x)) +#define _ALIGNAS_TYPE(x) alignas(x) #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { diff --git a/include/array b/include/array index 706e573db..fdb1f9dae 100644 --- a/include/array +++ b/include/array @@ -244,10 +244,11 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - typedef typename conditional::value, const char, char>::type _CharType; - _ALIGNAS(alignment_of<_Tp[1]>::value) _CharType __elems_[sizeof(_Tp[1])]; + + struct _ArrayInStructT { _Tp __data_[1]; }; + _ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; // No explicit construct/copy/destroy for aggregate type _LIBCPP_INLINE_VISIBILITY void fill(const value_type&) { diff --git a/test/std/containers/sequences/array/size_and_alignment.pass.cpp b/test/std/containers/sequences/array/size_and_alignment.pass.cpp index d01e1ceb7..966d063fe 100644 --- a/test/std/containers/sequences/array/size_and_alignment.pass.cpp +++ b/test/std/containers/sequences/array/size_and_alignment.pass.cpp @@ -21,12 +21,26 @@ #include "test_macros.h" + +template +struct MyArray { + T elems[Size]; +}; + template void test() { typedef T CArrayT[Size == 0 ? 1 : Size]; typedef std::array ArrayT; - static_assert(sizeof(CArrayT) == sizeof(ArrayT), ""); - static_assert(TEST_ALIGNOF(CArrayT) == TEST_ALIGNOF(ArrayT), ""); + typedef MyArray MyArrayT; + static_assert(sizeof(ArrayT) == sizeof(CArrayT), ""); + static_assert(sizeof(ArrayT) == sizeof(MyArrayT), ""); + static_assert(TEST_ALIGNOF(ArrayT) == TEST_ALIGNOF(MyArrayT), ""); +#if defined(_LIBCPP_VERSION) + ArrayT a; + ((void)a); + static_assert(sizeof(ArrayT) == sizeof(a.__elems_), ""); + static_assert(TEST_ALIGNOF(ArrayT) == __alignof__(a.__elems_), ""); +#endif } template @@ -44,6 +58,8 @@ struct TEST_ALIGNAS(TEST_ALIGNOF(std::max_align_t) * 2) TestType2 { char data[1000]; }; +//static_assert(sizeof(void*) == 4, ""); + int main() { test_type(); test_type(); From 60020e6384719ac16a4d84559f84ce78f1f04780 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 05:47:40 +0000 Subject: [PATCH 0357/1520] Improve a test. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324566 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/libcxx/memory/is_allocator.pass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/libcxx/memory/is_allocator.pass.cpp b/test/libcxx/memory/is_allocator.pass.cpp index c33b7e829..95f1079d6 100644 --- a/test/libcxx/memory/is_allocator.pass.cpp +++ b/test/libcxx/memory/is_allocator.pass.cpp @@ -26,6 +26,7 @@ template void test_allocators() { + static_assert(!std::__is_allocator::value, "" ); static_assert( std::__is_allocator>::value, "" ); static_assert( std::__is_allocator>::value, "" ); static_assert( std::__is_allocator>::value, "" ); From 5b1e87e52d055e55396efff955b76d5e56779676 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 06:34:03 +0000 Subject: [PATCH 0358/1520] Implement deduction guide for basic_string as described in P0433 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324569 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 19 +++++++ .../string.cons/iter_alloc.fail.cpp | 54 ++++++++++++++++++ .../string.cons/iter_alloc.pass.cpp | 56 +++++++++++++++++++ www/cxx1z_status.html | 5 +- 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp diff --git a/include/string b/include/string index f89ef5741..e8ec709c2 100644 --- a/include/string +++ b/include/string @@ -311,6 +311,13 @@ public: bool __invariants() const; }; +template::value_type>> +basic_string(InputIterator, InputIterator, Allocator = Allocator()) + -> basic_string::value_type, + char_traits::value_type>, + Allocator>; // C++17 + template basic_string operator+(const basic_string& lhs, @@ -1485,6 +1492,18 @@ private: friend basic_string operator+<>(const basic_string&, value_type); }; +#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +template::value_type, + class _Allocator = allocator<_CharT>, + class = typename enable_if<__is_input_iterator<_InputIterator>::value, void>::type, + class = typename enable_if<__is_allocator<_Allocator>::value, void>::type + > +basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> basic_string<_CharT, char_traits<_CharT>, _Allocator>; +#endif + + template inline _LIBCPP_INLINE_VISIBILITY void diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp new file mode 100644 index 000000000..3bc10e4ac --- /dev/null +++ b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp @@ -0,0 +1,54 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template::value_type>> +// basic_string(InputIterator, InputIterator, Allocator = Allocator()) +// -> basic_string::value_type, +// char_traits::value_type>, +// Allocator>; +// +// The deduction guide shall not participate in overload resolution if InputIterator +// is a type that does not qualify as an input iterator, or if Allocator is a type +// that does not qualify as an allocator. + + +#include +#include +#include +#include + +#include "test_macros.h" + +class NotAnItertor {}; + +template +struct NotAnAllocator { typedef T value_type; }; + +int main() +{ + { // Not an iterator at all + std::basic_string s1{NotAnItertor{}, NotAnItertor{}, std::allocator{}}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}} + } + { // Not an input iterator + const char16_t* s = u"12345678901234"; + std::basic_string s0; + std::basic_string s1{std::back_insert_iterator(s0), // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}} + std::back_insert_iterator(s0), + std::allocator{}}; + } + { // Not an allocator + const wchar_t* s = L"12345678901234"; + std::basic_string s1{s, s+10, NotAnAllocator{}}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}} + } + +} diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 1f8369689..00ac988bf 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -13,6 +13,18 @@ // basic_string(InputIterator begin, InputIterator end, // const Allocator& a = Allocator()); +// template::value_type>> +// basic_string(InputIterator, InputIterator, Allocator = Allocator()) +// -> basic_string::value_type, +// char_traits::value_type>, +// Allocator>; +// +// The deduction guide shall not participate in overload resolution if InputIterator +// is a type that does not qualify as an input iterator, or if Allocator is a type +// that does not qualify as an allocator. + + #include #include #include @@ -116,4 +128,48 @@ int main() test(input_iterator(s), input_iterator(s+50), A()); } #endif + +// Test deduction guides +#if TEST_STD_VER > 14 + { + const char* s = "12345678901234"; + std::basic_string s1{s, s+10, std::allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const wchar_t* s = L"12345678901234"; + std::basic_string s1{s, s+10, test_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char16_t* s = u"12345678901234"; + std::basic_string s1{s, s+10, min_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char32_t* s = U"12345678901234"; + std::basic_string s1{s, s+10, explicit_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } +#endif } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index c78cc7e6a..84bfd2878 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -150,7 +150,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -172,6 +172,7 @@
    Issue #Issue NameMeetingStatus
    2412promise::set_value() and promise::get_future() should not raceJacksonville
    2412promise::set_value() and promise::get_future() should not raceJacksonvilleComplete
    2682filesystem::copy() won't create a symlink to a directoryJacksonville
    2697[concurr.ts] Behavior of future/shared_future unwrapping constructor when given an invalid futureJacksonville
    2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonville
    P0298R3CWGA byte type definitionKonaComplete5.0
    P0317R1LWGDirectory Entry Caching for FilesystemKona
    P0430R2LWGFile system library on non-POSIX-like operating systemsKona
    P0433R2LWGToward a resolution of US7 and US14: Integrating template deduction for class templates into the standard libraryKona
    P0433R2LWGToward a resolution of US7 and US14: Integrating template deduction for class templates into the standard libraryKonaIn progress7.0
    P0452R1LWGUnifying <numeric> Parallel AlgorithmsKona
    P0467R2LWGIterator Concerns for Parallel AlgorithmsKona
    P0492R2LWGProposed Resolution of C++17 National Body Comments for FilesystemsKona
    P0574R1LWGAlgorithm Complexity Constraints and Parallel OverloadsKona
    P0599R1LWGnoexcept for hash functionsKonaComplete5.0
    P0604R0LWGResolving GB 55, US 84, US 85, US 86Kona
    P0607R0LWGInline Variables for the Standard LibraryKonaIn Progress6.0
    P0607R0LWGInline Variables for the Standard LibraryKonaIn Progress6.0
    P0618R0LWGDeprecating <codecvt>Kona
    P0623R0LWGFinal C++17 Parallel Algorithms FixesKona

    The parts of P0607 that are not done are the <regex> bits.

    +

    So far, only the <string> part of P0433 has been implemented.

    [ Note: "Nothing to do" means that no library changes were needed to implement this change -- end note]

    From 4c153004af3a23b6ce0a448f781edc16b77f6e90 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 07:20:45 +0000 Subject: [PATCH 0359/1520] Temporarily comment out deduction guide tests while I figure out what to do with old bots git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324573 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp | 1 + test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp index 3bc10e4ac..449b75d90 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp @@ -9,6 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: c++17 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 00ac988bf..9314ecb9a 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -129,6 +129,7 @@ int main() } #endif +#if 0 // Test deduction guides #if TEST_STD_VER > 14 { @@ -172,4 +173,5 @@ int main() assert(s1.compare(0, s1.size(), s, s1.size()) == 0); } #endif +#endif } From 171ed2198d74a9cc58a933a502c2c23378b4a631 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Thu, 8 Feb 2018 11:33:48 +0000 Subject: [PATCH 0360/1520] [libcxx] Avoid spurious construction of valarray elements Summary: Currently libc++ implements some operations on valarray by using the resize method. This method has a parameter with a default value. Because of this, valarray may spuriously construct and destruct objects of valarray's element type. This patch fixes this issue and adds corresponding test cases. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: rogfer01, cfe-commits Differential Revision: https://reviews.llvm.org/D41992 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324596 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/valarray | 79 ++++++++++++++----- .../valarray.assign/copy_assign.pass.cpp | 27 +++++++ .../initializer_list_assign.pass.cpp | 26 ++++++ .../valarray.cons/default.pass.cpp | 12 +++ .../valarray.cons/size.pass.cpp | 16 ++++ 5 files changed, 139 insertions(+), 21 deletions(-) diff --git a/include/valarray b/include/valarray index ee61238a9..b495ccf57 100644 --- a/include/valarray +++ b/include/valarray @@ -1053,6 +1053,9 @@ private: friend const _Up* end(const valarray<_Up>& __v); + + void __clear(); + valarray& __assign_range(const value_type* __f, const value_type* __l); }; _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray::valarray(size_t)) @@ -2750,7 +2753,24 @@ valarray<_Tp>::valarray(size_t __n) : __begin_(0), __end_(0) { - resize(__n); + if (__n) + { + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); +#ifndef _LIBCPP_NO_EXCEPTIONS + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + for (; __n; --__n, ++__end_) + ::new (__end_) value_type(); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + __clear(); + throw; + } +#endif // _LIBCPP_NO_EXCEPTIONS + } } template @@ -2780,7 +2800,7 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2805,7 +2825,7 @@ valarray<_Tp>::valarray(const valarray& __v) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2842,7 +2862,7 @@ valarray<_Tp>::valarray(initializer_list __il) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2870,7 +2890,7 @@ valarray<_Tp>::valarray(const slice_array& __sa) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2899,7 +2919,7 @@ valarray<_Tp>::valarray(const gslice_array& __ga) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2928,7 +2948,7 @@ valarray<_Tp>::valarray(const mask_array& __ma) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2957,7 +2977,7 @@ valarray<_Tp>::valarray(const indirect_array& __ia) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS @@ -2968,7 +2988,24 @@ template inline valarray<_Tp>::~valarray() { - resize(0); + __clear(); +} + +template +valarray<_Tp>& +valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) +{ + size_t __n = __l - __f; + if (size() != __n) + { + __clear(); + __begin_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __end_ = __begin_ + __n; + _VSTD::uninitialized_copy(__f, __l, __begin_); + } else { + _VSTD::copy(__f, __l, __begin_); + } + return *this; } template @@ -2976,11 +3013,7 @@ valarray<_Tp>& valarray<_Tp>::operator=(const valarray& __v) { if (this != &__v) - { - if (size() != __v.size()) - resize(__v.size()); - _VSTD::copy(__v.__begin_, __v.__end_, __begin_); - } + return __assign_range(__v.__begin_, __v.__end_); return *this; } @@ -2991,7 +3024,7 @@ inline valarray<_Tp>& valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT { - resize(0); + __clear(); __begin_ = __v.__begin_; __end_ = __v.__end_; __v.__begin_ = nullptr; @@ -3004,10 +3037,7 @@ inline valarray<_Tp>& valarray<_Tp>::operator=(initializer_list __il) { - if (size() != __il.size()) - resize(__il.size()); - _VSTD::copy(__il.begin(), __il.end(), __begin_); - return *this; + return __assign_range(__il.begin(), __il.end()); } #endif // _LIBCPP_CXX03_LANG @@ -3680,7 +3710,7 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const template void -valarray<_Tp>::resize(size_t __n, value_type __x) +valarray<_Tp>::__clear() { if (__begin_ != nullptr) { @@ -3689,6 +3719,13 @@ valarray<_Tp>::resize(size_t __n, value_type __x) _VSTD::__libcpp_deallocate(__begin_); __begin_ = __end_ = nullptr; } +} + +template +void +valarray<_Tp>::resize(size_t __n, value_type __x) +{ + __clear(); if (__n) { __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); @@ -3702,7 +3739,7 @@ valarray<_Tp>::resize(size_t __n, value_type __x) } catch (...) { - resize(0); + __clear(); throw; } #endif // _LIBCPP_NO_EXCEPTIONS diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp index 3803489c3..da1225ae0 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp @@ -17,6 +17,21 @@ #include #include +struct S +{ + S() : x_(0) { default_ctor_called = true; } + S(int x) : x_(x) {} + int x_; + static bool default_ctor_called; +}; + +bool S::default_ctor_called = false; + +bool operator==(const S& lhs, const S& rhs) +{ + return lhs.x_ == rhs.x_; +} + int main() { { @@ -56,4 +71,16 @@ int main() assert(v2[i][j] == v[i][j]); } } + { + typedef S T; + T a[] = {T(1), T(2), T(3), T(4), T(5)}; + const unsigned N = sizeof(a)/sizeof(a[0]); + std::valarray v(a, N); + std::valarray v2; + v2 = v; + assert(v2.size() == v.size()); + for (std::size_t i = 0; i < v2.size(); ++i) + assert(v2[i] == v[i]); + assert(!S::default_ctor_called); + } } diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp index 5122f44c3..7923b104b 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp @@ -19,6 +19,21 @@ #include #include +struct S +{ + S() : x_(0) { default_ctor_called = true; } + S(int x) : x_(x) {} + int x_; + static bool default_ctor_called; +}; + +bool S::default_ctor_called = false; + +bool operator==(const S& lhs, const S& rhs) +{ + return lhs.x_ == rhs.x_; +} + int main() { { @@ -55,4 +70,15 @@ int main() assert(v2[i][j] == a[i][j]); } } + { + typedef S T; + T a[] = {T(1), T(2), T(3), T(4), T(5)}; + const unsigned N = sizeof(a)/sizeof(a[0]); + std::valarray v2; + v2 = {T(1), T(2), T(3), T(4), T(5)}; + assert(v2.size() == N); + for (std::size_t i = 0; i < v2.size(); ++i) + assert(v2[i] == a[i]); + assert(!S::default_ctor_called); + } } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp index f46e0bf28..9933322de 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp @@ -16,6 +16,13 @@ #include #include +struct S { + S() { ctor_called = true; } + static bool ctor_called; +}; + +bool S::ctor_called = false; + int main() { { @@ -34,4 +41,9 @@ int main() std::valarray > v; assert(v.size() == 0); } + { + std::valarray v; + assert(v.size() == 0); + assert(!S::ctor_called); + } } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp index 359073eb3..221187c4e 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/size.pass.cpp @@ -16,6 +16,15 @@ #include #include +struct S { + S() : x(1) {} + ~S() { ++cnt_dtor; } + int x; + static size_t cnt_dtor; +}; + +size_t S::cnt_dtor = 0; + int main() { { @@ -36,4 +45,11 @@ int main() for (int i = 0; i < 100; ++i) assert(v[i].size() == 0); } + { + std::valarray v(100); + assert(v.size() == 100); + for (int i = 0; i < 100; ++i) + assert(v[i].x == 1); + } + assert(S::cnt_dtor == 100); } From 1a2caf573faa37a2935d6bc23390864920daba3f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 14:51:22 +0000 Subject: [PATCH 0361/1520] Update the status of removed components git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324609 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/TS_deprecation.html | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/www/TS_deprecation.html b/www/TS_deprecation.html index 75ca0e16a..a8dd8c183 100644 --- a/www/TS_deprecation.html +++ b/www/TS_deprecation.html @@ -48,22 +48,22 @@ - - - - + + + + - + - - - + + + - - - + + + @@ -77,9 +77,9 @@ - + - +
    SectionFeatureshipped in
    std
    To be removed from
    std::experimental
    Notes
    2.1uses_allocator construction
    5.0
    7.0
    3.1.2erased_type
    n/a
    Not part of C++17
    3.2.1tuple_size_v
    5.0
    7.0
    3.2.2apply
    5.0
    7.0
    3.3.1All of the '_v' traits in <type_traits>
    5.0
    7.0
    3.1.2erased_type
    n/a
    Not part of C++17
    3.2.1tuple_size_v
    5.0
    7.0
    Removed
    3.2.2apply
    5.0
    7.0
    Removed
    3.3.1All of the '_v' traits in <type_traits>
    5.0
    7.0
    Removed
    3.3.2invocation_type and raw_invocation_type
    n/a
    Not part of C++17
    3.3.3Logical operator traits
    5.0
    7.0
    3.3.3Logical operator traits
    5.0
    7.0
    Removed
    3.3.3Detection Idiom
    5.0
    Only partially in C++17
    3.4.1All of the '_v' traits in <ratio>
    5.0
    7.0
    3.5.1All of the '_v' traits in <chrono>
    5.0
    7.0
    3.6.1All of the '_v' traits in <system_error>
    5.0
    7.0
    3.4.1All of the '_v' traits in <ratio>
    5.0
    7.0
    Removed
    3.5.1All of the '_v' traits in <chrono>
    5.0
    7.0
    Removed
    3.6.1All of the '_v' traits in <system_error>
    5.0
    7.0
    Removed
    3.7propagate_const
    n/a
    Not part of C++17
    4.2Enhancements to function
    Not yet
    4.3searchers
    7.0
    9.0
    5optional
    5.0
    7.0
    6any
    5.0
    7.0
    7string_view
    5.0
    7.0
    5optional
    5.0
    7.0
    Removed
    6any
    5.0
    7.0
    Removed
    7string_view
    5.0
    7.0
    Removed
    8.2.1shared_ptr enhancements
    Not yet
    Never added
    8.2.2weak_ptr enhancements
    Not yet
    Never added
    8.5memory_resource
    Not yet
    11.2promise
    n/a
    Not part of C++17
    11.3packaged_task
    n/a
    Not part of C++17
    12.2search
    7.0
    9.0
    12.3sample
    5.0
    7.0
    12.3sample
    5.0
    7.0
    Removed
    12.4shuffleNot part of C++17
    13.1gcd and lcm
    5.0
    7.0
    13.1gcd and lcm
    5.0
    7.0
    Removed
    13.2Random number generationNot part of C++17
    14Reflection LibraryNot part of C++17
    @@ -132,7 +132,7 @@
    -

    Last Updated: 8-Jan-2018

    +

    Last Updated: 8-Feb-2018

    From 0eec3e8b246c845292546cc2a7ba4ca8256a45f0 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 16:25:57 +0000 Subject: [PATCH 0362/1520] Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324619 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.cons/iter_alloc.pass.cpp | 57 ------------- ...fail.cpp => iter_alloc_deduction.fail.cpp} | 2 +- .../string.cons/iter_alloc_deduction.pass.cpp | 82 +++++++++++++++++++ 3 files changed, 83 insertions(+), 58 deletions(-) rename test/std/strings/basic.string/string.cons/{iter_alloc.fail.cpp => iter_alloc_deduction.fail.cpp} (95%) create mode 100644 test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 9314ecb9a..e7fefacc0 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -13,17 +13,6 @@ // basic_string(InputIterator begin, InputIterator end, // const Allocator& a = Allocator()); -// template::value_type>> -// basic_string(InputIterator, InputIterator, Allocator = Allocator()) -// -> basic_string::value_type, -// char_traits::value_type>, -// Allocator>; -// -// The deduction guide shall not participate in overload resolution if InputIterator -// is a type that does not qualify as an input iterator, or if Allocator is a type -// that does not qualify as an allocator. - #include #include @@ -128,50 +117,4 @@ int main() test(input_iterator(s), input_iterator(s+50), A()); } #endif - -#if 0 -// Test deduction guides -#if TEST_STD_VER > 14 - { - const char* s = "12345678901234"; - std::basic_string s1{s, s+10, std::allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } - { - const wchar_t* s = L"12345678901234"; - std::basic_string s1{s, s+10, test_allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } - { - const char16_t* s = u"12345678901234"; - std::basic_string s1{s, s+10, min_allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } - { - const char32_t* s = U"12345678901234"; - std::basic_string s1{s, s+10, explicit_allocator{}}; - using S = decltype(s1); // what type did we get? - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v>, ""); - static_assert(std::is_same_v>, ""); - assert(s1.size() == 10); - assert(s1.compare(0, s1.size(), s, s1.size()) == 0); - } -#endif -#endif } diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp similarity index 95% rename from test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp rename to test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 449b75d90..56a7d4e5b 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: c++17 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp new file mode 100644 index 000000000..49b1cff82 --- /dev/null +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -0,0 +1,82 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 + +// template +// basic_string(InputIterator begin, InputIterator end, +// const Allocator& a = Allocator()); + +// template::value_type>> +// basic_string(InputIterator, InputIterator, Allocator = Allocator()) +// -> basic_string::value_type, +// char_traits::value_type>, +// Allocator>; +// +// The deduction guide shall not participate in overload resolution if InputIterator +// is a type that does not qualify as an input iterator, or if Allocator is a type +// that does not qualify as an allocator. + + +#include +#include +#include +#include + +#include "test_macros.h" +#include "test_allocator.h" +#include "../input_iterator.h" +#include "min_allocator.h" + +int main() +{ + { + const char* s = "12345678901234"; + std::basic_string s1{s, s+10, std::allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const wchar_t* s = L"12345678901234"; + std::basic_string s1{s, s+10, test_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char16_t* s = u"12345678901234"; + std::basic_string s1{s, s+10, min_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { + const char32_t* s = U"12345678901234"; + std::basic_string s1{s, s+10, explicit_allocator{}}; + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } +} From 88ba9758ff0a24aa4d911ec31c8d83c62bdf50b6 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 17:06:08 +0000 Subject: [PATCH 0363/1520] Once more, with feeling. Spell 'clang-4.0' correctly this time git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324624 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 2 +- .../basic.string/string.cons/iter_alloc_deduction.pass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 56a7d4e5b..a8e440bac 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index 49b1cff82..3200a02bd 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang.4-0 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 // template // basic_string(InputIterator begin, InputIterator end, From 5bfbd7daccd8e34a44c435379aaeab7568b583e8 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Feb 2018 19:33:03 +0000 Subject: [PATCH 0364/1520] The apple versions of clang don't support deduction guides yet. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324640 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 1 + .../basic.string/string.cons/iter_alloc_deduction.pass.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index a8e440bac..65aba0493 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -10,6 +10,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 // template::value_type>> diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index 3200a02bd..a6c458c0e 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -10,6 +10,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 // template // basic_string(InputIterator begin, InputIterator end, From 9e6ac074eef0d9e96c578d1a08fbff12d5484203 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 10 Feb 2018 02:53:47 +0000 Subject: [PATCH 0365/1520] Use multi-key tree search for {map, set}::{count, equal_range} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch from ngolovliov@gmail.com Reviewed as: https://reviews.llvm.org/D42344 As described in llvm.org/PR30959, the current implementation of std::{map, key}::{count, equal_range} in libcxx is non-conforming. Quoting the C++14 standard [associative.reqmts]p3 > The phrase “equivalence of keys” means the equivalence relation imposed by > the comparison and not the operator== on keys. That is, two keys k1 and k2 are > considered to be equivalent if for the comparison object comp, > comp(k1, k2) == false && comp(k2, k1) == false. In the same section, the requirements table states the following: > a.equal_range(k) equivalent to make_pair(a.lower_bound(k), a.upper_bound(k)) > a.count(k) returns the number of elements with key equivalent to k The behaviour of libstdc++ seems to conform to the standard here. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324799 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/map | 6 +- include/set | 6 +- .../map/map.ops/count_transparent.pass.cpp | 50 ++++++++++++++++ .../map.ops/equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ .../multimap.ops/count_transparent.pass.cpp | 50 ++++++++++++++++ .../equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ .../multiset/count_transparent.pass.cpp | 51 ++++++++++++++++ .../multiset/equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ .../set/count_transparent.pass.cpp | 51 ++++++++++++++++ .../set/equal_range_transparent.pass.cpp | 60 +++++++++++++++++++ 10 files changed, 448 insertions(+), 6 deletions(-) create mode 100644 test/std/containers/associative/map/map.ops/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp create mode 100644 test/std/containers/associative/multiset/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/multiset/equal_range_transparent.pass.cpp create mode 100644 test/std/containers/associative/set/count_transparent.pass.cpp create mode 100644 test/std/containers/associative/set/equal_range_transparent.pass.cpp diff --git a/include/map b/include/map index 952149389..8a722606f 100644 --- a/include/map +++ b/include/map @@ -1228,7 +1228,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) const {return __tree_.__count_unique(__k);} + count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -1275,11 +1275,11 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif private: diff --git a/include/set b/include/set index a9d102f85..94db8c79d 100644 --- a/include/set +++ b/include/set @@ -668,7 +668,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) const {return __tree_.__count_unique(__k);} + count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -715,11 +715,11 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type - equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif }; diff --git a/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp b/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp new file mode 100644 index 000000000..899757e54 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class map + +// template +// size_type count(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::map, int, Comp> s{ + {{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..cce90c695 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class map + +// template +// pair equal_range(const K& x); // C++14 +// template +// pair equal_range(const K& x) const; +// // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::map, int, Comp> s{ + {{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first.first == 1); + nels++; + } + + assert(nels == 3); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp new file mode 100644 index 000000000..a1dbf806a --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class multimap + +// template +// size_type count(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multimap, int, Comp> s{ + {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..2b199d23c --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class multimap + +// template +// pair equal_range(const K& x); // C++14 +// template +// pair equal_range(const K& x) const; +// // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multimap, int, Comp> s{ + {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first.first == 1); + nels++; + } + + assert(nels == 3); +} diff --git a/test/std/containers/associative/multiset/count_transparent.pass.cpp b/test/std/containers/associative/multiset/count_transparent.pass.cpp new file mode 100644 index 000000000..9ef223345 --- /dev/null +++ b/test/std/containers/associative/multiset/count_transparent.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class multiset + +// template +// iterator lower_bound(const K& x); // C++14 +// template +// const_iterator lower_bound(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multiset, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp b/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..ffd87acfd --- /dev/null +++ b/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class multiset + +// template +// pair equal_range(const K& x); // +// C++14 +// template +// pair equal_range(const K& x) const; // +// C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::multiset, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first == 1); + nels++; + } + + assert(nels == 3); +} diff --git a/test/std/containers/associative/set/count_transparent.pass.cpp b/test/std/containers/associative/set/count_transparent.pass.cpp new file mode 100644 index 000000000..26908eacd --- /dev/null +++ b/test/std/containers/associative/set/count_transparent.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class set + +// template +// iterator lower_bound(const K& x); // C++14 +// template +// const_iterator lower_bound(const K& x) const; // C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}}; + + auto cnt = s.count(1); + assert(cnt == 3); +} diff --git a/test/std/containers/associative/set/equal_range_transparent.pass.cpp b/test/std/containers/associative/set/equal_range_transparent.pass.cpp new file mode 100644 index 000000000..88030847a --- /dev/null +++ b/test/std/containers/associative/set/equal_range_transparent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// class set + +// template +// pair equal_range(const K& x); // +// C++14 +// template +// pair equal_range(const K& x) const; // +// C++14 + +#include +#include +#include + +#include "min_allocator.h" +#include "private_constructor.hpp" +#include "test_macros.h" + +struct Comp { + using is_transparent = void; + + bool operator()(const std::pair &lhs, + const std::pair &rhs) const { + return lhs < rhs; + } + + bool operator()(const std::pair &lhs, int rhs) const { + return lhs.first < rhs; + } + + bool operator()(int lhs, const std::pair &rhs) const { + return lhs < rhs.first; + } +}; + +int main() { + std::set, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}}; + + auto er = s.equal_range(1); + long nels = 0; + + for (auto it = er.first; it != er.second; it++) { + assert(it->first == 1); + nels++; + } + + assert(nels == 3); +} From a8de0635685fd67ca740bb5f093bc9a23cae7263 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 11 Feb 2018 21:51:49 +0000 Subject: [PATCH 0366/1520] Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324851 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/utility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/utility b/include/utility index 535e3cb3a..f11d58019 100644 --- a/include/utility +++ b/include/utility @@ -52,7 +52,7 @@ template >::type move_if_noexcept(T& x) noexcept; // constexpr in C++14 -template constexpr add_const_t& as_const(T& t) noexcept; // C++17 +template constexpr add_const_t& as_const(T& t) noexcept; // C++17 template void as_const(const T&&) = delete; // C++17 template typename add_rvalue_reference::type declval() noexcept; From 0fc3d1264c6ae49b04718cce91c829cd4926b53d Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 11 Feb 2018 21:57:25 +0000 Subject: [PATCH 0367/1520] Mark two issues as complete git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324852 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index 88d2d9d30..fa2b259ed 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -98,9 +98,9 @@ - + - +
    Issue #Issue NameMeetingStatus
    2412promise::set_value() and promise::get_future() should not raceJacksonvilleComplete
    2682filesystem::copy() won't create a symlink to a directoryJacksonville
    2682filesystem::copy() won't create a symlink to a directoryJacksonvilleComplete
    2697[concurr.ts] Behavior of future/shared_future unwrapping constructor when given an invalid futureJacksonville
    2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonville
    2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonvilleComplete
    2936Path comparison is defined in terms of the generic formatJacksonville
    @@ -144,9 +144,9 @@

    Comments about the "Review" issues

    • 2412 - I think we do this already
    • -
    • 2682 - Eric - don't we do this already?
    • +
    • 2682 - We already to this
    • 2697 - No concurrency TS implementation yet
    • -
    • 2708 - Eric?
    • +
    • 2708 - We already do this
    • 2936 - Eric - don't we do this already?
    From 22a291c94e4994b35d6fb307796dfa4864690302 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 11 Feb 2018 22:00:19 +0000 Subject: [PATCH 0368/1520] Fix libcxx MSVC C++17 redefinition of 'align_val_t' Patch from charlieio@outlook.com Reviewed as https://reviews.llvm.org/D42354 When the following command is used: > clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib An error occurred: In file included from hello.cc:1: In file included from include\c++\v1\iostream:38: In file included from include\c++\v1\ios:216: In file included from include\c++\v1\__locale:15: In file included from include\c++\v1\string:477: In file included from include\c++\v1\string_view:176: In file included from include\c++\v1\__string:56: In file included from include\c++\v1\algorithm:643: In file included from include\c++\v1\memory:656: include\c++\v1\new(165,29): error: redefinition of 'align_val_t' enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; ^ C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16): note: previous definition is here enum class align_val_t : size_t {}; ^ 1 error generated. vcruntime_new.h has defined align_val_t, libcxx need hide align_val_t. This patch fixes that error. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324853 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/new | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/new b/include/new index 4e527501b..27c248c83 100644 --- a/include/new +++ b/include/new @@ -160,6 +160,7 @@ public: #endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) +#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME) #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14 #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; @@ -167,6 +168,7 @@ enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif +#endif } // std From 524afaedd1c1f7e172c9b04aa54326e03a801d99 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 11 Feb 2018 22:31:05 +0000 Subject: [PATCH 0369/1520] Add default C++ ABI libname and include paths for FreeBSD Summary: As noted in a discussion about testing the LLVM 6.0.0 release candidates (with libc++) for FreeBSD, many tests turned out to fail with "exception_ptr not yet implemented". This was because libc++ did not choose the correct C++ ABI library, and therefore it fell back to the `exception_fallback.ipp` header. Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library, and its headers have always been installed in /usr/include/c++/v1, together with the (system) libc++ headers. (Older versions of FreeBSD used GNU libsupc++ by default, but these are now unsupported.) Therefore, if we are building libc++ for FreeBSD, set: * `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt" * `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1" by default. Reviewers: emaste, EricWF, mclow.lists Reviewed By: EricWF Subscribers: mgorny, cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D43166 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324855 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b27db2c6..bfaed58ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,9 @@ if (LIBCXX_CXX_ABI STREQUAL "default") elseif (APPLE) set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_SYSTEM 1) + elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt") + set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1") else() set(LIBCXX_CXX_ABI_LIBNAME "default") endif() From b8cb776511a38502d1ab7b045155c76ca61beeaa Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 12 Feb 2018 15:41:25 +0000 Subject: [PATCH 0370/1520] While implementing P0777 - preventing unnecessary decay, I found some non-public uses of decay that could be replaced by __uncvref. NFC intented git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324895 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/functional | 8 ++++---- include/variant | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/experimental/functional b/include/experimental/functional index a136cbb57..f63dfb07b 100644 --- a/include/experimental/functional +++ b/include/experimental/functional @@ -241,8 +241,8 @@ public: operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { static_assert ( std::is_same< - typename std::decay::value_type>::type, - typename std::decay::value_type>::type + typename std::__uncvref::value_type>::type, + typename std::__uncvref::value_type>::type >::value, "Corpus and Pattern iterators must point to the same type" ); @@ -394,8 +394,8 @@ public: operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { static_assert ( std::is_same< - typename std::decay::value_type>::type, - typename std::decay::value_type>::type + typename std::__uncvref::value_type>::type, + typename std::__uncvref::value_type>::type >::value, "Corpus and Pattern iterators must point to the same type" ); diff --git a/include/variant b/include/variant index 63c7677c5..f9098f422 100644 --- a/include/variant +++ b/include/variant @@ -476,8 +476,8 @@ private: template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_farray(_Fs&&... __fs) { - __std_visit_visitor_return_type_check...>(); - using __result = array...>, sizeof...(_Fs)>; + __std_visit_visitor_return_type_check<__uncvref_t<_Fs>...>(); + using __result = array...>, sizeof...(_Fs)>; return __result{{_VSTD::forward<_Fs>(__fs)...}}; } @@ -514,8 +514,8 @@ private: template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal() { - constexpr size_t _Np = decay_t<_Vp>::__size(); - static_assert(__all<(_Np == decay_t<_Vs>::__size())...>::value); + constexpr size_t _Np = __uncvref_t<_Vp>::__size(); + static_assert(__all<(_Np == __uncvref_t<_Vs>::__size())...>::value); return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{}); } @@ -538,7 +538,7 @@ private: inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fmatrix() { return __make_fmatrix_impl<_Fp, _Vs...>( - index_sequence<>{}, make_index_sequence::__size()>{}...); + index_sequence<>{}, make_index_sequence<__uncvref_t<_Vs>::__size()>{}...); } }; @@ -756,7 +756,7 @@ _LIBCPP_VARIANT_DESTRUCTOR( if (!this->valueless_by_exception()) { __visitation::__base::__visit_alt( [](auto& __alt) noexcept { - using __alt_type = decay_t; + using __alt_type = __uncvref_t; __alt.~__alt_type(); }, *this); @@ -1564,7 +1564,7 @@ struct _LIBCPP_TEMPLATE_VIS hash< ? 299792458 // Random value chosen by the universe upon creation : __variant::__visit_alt( [](const auto& __alt) { - using __alt_type = decay_t; + using __alt_type = __uncvref_t; using __value_type = remove_const_t< typename __alt_type::__value_type>; return hash<__value_type>{}(__alt.__value); From f72f21907c21b0d17860a3ba07397f0f57e9983c Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 12 Feb 2018 17:26:40 +0000 Subject: [PATCH 0371/1520] Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324911 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/memory | 5 +++++ www/cxx1z_status.html | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/memory b/include/memory index 2d9d75f99..bc5c4c653 100644 --- a/include/memory +++ b/include/memory @@ -4805,8 +4805,13 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { +#if _LIBCPP_STD_VER <= 11 typedef typename common_type<_Tp*, _Up*>::type _Vp; return less<_Vp>()(__x.get(), __y.get()); +#else + return less<>()(__x.get(), __y.get()); +#endif + } template diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 84bfd2878..e4f624634 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -483,13 +483,13 @@ 2874Constructor shared_ptr::shared_ptr(Y*) should be constrainedKona 2875shared_ptr::shared_ptr(Y*, D, […]) constructors should be constrainedKona 2876shared_ptr::shared_ptr(const weak_ptr<Y>&) constructor should be constrainedKona - 2878Missing DefaultConstructible requirement for istream_iterator default constructorKona + 2878Missing DefaultConstructible requirement for istream_iterator default constructorKonaComplete 2890The definition of 'object state' applies only to class typesKonaComplete 2900The copy and move constructors of optional are not constexprKonaComplete 2903The form of initialization for the emplace-constructors is not specifiedKonaComplete 2904Make variant move-assignment more exception safeKonaComplete 2905is_constructible_v<unique_ptr<P, D>, P, D const &> should be false when D is not copy constructibleKonaComplete - 2908The less-than operator for shared pointers could do moreKona + 2908The less-than operator for shared pointers could do moreKonaComplete 2911An is_aggregate type trait is neededKonaComplete 2921packaged_task and type-erased allocatorsKonaComplete 2934optional<const T> doesn't compare with TKonaComplete @@ -504,7 +504,7 @@ -

    Last Updated: 25-Jan-2018

    +

    Last Updated: 12-Feb-2018

    From 806a6ec6450851e2964832c9e70358e4cddcd88d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 12 Feb 2018 19:13:24 +0000 Subject: [PATCH 0372/1520] Implement LWG 2835 - fix git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324923 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/tgmath.h | 16 ++++++++++++---- www/cxx1z_status.html | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/tgmath.h b/include/tgmath.h index fbe1e8248..aba87499c 100644 --- a/include/tgmath.h +++ b/include/tgmath.h @@ -14,16 +14,24 @@ /* tgmath.h synopsis -#include -#include +#include */ -#include -#include +#include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +#ifdef __cplusplus + +#include + +#else // __cplusplus + +#include_next + +#endif // __cplusplus + #endif // _LIBCPP_TGMATH_H diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index e4f624634..5cead9b1c 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -467,7 +467,7 @@ 2824list::sort should say that the order of elements is unspecified if an exception is thrownKonaComplete 2826string_view iterators use old wordingKonaComplete 2834Resolution LWG 2223 is missing wording about end iteratorsKonaComplete - 2835LWG 2536 seems to misspecify <tgmath.h>Kona + 2835LWG 2536 seems to misspecify <tgmath.h>KonaComplete 2837gcd and lcm should support a wider range of input valuesKonaComplete 2838is_literal_type specification needs a little cleanupKonaComplete 2842in_place_t check for optional::optional(U&&) should decay UKonaComplete From a2b7665eb2e8ad9469a63e29dac9ae546aafdb2f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 12 Feb 2018 22:54:35 +0000 Subject: [PATCH 0373/1520] [libcxx] [test] Strip trailing whitespace, NFC. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324959 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../alg.modifying.operations/alg.copy/copy.pass.cpp | 4 ++-- .../alg.copy/copy_backward.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.copy/copy_if.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.copy/copy_n.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.fill/fill.pass.cpp | 2 +- .../alg.modifying.operations/alg.fill/fill_n.pass.cpp | 2 +- .../alg.generate/generate.pass.cpp | 2 +- .../alg.generate/generate_n.pass.cpp | 2 +- .../alg.partitions/partition_copy.pass.cpp | 4 ++-- .../alg.modifying.operations/alg.remove/remove.pass.cpp | 2 +- .../alg.remove/remove_copy.pass.cpp | 2 +- .../alg.remove/remove_copy_if.pass.cpp | 2 +- .../alg.remove/remove_if.pass.cpp | 2 +- .../alg.replace/replace_copy.pass.cpp | 2 +- .../alg.replace/replace_copy_if.pass.cpp | 2 +- .../alg.reverse/reverse_copy.pass.cpp | 2 +- .../alg.rotate/rotate_copy.pass.cpp | 4 ++-- .../alg.transform/binary_transform.pass.cpp | 6 +++--- .../alg.transform/unary_transform.pass.cpp | 2 +- .../alg.modifying.operations/alg.unique/unique.pass.cpp | 2 +- .../alg.nonmodifying/alg.find.end/find_end.pass.cpp | 2 +- .../alg.find.first.of/find_first_of.pass.cpp | 2 +- .../alg.nonmodifying/alg.foreach/for_each_n.pass.cpp | 2 +- .../alg.nonmodifying/mismatch/mismatch.pass.cpp | 6 +++--- .../alg.nonmodifying/mismatch/mismatch_pred.pass.cpp | 6 +++--- test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp | 2 +- .../algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp | 4 ++-- .../alg.set.operations/includes/includes.pass.cpp | 2 +- .../alg.set.operations/includes/includes_comp.pass.cpp | 2 +- .../set.intersection/set_intersection.pass.cpp | 2 +- .../set.intersection/set_intersection_comp.pass.cpp | 2 +- .../container.adaptors/queue/queue.defn/emplace.pass.cpp | 4 ++-- .../container.adaptors/stack/stack.defn/emplace.pass.cpp | 4 ++-- .../containers/sequences/list/list.ops/sort_comp.pass.cpp | 8 ++++---- test/std/strings/string.view/types.pass.cpp | 2 +- test/std/utilities/meta/meta.type.synop/endian.pass.cpp | 4 ++-- test/std/utilities/utility/exchange/exchange.pass.cpp | 4 ++-- 37 files changed, 57 insertions(+), 57 deletions(-) diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp index 7f75e011b..57aa11e56 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp @@ -23,11 +23,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 2, 3, 4, 5}; // int ic[] = {6, 6, 6, 6, 6, 6, 6}; -// +// // auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic)); // return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p) // && std::all_of(p, std::end(ic), [](int a){return a == 6;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp index 418535457..aaad25f70 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp @@ -25,12 +25,12 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 2, 3, 4, 5}; // int ic[] = {6, 6, 6, 6, 6, 6, 6}; -// +// // size_t N = std::size(ia); // auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N); // return std::equal(std::begin(ic), p, std::begin(ia)) // && std::all_of(p, std::end(ic), [](int a){return a == 6;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp index ae94ab433..2ec832546 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp @@ -25,11 +25,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {2, 4, 6, 8, 6}; // int ic[] = {0, 0, 0, 0, 0, 0}; -// +// // auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6); // return std::all_of(std::begin(ic), p, [](int a){return a == 6;}) // && std::all_of(p, std::end(ic), [](int a){return a == 0;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp index 24e5577b0..a268cd90f 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp @@ -24,11 +24,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 2, 3, 4, 5}; // int ic[] = {6, 6, 6, 6, 6, 6, 6}; -// +// // auto p = std::copy_n(std::begin(ia), 4, std::begin(ic)); // return std::equal(std::begin(ic), p, std::begin(ia)) // && std::all_of(p, std::end(ic), [](int a){return a == 6;}) -// ; +// ; // } // #endif diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp index 8b9e109d7..1c08fee40 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp @@ -25,7 +25,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {0, 1, 2, 3, 4}; std::fill(std::begin(ia), std::end(ia), 5); - + return std::all_of(std::begin(ia), std::end(ia), [](int a) {return a == 5; }) ; } diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp index fea7165af..1e962990b 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp @@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() { const size_t N = 5; int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N - auto it = std::fill_n(std::begin(ib), N, 5); + auto it = std::fill_n(std::begin(ib), N, 5); return it == (std::begin(ib) + N) && std::all_of(std::begin(ib), it, [](int a) {return a == 5; }) && *it == 0 // don't overwrite the last value in the output array diff --git a/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp index 8be501c27..1b1562866 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp @@ -32,7 +32,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {0, 1, 2, 3, 4}; std::generate(std::begin(ia), std::end(ia), gen_test()); - + return std::all_of(std::begin(ia), std::end(ia), [](int x) { return x == 1; }) ; } diff --git a/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp index 98b7bea65..361324439 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp @@ -38,7 +38,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N auto it = std::generate_n(std::begin(ib), N, gen_test()); - + return it == (std::begin(ib) + N) && std::all_of(std::begin(ib), it, [](int x) { return x == 2; }) && *it == 0 // don't overwrite the last value in the output array diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp index 0fd24c1c3..9738fef35 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp @@ -32,8 +32,8 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 4, 6}; int r1[10] = {0}; int r2[10] = {0}; - - auto p = std::partition_copy(std::begin(ia), std::end(ia), + + auto p = std::partition_copy(std::begin(ia), std::end(ia), std::begin(r1), std::begin(r2), is_odd()); return std::all_of(std::begin(r1), p.first, is_odd()) diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp index 557984f39..70b3316d3 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp @@ -25,7 +25,7 @@ #if TEST_STD_VER > 17 TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; - + auto it = std::remove(std::begin(ia), std::end(ia), 5); return (std::begin(ia) + std::size(ia) - 2) == it // we removed two elements diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp index ae7b34184..4ace1494d 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy.pass.cpp @@ -24,7 +24,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; int ib[std::size(ia)] = {0}; - + auto it = std::remove_copy(std::begin(ia), std::end(ia), std::begin(ib), 5); return std::distance(std::begin(ib), it) == (std::size(ia) - 2) // we removed two elements diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp index 111c59eb7..c13788690 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool equalToTwo(int v) { return v == 2; } TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; int ib[std::size(ia)] = {0}; - + auto it = std::remove_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo); return std::distance(std::begin(ib), it) == (std::size(ia) - 1) // we removed one element diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp index d8123ee45..7a0f3405c 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp @@ -29,7 +29,7 @@ TEST_CONSTEXPR bool equal2 ( int i ) { return i == 2; } #if TEST_STD_VER > 17 TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; - + auto it = std::remove_if(std::begin(ia), std::end(ia), equal2); return (std::begin(ia) + std::size(ia) - 1) == it // we removed one element diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp index aad7f9f92..32be4e5bc 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp @@ -31,7 +31,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int expected[] = {0, 1, 5, 3, 4}; auto it = std::replace_copy(std::begin(ia), std::end(ia), std::begin(ib), 2, 5); - + return it == (std::begin(ib) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(ib), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp index 6ba74ff07..3d9a5bb73 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp @@ -34,7 +34,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int expected[] = {0, 1, 5, 3, 4}; auto it = std::replace_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo, 5); - + return it == (std::begin(ib) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(ib), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp index ec9aa9e94..e5aa427b9 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp @@ -23,7 +23,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 5, 2, 5, 6}; int ib[std::size(ia)] = {0}; - + auto it = std::reverse_copy(std::begin(ia), std::end(ia), std::begin(ib)); return std::distance(std::begin(ib), it) == std::size(ia) diff --git a/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp index 2294c79b5..e0e096a6f 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp @@ -23,11 +23,11 @@ // TEST_CONSTEXPR bool test_constexpr() { // int ia[] = {1, 3, 5, 2, 5, 6}; // int ib[std::size(ia)] = {0}; -// +// // const size_t N = 2; // const auto middle = std::begin(ia) + N; // auto it = std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib)); -// +// // return std::distance(std::begin(ib), it) == std::size(ia) // && std::equal (std::begin(ia), middle, std::begin(ib) + std::size(ia) - N) // && std::equal (middle, std::end(ia), std::begin(ib)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp index 27d3a968a..b2b894912 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp @@ -28,10 +28,10 @@ TEST_CONSTEXPR bool test_constexpr() { const int ib[] = {2, 4, 7, 8}; int ic[] = {0, 0, 0, 0, 0}; // one bigger const int expected[] = {3, 7, 13, 15}; - - auto it = std::transform(std::begin(ia), std::end(ia), + + auto it = std::transform(std::begin(ia), std::end(ia), std::begin(ib), std::begin(ic), std::plus()); - + return it == (std::begin(ic) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(expected), std::end(expected), std::begin(ic), it) diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp index b6f9cbad0..a929291ad 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp @@ -32,7 +32,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int expected[] = {2, 4, 7, 8}; auto it = std::transform(std::begin(ia), std::end(ia), std::begin(ib), plusOne); - + return it == (std::begin(ib) + std::size(ia)) && *it == 0 // don't overwrite the last value in the output array && std::equal(std::begin(ib), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp index 1c25b4808..b61196c9d 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp @@ -27,7 +27,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {0, 1, 1, 3, 4}; const int expected[] = {0, 1, 3, 4}; const size_t N = 4; - + auto it = std::unique(std::begin(ia), std::end(ia)); return it == (std::begin(ia) + N) && std::equal(std::begin(ia), it, std::begin(expected), std::end(expected)) diff --git a/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp index bc5d50cd5..afcf27b55 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() { typedef forward_iterator FI; typedef bidirectional_iterator BI; typedef random_access_iterator RI; - + return (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+15)) && (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic))) && (std::find_end(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+15)) diff --git a/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp index bd9297490..2212285ae 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of.pass.cpp @@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() { typedef forward_iterator FI; typedef bidirectional_iterator BI; typedef random_access_iterator RI; - + return (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+1)) && (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic))) && (std::find_first_of(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+1)) diff --git a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp index b2db22b1e..6c6824faf 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp @@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 3, 6, 7}; int expected[] = {3, 5, 8, 9}; const size_t N = 4; - + auto it = std::for_each_n(std::begin(ia), N, [](int &a) { a += 2; }); return it == (std::begin(ia) + N) && std::equal(std::begin(ia), std::end(ia), std::begin(expected)) diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp index fd83cbcb4..4b5ddb191 100644 --- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp @@ -35,11 +35,11 @@ TEST_CONSTEXPR bool test_constexpr() { auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic)); if (p1.first != ia+2 || p1.second != ic+2) return false; - + auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic)); if (p2.first != ia+2 || p2.second != ic+2) return false; - + auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic)); if (p3.first != ib+2 || p3.second != ic+2) return false; @@ -55,7 +55,7 @@ TEST_CONSTEXPR bool test_constexpr() { if (p6.first != BI(ib+2) || p6.second != BI(ic+2)) return false; - return true; + return true; } #endif diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp index 490309a81..ed9ba055a 100644 --- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp @@ -40,11 +40,11 @@ TEST_CONSTEXPR bool test_constexpr() { auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), eq); if (p1.first != ia+2 || p1.second != ic+2) return false; - + auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), eq); if (p2.first != ia+2 || p2.second != ic+2) return false; - + auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic), eq); if (p3.first != ib+2 || p3.second != ic+2) return false; @@ -60,7 +60,7 @@ TEST_CONSTEXPR bool test_constexpr() { if (p6.first != BI(ib+2) || p6.second != BI(ic+2)) return false; - return true; + return true; } #endif diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp index 9f70428f9..a42936124 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp @@ -32,7 +32,7 @@ // int ib[] = {2, 4, 6, 8}; // int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8}; -// +// // auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(ic)); // return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib)) // && *it == 0 diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp index 3d2bbfb14..1506a8cd5 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp @@ -35,8 +35,8 @@ // int ib[] = {2, 4, 6, 8}; // int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8}; -// -// auto it = std::merge(std::begin(ia), std::end(ia), +// +// auto it = std::merge(std::begin(ia), std::end(ia), // std::begin(ib), std::end(ib), // std::begin(ic), [](int a, int b) {return a == b; }); // return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib)) diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp index 60a5d2bd7..ca1b42251 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp @@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; int ib[] = {2, 4}; int ic[] = {3, 3, 3, 3}; - + return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib)) && !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic)) ; diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp index 82cf043d3..06192f93b 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp @@ -27,7 +27,7 @@ TEST_CONSTEXPR bool test_constexpr() { int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; int ib[] = {2, 4}; int ic[] = {3, 3, 3, 3}; - + auto comp = [](int a, int b) {return a < b; }; return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), comp) && !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), comp) diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp index 96a1eae8d..8d18027ee 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp @@ -29,7 +29,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; const int ib[] = {2, 4, 4, 6}; int results[std::size(ia)] = {0}; - + auto it = std::set_intersection(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(results)); diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp index 75316921c..6b0cfe168 100644 --- a/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp @@ -31,7 +31,7 @@ TEST_CONSTEXPR bool test_constexpr() { const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}; const int ib[] = {2, 4, 4, 6}; int results[std::size(ia)] = {0}; - + auto comp = [](int a, int b) {return a < b; }; auto it = std::set_intersection(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(results), comp); diff --git a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp index e338c99fd..bcf5fb695 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp @@ -29,7 +29,7 @@ void test_return_type() { typedef typename Queue::container_type Container; typedef typename Container::value_type value_type; typedef decltype(std::declval().emplace(std::declval())) queue_return_type; - + #if TEST_STD_VER > 14 typedef decltype(std::declval().emplace_back(std::declval())) container_return_type; static_assert(std::is_same::value, ""); @@ -42,7 +42,7 @@ int main() { test_return_type > (); test_return_type > > (); - + typedef Emplaceable T; std::queue q; #if TEST_STD_VER > 14 diff --git a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp index 0fec47558..bb6ff8f91 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp @@ -28,7 +28,7 @@ void test_return_type() { typedef typename Stack::container_type Container; typedef typename Container::value_type value_type; typedef decltype(std::declval().emplace(std::declval())) stack_return_type; - + #if TEST_STD_VER > 14 typedef decltype(std::declval().emplace_back(std::declval())) container_return_type; static_assert(std::is_same::value, ""); @@ -43,7 +43,7 @@ int main() test_return_type > > (); typedef Emplaceable T; - std::stack q; + std::stack q; #if TEST_STD_VER > 14 T& r1 = q.emplace(1, 2.5); assert(&r1 == &q.top()); diff --git a/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp b/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp index c8966f6fc..33f2fab0d 100644 --- a/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp +++ b/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp @@ -24,18 +24,18 @@ template struct throwingLess { throwingLess() : num_(1) {} throwingLess(int num) : num_(num) {} - + bool operator() (const T& lhs, const T& rhs) const { if ( --num_ == 0) throw 1; return lhs < rhs; } - + mutable int num_; }; #endif - - + + int main() { { diff --git a/test/std/strings/string.view/types.pass.cpp b/test/std/strings/string.view/types.pass.cpp index 68bbc29b9..00f4d60ee 100644 --- a/test/std/strings/string.view/types.pass.cpp +++ b/test/std/strings/string.view/types.pass.cpp @@ -28,7 +28,7 @@ // using size_type = size_t; // using difference_type = ptrdiff_t; // static constexpr size_type npos = size_type(-1); -// +// // }; #include diff --git a/test/std/utilities/meta/meta.type.synop/endian.pass.cpp b/test/std/utilities/meta/meta.type.synop/endian.pass.cpp index c71229caf..cf0ab2d26 100644 --- a/test/std/utilities/meta/meta.type.synop/endian.pass.cpp +++ b/test/std/utilities/meta/meta.type.synop/endian.pass.cpp @@ -33,9 +33,9 @@ int main() { static_assert( std::endian::little != std::endian::big ); // Technically not required, but true on all existing machines - static_assert( std::endian::native == std::endian::little || + static_assert( std::endian::native == std::endian::little || std::endian::native == std::endian::big ); - + // Try to check at runtime { uint32_t i = 0x01020304; diff --git a/test/std/utilities/utility/exchange/exchange.pass.cpp b/test/std/utilities/utility/exchange/exchange.pass.cpp index 0e5de039d..1a5007ea4 100644 --- a/test/std/utilities/utility/exchange/exchange.pass.cpp +++ b/test/std/utilities/utility/exchange/exchange.pass.cpp @@ -25,13 +25,13 @@ #if TEST_STD_VER > 17 TEST_CONSTEXPR bool test_constexpr() { int v = 12; - + if (12 != std::exchange(v,23) || v != 23) return false; if (23 != std::exchange(v,static_cast(67)) || v != 67) return false; - + if (67 != std::exchange(v, {}) || v != 0) return false; return true; From e89a34f66a654ff47fbcce504237e05b01a1c1a5 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 13 Feb 2018 08:12:00 +0000 Subject: [PATCH 0374/1520] Fix typos. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43224 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324989 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/DesignDocs/AvailabilityMarkup.rst | 2 +- docs/DesignDocs/CapturingConfigInfo.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/DesignDocs/AvailabilityMarkup.rst b/docs/DesignDocs/AvailabilityMarkup.rst index 4a85c698f..b8b445097 100644 --- a/docs/DesignDocs/AvailabilityMarkup.rst +++ b/docs/DesignDocs/AvailabilityMarkup.rst @@ -58,7 +58,7 @@ Testing Some parameters can be passed to lit to run the test-suite and exercising the availability. -* The `platform` parameter controls the deployement target. For example lit can +* The `platform` parameter controls the deployment target. For example lit can be invoked with `--param=platform=macosx10.8`. Default is the current host. * The `use_system_cxx_lib` parameter indicates to use another library than the just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run diff --git a/docs/DesignDocs/CapturingConfigInfo.rst b/docs/DesignDocs/CapturingConfigInfo.rst index 73378a21c..88102251d 100644 --- a/docs/DesignDocs/CapturingConfigInfo.rst +++ b/docs/DesignDocs/CapturingConfigInfo.rst @@ -46,7 +46,7 @@ we do NOTHING. Otherwise we create a custom installation rule that modifies the installed __config header. The rule first generates a dummy "__config_site" header containing the required -#defines. The contents of the dummy header are then prependend to the installed +#defines. The contents of the dummy header are then prepended to the installed __config header. By manually prepending the files we avoid the cost of an extra #include and we allow the __config header to be ignorant of the extra configuration all together. An example "__config" header generated when From 52474820e4090e6f84c08d89e5bbe313708f972e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 13 Feb 2018 17:40:59 +0000 Subject: [PATCH 0375/1520] Put type attributes after class keyword Summary: Compiling `` in C++17 or higher mode results in: ``` functional:2500:1: warning: attribute '__visibility__' is ignored, place it after "class" to apply attribute to type declaration [-Wignored-attributes] _LIBCPP_TYPE_VIS ^ __config:701:46: note: expanded from macro '_LIBCPP_TYPE_VIS' # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) ^ 1 warning generated. ``` Fix it by putting the attribute after the `class` keyword. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43209 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325027 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/functional | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/functional b/include/functional index 69bcadae2..e45beb818 100644 --- a/include/functional +++ b/include/functional @@ -2497,8 +2497,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, // default searcher template> -_LIBCPP_TYPE_VIS -class default_searcher { +class _LIBCPP_TYPE_VIS default_searcher { public: _LIBCPP_INLINE_VISIBILITY default_searcher(_ForwardIterator __f, _ForwardIterator __l, From e64dcb66c05c35373c564502fe53a81a6584a4aa Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 13 Feb 2018 17:43:24 +0000 Subject: [PATCH 0376/1520] Make the ctype_byname::widen test cases pass on FreeBSD. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325028 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../category.ctype/locale.ctype.byname/widen_1.pass.cpp | 2 +- .../category.ctype/locale.ctype.byname/widen_many.pass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp index 8f51d12d7..1070fa613 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp @@ -55,7 +55,7 @@ int main() assert(f.widen('.') == L'.'); assert(f.widen('a') == L'a'); assert(f.widen('1') == L'1'); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) assert(f.widen(char(-5)) == L'\u00fb'); #else assert(f.widen(char(-5)) == wchar_t(-1)); diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp index 7a382c4df..9b841b28b 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp @@ -61,7 +61,7 @@ int main() assert(v[3] == L'.'); assert(v[4] == L'a'); assert(v[5] == L'1'); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) assert(v[6] == L'\x85'); #else assert(v[6] == wchar_t(-1)); From 26a02748ebf125e59271224de908cd9d13af8470 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 14 Feb 2018 00:29:38 +0000 Subject: [PATCH 0377/1520] Fix incorrect indentation. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43167 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325087 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ios | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ios b/include/ios index 0bffa571e..6e32d0fe6 100644 --- a/include/ios +++ b/include/ios @@ -670,7 +670,7 @@ protected: void set_rdbuf(basic_streambuf* __sb); private: basic_ostream* __tie_; - mutable int_type __fill_; + mutable int_type __fill_; }; template From 078dd9752d27dde7f4e05aa70d47ce5324dc9ac8 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 14 Feb 2018 18:05:25 +0000 Subject: [PATCH 0378/1520] Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325147 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../streambuf.put.area/pbump2gig.pass.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp index e7bdd897c..460e4c07e 100644 --- a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp +++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp @@ -32,12 +32,13 @@ int main() #ifndef TEST_HAS_NO_EXCEPTIONS try { #endif - std::string str(2147483648, 'a'); - SB sb; - sb.str(str); - assert(sb.pubpbase() <= sb.pubpptr()); + std::string str(2147483648, 'a'); + SB sb; + sb.str(str); + assert(sb.pubpbase() <= sb.pubpptr()); #ifndef TEST_HAS_NO_EXCEPTIONS - } - catch (const std::bad_alloc &) {} + } + catch (const std::length_error &) {} // maybe the string can't take 2GB + catch (const std::bad_alloc &) {} // maybe we don't have enough RAM #endif } From 6878e852d1d26cca0abee3013822311cd894ca3e Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 15 Feb 2018 02:41:19 +0000 Subject: [PATCH 0379/1520] Fix test failure on compilers w/o deduction guides git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325205 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.pass.cpp | 3 +-- utils/libcxx/test/config.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index a6c458c0e..b83275a57 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -9,8 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// XFAIL: libcpp-no-deduction-guides // template // basic_string(InputIterator begin, InputIterator end, diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 199ff3566..b9e2825db 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -463,7 +463,8 @@ class Configuration(object): if '__cpp_structured_bindings' not in macros: self.config.available_features.add('libcpp-no-structured-bindings') - if '__cpp_deduction_guides' not in macros: + if '__cpp_deduction_guides' not in macros or \ + int(macros['__cpp_deduction_guides']) < 201611: self.config.available_features.add('libcpp-no-deduction-guides') if self.is_windows: From c4658abe601d5af65ce835331ba6e31a5cd85367 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Mon, 19 Feb 2018 15:41:36 +0000 Subject: [PATCH 0380/1520] [libcxx] Improve accuracy of complex asinh and acosh Summary: Currently std::asinh and std::acosh use std::pow to compute x^2. This results in a significant error when computing e.g. asinh(i) or acosh(-1). This patch expresses x^2 directly via x.real() and x.imag(), like it is done in libstdc++/glibc, and adds tests that checks the accuracy. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D41629 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325510 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/complex | 17 +++- .../numerics/complex.number/__sqr.pass.cpp | 81 +++++++++++++++++++ .../complex.transcendentals/acosh.pass.cpp | 9 +++ .../complex.transcendentals/asinh.pass.cpp | 9 +++ 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 test/libcxx/numerics/complex.number/__sqr.pass.cpp diff --git a/include/complex b/include/complex index c7c1cdedf..d692ee319 100644 --- a/include/complex +++ b/include/complex @@ -1125,6 +1125,17 @@ pow(const _Tp& __x, const complex<_Up>& __y) return _VSTD::pow(result_type(__x), result_type(__y)); } +// __sqr, computes pow(x, 2) + +template +inline _LIBCPP_INLINE_VISIBILITY +complex<_Tp> +__sqr(const complex<_Tp>& __x) +{ + return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), + _Tp(2) * __x.real() * __x.imag()); +} + // asinh template @@ -1150,7 +1161,7 @@ asinh(const complex<_Tp>& __x) } if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag())); - complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1))); + complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1))); return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); } @@ -1184,7 +1195,7 @@ acosh(const complex<_Tp>& __x) } if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag())); - complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); + complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag())); } @@ -1318,7 +1329,7 @@ acos(const complex<_Tp>& __x) return complex<_Tp>(__pi/_Tp(2), -__x.imag()); if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag()))) return complex<_Tp>(__pi/_Tp(2), -__x.imag()); - complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); + complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); if (signbit(__x.imag())) return complex<_Tp>(abs(__z.imag()), abs(__z.real())); return complex<_Tp>(abs(__z.imag()), -abs(__z.real())); diff --git a/test/libcxx/numerics/complex.number/__sqr.pass.cpp b/test/libcxx/numerics/complex.number/__sqr.pass.cpp new file mode 100644 index 000000000..a3cc9dd38 --- /dev/null +++ b/test/libcxx/numerics/complex.number/__sqr.pass.cpp @@ -0,0 +1,81 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// complex +// __sqr(const complex& x); + +#include +#include + +template +void +test() +{ + const T tolerance = std::is_same::value ? 1.e-6 : 1.e-14; + + typedef std::complex cplx; + struct test_case + { + cplx value; + cplx expected; + }; + + const test_case cases[] = { + {cplx( 0, 0), cplx( 0, 0)}, + {cplx( 1, 0), cplx( 1, 0)}, + {cplx( 2, 0), cplx( 4, 0)}, + {cplx(-1, 0), cplx( 1, 0)}, + {cplx( 0, 1), cplx(-1, 0)}, + {cplx( 0, 2), cplx(-4, 0)}, + {cplx( 0, -1), cplx(-1, 0)}, + {cplx( 1, 1), cplx( 0, 2)}, + {cplx( 1, -1), cplx( 0, -2)}, + {cplx(-1, -1), cplx( 0, 2)}, + {cplx(0.5, 0), cplx(0.25, 0)}, + }; + + const unsigned num_cases = sizeof(cases) / sizeof(test_case); + for (unsigned i = 0; i < num_cases; ++i) + { + const test_case& test = cases[i]; + const std::complex actual = std::__sqr(test.value); + assert(std::abs(actual.real() - test.expected.real()) < tolerance); + assert(std::abs(actual.imag() - test.expected.imag()) < tolerance); + } + + const cplx nan1 = std::__sqr(cplx(NAN, 0)); + assert(std::isnan(nan1.real())); + assert(std::isnan(nan1.imag())); + + const cplx nan2 = std::__sqr(cplx(0, NAN)); + assert(std::isnan(nan2.real())); + assert(std::isnan(nan2.imag())); + + const cplx nan3 = std::__sqr(cplx(NAN, NAN)); + assert(std::isnan(nan3.real())); + assert(std::isnan(nan3.imag())); + + const cplx inf1 = std::__sqr(cplx(INFINITY, 0)); + assert(std::isinf(inf1.real())); + assert(inf1.real() > 0); + + const cplx inf2 = std::__sqr(cplx(0, INFINITY)); + assert(std::isinf(inf2.real())); + assert(inf2.real() < 0); +} + +int main() +{ + test(); + test(); + test(); +} diff --git a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp index deb056d67..5258bdc3a 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp @@ -54,6 +54,15 @@ void test_edges() assert(r.imag() == 0); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } + else if (testcases[i].real() == -1 && testcases[i].imag() == 0) + { + assert(r.real() == 0); + assert(!std::signbit(r.real())); + if (std::signbit(testcases[i].imag())) + is_about(r.imag(), -pi); + else + is_about(r.imag(), pi); + } else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag())) { assert(std::isinf(r.real())); diff --git a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp index 3da56c32f..cb9188d93 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp @@ -44,6 +44,15 @@ void test_edges() assert(std::signbit(r.real()) == std::signbit(testcases[i].real())); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } + else if (testcases[i].real() == 0 && std::abs(testcases[i].imag()) == 1) + { + assert(r.real() == 0); + assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag())); + if (std::signbit(testcases[i].imag())) + is_about(r.imag(), -pi/2); + else + is_about(r.imag(), pi/2); + } else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag())) { assert(std::isinf(r.real())); From 61494b519c2b31d52a2142f89de26579cacbb643 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 21 Feb 2018 21:36:18 +0000 Subject: [PATCH 0381/1520] libcxx: Unbreak external thread library configuration. Differential Revision: https://reviews.llvm.org/D42503 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325723 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__threading_support | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/include/__threading_support b/include/__threading_support index c20123d56..3c1eff22f 100644 --- a/include/__threading_support +++ b/include/__threading_support @@ -31,6 +31,14 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCPP_HAS_THREAD_API_WIN32) +#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS +#else +#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY +#endif + #if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(no_thread_safety_analysis) #define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) #else @@ -39,15 +47,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ - defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) - -#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS - -#elif defined(_LIBCPP_HAS_THREAD_API_PTHREAD) - -#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY - +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) // Mutex typedef pthread_mutex_t __libcpp_mutex_t; #define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER @@ -75,9 +75,6 @@ typedef pthread_key_t __libcpp_tls_key; #define _LIBCPP_TLS_DESTRUCTOR_CC #else - -#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS - // Mutex typedef void* __libcpp_mutex_t; #define _LIBCPP_MUTEX_INITIALIZER 0 From 2c893111fc11054a650e95886557939d5dab2f8b Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 22 Feb 2018 05:14:20 +0000 Subject: [PATCH 0382/1520] Add another test case to the deduction guide for basic_string. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325740 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.cons/iter_alloc_deduction.pass.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index b83275a57..815b5600d 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -39,6 +39,17 @@ int main() { + { + const char* s = "12345678901234"; + std::basic_string s1(s, s+10); // Can't use {} here + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v>, ""); + static_assert(std::is_same_v>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + { const char* s = "12345678901234"; std::basic_string s1{s, s+10, std::allocator{}}; From df7a35ce322c7ce6ae2f21aaa98e451a9537b821 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Thu, 22 Feb 2018 09:34:08 +0000 Subject: [PATCH 0383/1520] [libcxx] Do not include the C math.h header before __config Summary: Certain C libraries require configuration macros defined in __config to provide the correct functionality for libc++. This patch ensures that the C header math.h is always included after the __config header. It also adds a Windows-specific #if guard for the case when the C math.h file is included the second time, as suggested by Marshall in https://reviews.llvm.org/rL323490. Fixes PR36382. Reviewers: mclow.lists, EricWF Reviewed By: mclow.lists Subscribers: cfe-commits, pcc, christof, rogfer01 Differential Revision: https://reviews.llvm.org/D43579 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325760 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/math.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/include/math.h b/include/math.h index 147677235..cd055caef 100644 --- a/include/math.h +++ b/include/math.h @@ -8,16 +8,6 @@ // //===----------------------------------------------------------------------===// -// This include lives outside the header guard in order to support an MSVC -// extension which allows users to do: -// -// #define _USE_MATH_DEFINES -// #include -// -// and receive the definitions of mathematical constants, even if -// has previously been included. -#include_next - #ifndef _LIBCPP_MATH_H #define _LIBCPP_MATH_H @@ -308,6 +298,8 @@ long double truncl(long double x); #pragma GCC system_header #endif +#include_next + #ifdef __cplusplus // We support including .h headers inside 'extern "C"' contexts, so switch @@ -1494,4 +1486,18 @@ trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);} #endif // __cplusplus +#else // _LIBCPP_MATH_H + +// This include lives outside the header guard in order to support an MSVC +// extension which allows users to do: +// +// #define _USE_MATH_DEFINES +// #include +// +// and receive the definitions of mathematical constants, even if +// has previously been included. +#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) +#include_next +#endif + #endif // _LIBCPP_MATH_H From 9880456e8d4f83ee5ce512ce24f5479884591534 Mon Sep 17 00:00:00 2001 From: Alexander Richardson Date: Fri, 23 Feb 2018 15:19:48 +0000 Subject: [PATCH 0384/1520] Allow passing additional compiler/linker flags for the tests Summary: These flags can be specified using the CMake variables LIBCXX_TEST_LINKER_FLAGS and LIBCXX_TEST_COMPILER_FLAGS. When building the tests for CHERI I need to pass additional flags (such as -mabi=n64 or -mabi=purecap) to the compiler for our test configurations Reviewers: EricWF Reviewed By: EricWF Subscribers: christof, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D42139 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325914 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CMakeLists.txt | 5 +++++ test/lit.site.cfg.in | 3 +++ utils/libcxx/test/config.py | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6219e1857..45dc34ac2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,6 +9,11 @@ endmacro() set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING "Configuration variant to use for LIT.") +set(LIBCXX_TEST_LINKER_FLAGS "" CACHE STRING + "Additonal linker flags to pass when compiling the tests") +set(LIBCXX_TEST_COMPILER_FLAGS "" CACHE STRING + "Additonal linker flags to pass when compiling the tests") + # The tests shouldn't link to any ABI library when it has been linked into # libc++ statically or via a linker script. if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT) diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 4b746a135..53f797268 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -22,6 +22,9 @@ config.sysroot = "@LIBCXX_SYSROOT@" config.gcc_toolchain = "@LIBCXX_GCC_TOOLCHAIN@" config.generate_coverage = "@LIBCXX_GENERATE_COVERAGE@" config.target_info = "@LIBCXX_TARGET_INFO@" +config.test_linker_flags = "@LIBCXX_TEST_LINKER_FLAGS@" +config.test_compiler_flags = "@LIBCXX_TEST_COMPILER_FLAGS@" + config.executor = "@LIBCXX_EXECUTOR@" config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@" config.compiler_rt = "@LIBCXX_USE_COMPILER_RT@" diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index b9e2825db..2af4a473e 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -510,6 +510,9 @@ class Configuration(object): # and so that those tests don't have to be changed to tolerate # this insanity. self.cxx.compile_flags += ['-DNOMINMAX'] + additional_flags = self.get_lit_conf('test_compiler_flags') + if additional_flags: + self.cxx.compile_flags += shlex.split(additional_flags) def configure_default_compile_flags(self): # Try and get the std version from the command line. Fall back to @@ -794,6 +797,9 @@ class Configuration(object): self.use_system_cxx_lib] if self.is_windows and self.link_shared: self.add_path(self.cxx.compile_env, self.use_system_cxx_lib) + additional_flags = self.get_lit_conf('test_linker_flags') + if additional_flags: + self.cxx.link_flags += shlex.split(additional_flags) def configure_link_flags_abi_library_path(self): # Configure ABI library paths. From 7102892bf3dfffb3f988aa9a0a29f58171a508d7 Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Sat, 24 Feb 2018 07:57:32 +0000 Subject: [PATCH 0385/1520] Cleanup __config indention NFC This commit indents each level by two space characters, e.g. #if defined(CONDITION) # define _LIBCPP_NAME VALUE #else # define _LIBCPP_NAME VALUE #endif The simple #ifndef, #define, and #endif sequences are not indented, e.g. #ifndef _LIBCPP_NAME #define _LIBCPP_NAME ... #endif git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326027 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 854 ++++++++++++++++++++++++----------------------- 1 file changed, 433 insertions(+), 421 deletions(-) diff --git a/include/__config b/include/__config index cfe4ef08c..f96d74374 100644 --- a/include/__config +++ b/include/__config @@ -12,9 +12,9 @@ #define _LIBCPP_CONFIG #if defined(_MSC_VER) && !defined(__clang__) -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# endif #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -24,13 +24,13 @@ #ifdef __cplusplus #ifdef __GNUC__ -#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +# define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) // The _GNUC_VER_NEW macro better represents the new GCC versioning scheme // introduced in GCC 5.0. -#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) +# define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) #else -#define _GNUC_VER 0 -#define _GNUC_VER_NEW 0 +# define _GNUC_VER 0 +# define _GNUC_VER_NEW 0 #endif #define _LIBCPP_VERSION 7000 @@ -40,63 +40,63 @@ #endif #if defined(__ELF__) -#define _LIBCPP_OBJECT_FORMAT_ELF 1 +# define _LIBCPP_OBJECT_FORMAT_ELF 1 #elif defined(__MACH__) -#define _LIBCPP_OBJECT_FORMAT_MACHO 1 +# define _LIBCPP_OBJECT_FORMAT_MACHO 1 #elif defined(_WIN32) -#define _LIBCPP_OBJECT_FORMAT_COFF 1 +# define _LIBCPP_OBJECT_FORMAT_COFF 1 #elif defined(__wasm__) -#define _LIBCPP_OBJECT_FORMAT_WASM 1 +# define _LIBCPP_OBJECT_FORMAT_WASM 1 #else -#error Unknown object file format +# error Unknown object file format #endif #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. -#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. -#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. -#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. -#define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. -#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB -#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB -#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE +# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr // provided under the alternate keyword __nullptr, which changes the mangling // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. -#define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR +# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR // Define the `pointer_safety` enum as a C++11 strongly typed enumeration // instead of as a class simulating an enum. If this option is enabled // `pointer_safety` and `get_pointer_safety()` will no longer be available // in C++03. -#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE +# define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION // Enable optimized version of __do_get_(un)signed which avoids redundant copies. -#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusivly. -#define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION #elif _LIBCPP_ABI_VERSION == 1 -#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition // of inline functions to be emitted anyway. Our own non-inline copy would // conflict with the dllexport-emitted copy, so we disable it. -#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS -#endif +# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS +# endif // Feature macros for disabling pre ABI v1 features. All of these options // are deprecated. -#if defined(__FreeBSD__) -#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR -#endif +# if defined(__FreeBSD__) +# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# endif #endif #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR @@ -116,23 +116,29 @@ #ifndef __has_attribute #define __has_attribute(__x) 0 #endif + #ifndef __has_builtin #define __has_builtin(__x) 0 #endif + #ifndef __has_extension #define __has_extension(__x) 0 #endif + #ifndef __has_feature #define __has_feature(__x) 0 #endif + #ifndef __has_cpp_attribute #define __has_cpp_attribute(__x) 0 #endif + // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. #ifndef __is_identifier #define __is_identifier(__x) 1 #endif + #ifndef __has_declspec_attribute #define __has_declspec_attribute(__x) 0 #endif @@ -140,22 +146,22 @@ #define __has_keyword(__x) !(__is_identifier(__x)) #ifdef __has_include -#define __libcpp_has_include(__x) __has_include(__x) +# define __libcpp_has_include(__x) __has_include(__x) #else -#define __libcpp_has_include(__x) 0 +# define __libcpp_has_include(__x) 0 #endif #if defined(__clang__) -#define _LIBCPP_COMPILER_CLANG -# ifndef __apple_build_version__ -# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) -# endif +# define _LIBCPP_COMPILER_CLANG +# ifndef __apple_build_version__ +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +# endif #elif defined(__GNUC__) -#define _LIBCPP_COMPILER_GCC +# define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) -#define _LIBCPP_COMPILER_MSVC +# define _LIBCPP_COMPILER_MSVC #elif defined(__IBMCPP__) -#define _LIBCPP_COMPILER_IBM +# define _LIBCPP_COMPILER_IBM #endif #ifndef _LIBCPP_CLANG_VER @@ -168,69 +174,69 @@ // and allow the user to explicitly specify the ABI to handle cases where this // heuristic falls short. #if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" +# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" #elif defined(_LIBCPP_ABI_FORCE_ITANIUM) -# define _LIBCPP_ABI_ITANIUM -#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# define _LIBCPP_ABI_MICROSOFT -#else -# if defined(_WIN32) && defined(_MSC_VER) -# define _LIBCPP_ABI_MICROSOFT -# else # define _LIBCPP_ABI_ITANIUM -# endif +#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# define _LIBCPP_ABI_MICROSOFT +#else +# if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +# else +# define _LIBCPP_ABI_ITANIUM +# endif #endif // Need to detect which libc we're using if we're on Linux. #if defined(__linux__) -#include -#if defined(__GLIBC_PREREQ) -#define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) -#else -#define _LIBCPP_GLIBC_PREREQ(a, b) 0 -#endif // defined(__GLIBC_PREREQ) +# include +# if defined(__GLIBC_PREREQ) +# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) +# else +# define _LIBCPP_GLIBC_PREREQ(a, b) 0 +# endif // defined(__GLIBC_PREREQ) #endif // defined(__linux__) #ifdef __LITTLE_ENDIAN__ -#if __LITTLE_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN -#endif // __LITTLE_ENDIAN__ +# if __LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# endif // __LITTLE_ENDIAN__ #endif // __LITTLE_ENDIAN__ #ifdef __BIG_ENDIAN__ -#if __BIG_ENDIAN__ -#define _LIBCPP_BIG_ENDIAN -#endif // __BIG_ENDIAN__ +# if __BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BIG_ENDIAN__ #endif // __BIG_ENDIAN__ #ifdef __BYTE_ORDER__ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN -#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#define _LIBCPP_BIG_ENDIAN -#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #endif // __BYTE_ORDER__ #ifdef __FreeBSD__ -# include +# include # if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -# ifndef __LONG_LONG_SUPPORTED -# define _LIBCPP_HAS_NO_LONG_LONG -# endif // __LONG_LONG_SUPPORTED +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# ifndef __LONG_LONG_SUPPORTED +# define _LIBCPP_HAS_NO_LONG_LONG +# endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ #ifdef __NetBSD__ -# include +# include # if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_HAS_QUICK_EXIT #endif // __NetBSD__ #if defined(_WIN32) @@ -248,64 +254,64 @@ # define _LIBCPP_HAS_BITSCAN64 # endif # define _LIBCPP_HAS_OPEN_WITH_WCHAR -# if defined(_LIBCPP_MSVCRT) -# define _LIBCPP_HAS_QUICK_EXIT -# endif +# if defined(_LIBCPP_MSVCRT) +# define _LIBCPP_HAS_QUICK_EXIT +# endif // Some CRT APIs are unavailable to store apps -#if defined(WINAPI_FAMILY) -#include -#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ - (!defined(WINAPI_PARTITION_SYSTEM) || \ - !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) -#define _LIBCPP_WINDOWS_STORE_APP -#endif -#endif +# if defined(WINAPI_FAMILY) +# include +# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ + (!defined(WINAPI_PARTITION_SYSTEM) || \ + !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) +# define _LIBCPP_WINDOWS_STORE_APP +# endif +# endif #endif // defined(_WIN32) #ifdef __sun__ -# include -# ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else -# define _LIBCPP_BIG_ENDIAN -# endif +# include +# ifdef _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else +# define _LIBCPP_BIG_ENDIAN +# endif #endif // __sun__ #if defined(__CloudABI__) - // Certain architectures provide arc4random(). Prefer using - // arc4random() over /dev/{u,}random to make it possible to obtain - // random data even when using sandboxing mechanisms such as chroots, - // Capsicum, etc. -# define _LIBCPP_USING_ARC4_RANDOM + // Certain architectures provide arc4random(). Prefer using + // arc4random() over /dev/{u,}random to make it possible to obtain + // random data even when using sandboxing mechanisms such as chroots, + // Capsicum, etc. +# define _LIBCPP_USING_ARC4_RANDOM #elif defined(__Fuchsia__) -# define _LIBCPP_USING_GETENTROPY +# define _LIBCPP_USING_GETENTROPY #elif defined(__native_client__) - // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, - // including accesses to the special files under /dev. C++11's - // std::random_device is instead exposed through a NaCl syscall. -# define _LIBCPP_USING_NACL_RANDOM + // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, + // including accesses to the special files under /dev. C++11's + // std::random_device is instead exposed through a NaCl syscall. +# define _LIBCPP_USING_NACL_RANDOM #elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_USING_WIN32_RANDOM +# define _LIBCPP_USING_WIN32_RANDOM #else -# define _LIBCPP_USING_DEV_RANDOM +# define _LIBCPP_USING_DEV_RANDOM #endif #if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -# include -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER == __BIG_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# else // __BYTE_ORDER == __BIG_ENDIAN -# error unable to determine endian -# endif +# include +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# else // __BYTE_ORDER == __BIG_ENDIAN +# error unable to determine endian +# endif #endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) -#define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) +# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) #else -#define _LIBCPP_NO_CFI +# define _LIBCPP_NO_CFI #endif #if defined(_LIBCPP_COMPILER_CLANG) @@ -358,11 +364,11 @@ typedef __char32_t char32_t; #endif #if !(__has_feature(cxx_nullptr)) -# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) -# define nullptr __nullptr -# else -# define _LIBCPP_HAS_NO_NULLPTR -# endif +# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) +# define nullptr __nullptr +# else +# define _LIBCPP_HAS_NO_NULLPTR +# endif #endif #if !(__has_feature(cxx_rvalue_references)) @@ -382,11 +388,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(is_base_of) -# define _LIBCPP_HAS_IS_BASE_OF +#define _LIBCPP_HAS_IS_BASE_OF #endif #if __has_feature(is_final) -# define _LIBCPP_HAS_IS_FINAL +#define _LIBCPP_HAS_IS_FINAL #endif // Objective-C++ features (opt-in) @@ -411,25 +417,25 @@ typedef __char32_t char32_t; #endif #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L -#if defined(__FreeBSD__) -#define _LIBCPP_HAS_QUICK_EXIT -#define _LIBCPP_HAS_C11_FEATURES -#elif defined(__Fuchsia__) -#define _LIBCPP_HAS_QUICK_EXIT -#define _LIBCPP_HAS_C11_FEATURES -#elif defined(__linux__) -#if !defined(_LIBCPP_HAS_MUSL_LIBC) -#if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -#define _LIBCPP_HAS_QUICK_EXIT -#endif -#if _LIBCPP_GLIBC_PREREQ(2, 17) -#define _LIBCPP_HAS_C11_FEATURES -#endif -#else // defined(_LIBCPP_HAS_MUSL_LIBC) -#define _LIBCPP_HAS_QUICK_EXIT -#define _LIBCPP_HAS_C11_FEATURES -#endif -#endif // __linux__ +# if defined(__FreeBSD__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__Fuchsia__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__linux__) +# if !defined(_LIBCPP_HAS_MUSL_LIBC) +# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) +# define _LIBCPP_HAS_QUICK_EXIT +# endif +# if _LIBCPP_GLIBC_PREREQ(2, 17) +# define _LIBCPP_HAS_C11_FEATURES +# endif +# else // defined(_LIBCPP_HAS_MUSL_LIBC) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# endif +# endif // __linux__ #endif #if !(__has_feature(cxx_noexcept)) @@ -437,11 +443,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(underlying_type) -# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #endif #if __has_feature(is_literal) -# define _LIBCPP_IS_LITERAL(T) __is_literal(T) +#define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif // Inline namespaces are available in Clang regardless of C++ dialect. @@ -461,7 +467,7 @@ namespace std { // Allow for build-time disabling of unsigned integer sanitization #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize) #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) -#endif +#endif #if __has_builtin(__builtin_launder) #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER @@ -485,7 +491,7 @@ namespace std { #endif #if defined(__GNUC__) && _GNUC_VER >= 403 -# define _LIBCPP_HAS_IS_BASE_OF +#define _LIBCPP_HAS_IS_BASE_OF #endif #if !__EXCEPTIONS @@ -494,10 +500,10 @@ namespace std { // constexpr was added to GCC in 4.6. #if _GNUC_VER < 406 -#define _LIBCPP_HAS_NO_CONSTEXPR +# define _LIBCPP_HAS_NO_CONSTEXPR // Can only use constexpr in c++11 mode. #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L -#define _LIBCPP_HAS_NO_CONSTEXPR +# define _LIBCPP_HAS_NO_CONSTEXPR #endif // Determine if GCC supports relaxed constexpr @@ -511,6 +517,7 @@ namespace std { #endif #ifndef __GXX_EXPERIMENTAL_CXX0X__ + #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS @@ -589,10 +596,11 @@ namespace std { #define _LIBCPP_END_NAMESPACE_STD } #define _VSTD std -# define _LIBCPP_WEAK namespace std { } +#define _LIBCPP_WEAK + #define _LIBCPP_HAS_NO_ASAN #elif defined(_LIBCPP_COMPILER_IBM) @@ -628,27 +636,28 @@ namespace std { #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] #if defined(_LIBCPP_OBJECT_FORMAT_COFF) + #ifdef _DLL -# define _LIBCPP_CRT_FUNC __declspec(dllimport) +# define _LIBCPP_CRT_FUNC __declspec(dllimport) #else -# define _LIBCPP_CRT_FUNC +# define _LIBCPP_CRT_FUNC #endif #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_DLL_VIS -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_DLL_VIS +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS #elif defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_DLL_VIS __declspec(dllexport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_DLL_VIS __declspec(dllexport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS #else -# define _LIBCPP_DLL_VIS __declspec(dllimport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_DLL_VIS __declspec(dllimport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS #endif #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS @@ -661,39 +670,40 @@ namespace std { #define _LIBCPP_ENUM_VIS #if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_INLINE_VISIBILITY __forceinline -# define _LIBCPP_ALWAYS_INLINE __forceinline -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline +# define _LIBCPP_INLINE_VISIBILITY __forceinline +# define _LIBCPP_ALWAYS_INLINE __forceinline +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline #else -# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) -# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) #endif + #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifndef _LIBCPP_HIDDEN -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) -#else -#define _LIBCPP_HIDDEN -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) +# else +# define _LIBCPP_HIDDEN +# endif #endif #ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) // The inline should be removed once PR32114 is resolved -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN -#else -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#endif +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN +# else +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# endif #endif #ifndef _LIBCPP_FUNC_VIS -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) -#else -#define _LIBCPP_FUNC_VIS -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) +# else +# define _LIBCPP_FUNC_VIS +# endif #endif #ifndef _LIBCPP_TYPE_VIS @@ -717,19 +727,19 @@ namespace std { #endif #ifndef _LIBCPP_EXTERN_VIS -# define _LIBCPP_EXTERN_VIS +#define _LIBCPP_EXTERN_VIS #endif #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS +#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS #endif #ifndef _LIBCPP_EXCEPTION_ABI -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) -#else -#define _LIBCPP_EXCEPTION_ABI -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +# else +# define _LIBCPP_EXCEPTION_ABI +# endif #endif #ifndef _LIBCPP_ENUM_VIS @@ -749,31 +759,31 @@ namespace std { #endif #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS #endif #ifndef _LIBCPP_INLINE_VISIBILITY -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) -#else -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +# else +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# endif #endif #ifndef _LIBCPP_ALWAYS_INLINE -#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) -#else -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) +# else +# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) -# else -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) -# endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +# else +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) +# endif #endif #ifndef _LIBCPP_PREFERRED_OVERLOAD @@ -791,19 +801,19 @@ namespace std { #endif #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS) -# if !defined(_LIBCPP_DEBUG) -# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined -# endif -# ifdef _LIBCPP_HAS_NO_NOEXCEPT -# define _NOEXCEPT_DEBUG -# define _NOEXCEPT_DEBUG_(x) -# else -# define _NOEXCEPT_DEBUG noexcept(false) -# define _NOEXCEPT_DEBUG_(x) noexcept(false) -#endif +# if !defined(_LIBCPP_DEBUG) +# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined +# endif +# ifdef _LIBCPP_HAS_NO_NOEXCEPT +# define _NOEXCEPT_DEBUG +# define _NOEXCEPT_DEBUG_(x) +# else +# define _NOEXCEPT_DEBUG noexcept(false) +# define _NOEXCEPT_DEBUG_(x) noexcept(false) +# endif #else -# define _NOEXCEPT_DEBUG _NOEXCEPT -# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) +# define _NOEXCEPT_DEBUG _NOEXCEPT +# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) #endif #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS @@ -816,88 +826,88 @@ typedef unsigned int char32_t; #endif #ifdef _LIBCPP_CXX03_LANG -# if __has_extension(c_static_assert) -# define static_assert(__b, __m) _Static_assert(__b, __m) -# else +# if __has_extension(c_static_assert) +# define static_assert(__b, __m) _Static_assert(__b, __m) +# else extern "C++" { template struct __static_assert_test; template <> struct __static_assert_test {}; template struct __static_assert_check {}; } -#define static_assert(__b, __m) \ - typedef __static_assert_check)> \ - _LIBCPP_CONCAT(__t, __LINE__) -# endif // __has_extension(c_static_assert) +# define static_assert(__b, __m) \ + typedef __static_assert_check)> \ + _LIBCPP_CONCAT(__t, __LINE__) +# endif // __has_extension(c_static_assert) #endif // _LIBCPP_CXX03_LANG #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. -#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 -# define decltype(__x) __decltype(__x) -#else -# define decltype(__x) __typeof__(__x) -#endif +# if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 +# define decltype(__x) __decltype(__x) +# else +# define decltype(__x) __typeof__(__x) +# endif #endif #ifdef _LIBCPP_HAS_NO_CONSTEXPR -#define _LIBCPP_CONSTEXPR +# define _LIBCPP_CONSTEXPR #else -#define _LIBCPP_CONSTEXPR constexpr +# define _LIBCPP_CONSTEXPR constexpr #endif #ifdef _LIBCPP_CXX03_LANG -#define _LIBCPP_DEFAULT {} +# define _LIBCPP_DEFAULT {} #else -#define _LIBCPP_DEFAULT = default; +# define _LIBCPP_DEFAULT = default; #endif #ifdef _LIBCPP_CXX03_LANG -#define _LIBCPP_EQUAL_DELETE +# define _LIBCPP_EQUAL_DELETE #else -#define _LIBCPP_EQUAL_DELETE = delete +# define _LIBCPP_EQUAL_DELETE = delete #endif #ifdef __GNUC__ -#define _NOALIAS __attribute__((__malloc__)) +# define _NOALIAS __attribute__((__malloc__)) #else -#define _NOALIAS +# define _NOALIAS #endif #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \ (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions -# define _LIBCPP_EXPLICIT explicit +# define _LIBCPP_EXPLICIT explicit #else -# define _LIBCPP_EXPLICIT +# define _LIBCPP_EXPLICIT #endif #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) -# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE +#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE #endif #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS -#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx -#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ - __lx __v_; \ - _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ - _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ - _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ - }; +# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ + _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ + }; #else // _LIBCPP_HAS_NO_STRONG_ENUMS -#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x -#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) #endif // _LIBCPP_HAS_NO_STRONG_ENUMS #ifdef _LIBCPP_DEBUG -# if _LIBCPP_DEBUG == 0 -# define _LIBCPP_DEBUG_LEVEL 1 -# elif _LIBCPP_DEBUG == 1 -# define _LIBCPP_DEBUG_LEVEL 2 -# else -# error Supported values for _LIBCPP_DEBUG are 0 and 1 -# endif -# if !defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_EXTERN_TEMPLATE(...) -# endif +# if _LIBCPP_DEBUG == 0 +# define _LIBCPP_DEBUG_LEVEL 1 +# elif _LIBCPP_DEBUG == 1 +# define _LIBCPP_DEBUG_LEVEL 2 +# else +# error Supported values for _LIBCPP_DEBUG are 0 and 1 +# endif +# if !defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_EXTERN_TEMPLATE(...) +# endif #endif #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE @@ -924,9 +934,9 @@ template struct __static_assert_check {}; #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) // Most unix variants have catopen. These are the specific ones that don't. -#if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) -#define _LIBCPP_HAS_CATOPEN 1 -#endif +# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) +# define _LIBCPP_HAS_CATOPEN 1 +# endif #endif #ifdef __FreeBSD__ @@ -934,15 +944,15 @@ template struct __static_assert_check {}; #endif #if defined(__APPLE__) -# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ - defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -# endif -# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -# endif -# endif +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# endif +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif +# endif #endif // defined(__APPLE__) #if defined(__APPLE__) || defined(__FreeBSD__) @@ -966,47 +976,47 @@ template struct __static_assert_check {}; #endif // _LIBCPP_STD_VER #if _LIBCPP_STD_VER > 11 -#define _LIBCPP_DEPRECATED [[deprecated]] +# define _LIBCPP_DEPRECATED [[deprecated]] #else -#define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED #endif #if _LIBCPP_STD_VER <= 11 -#define _LIBCPP_EXPLICIT_AFTER_CXX11 -#define _LIBCPP_DEPRECATED_AFTER_CXX11 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 +# define _LIBCPP_DEPRECATED_AFTER_CXX11 #else -#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit -#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] +# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit +# define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] #endif #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr +# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX11 +# define _LIBCPP_CONSTEXPR_AFTER_CXX11 #endif #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -#define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr +# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX14 +# define _LIBCPP_CONSTEXPR_AFTER_CXX14 #endif #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -#define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr +# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX17 +# define _LIBCPP_CONSTEXPR_AFTER_CXX17 #endif #if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) -#define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] +# define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] #else -#define _LIBCPP_NODISCARD_AFTER_CXX17 +# define _LIBCPP_NODISCARD_AFTER_CXX17 #endif #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) -# define _LIBCPP_INLINE_VAR inline +# define _LIBCPP_INLINE_VAR inline #else -# define _LIBCPP_INLINE_VAR +# define _LIBCPP_INLINE_VAR #endif #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1024,8 +1034,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // g++ and cl.exe have RTTI on by default and define a macro when it is. // g++ only defines the macro in 4.3.2 and onwards. #if !defined(_LIBCPP_NO_RTTI) -# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ - (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) +# if defined(__GNUC__) && \ + ((__GNUC__ >= 5) || \ + (__GNUC__ == 4 && (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && \ + !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI # elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) # define _LIBCPP_NO_RTTI @@ -1033,7 +1045,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #ifndef _LIBCPP_WEAK -# define _LIBCPP_WEAK __attribute__((__weak__)) +#define _LIBCPP_WEAK __attribute__((__weak__)) #endif // Thread API @@ -1041,35 +1053,35 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# if defined(__FreeBSD__) || \ - defined(__Fuchsia__) || \ - defined(__NetBSD__) || \ - defined(__linux__) || \ - defined(__APPLE__) || \ - defined(__CloudABI__) || \ - defined(__sun__) || \ - (defined(__MINGW32__) && __libcpp_has_include()) -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_HAS_THREAD_API_WIN32 -# else -# error "No thread API" -# endif // _LIBCPP_HAS_THREAD_API +# if defined(__FreeBSD__) || \ + defined(__Fuchsia__) || \ + defined(__NetBSD__) || \ + defined(__linux__) || \ + defined(__APPLE__) || \ + defined(__CloudABI__) || \ + defined(__sun__) || \ + (defined(__MINGW32__) && __libcpp_has_include()) +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_HAS_THREAD_API_WIN32 +# else +# error "No thread API" +# endif // _LIBCPP_HAS_THREAD_API #endif // _LIBCPP_HAS_NO_THREADS #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ - _LIBCPP_HAS_NO_THREADS is not defined. +#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ + _LIBCPP_HAS_NO_THREADS is not defined. #endif #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ - _LIBCPP_HAS_NO_THREADS is defined. +#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ + _LIBCPP_HAS_NO_THREADS is defined. #endif #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) -# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ - _LIBCPP_HAS_NO_THREADS is defined. +#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ + _LIBCPP_HAS_NO_THREADS is defined. #endif // Systems that use capability-based security (FreeBSD with Capsicum, @@ -1099,9 +1111,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) -#define _LIBCPP_HAS_C_ATOMIC_IMP +# define _LIBCPP_HAS_C_ATOMIC_IMP #elif _GNUC_VER > 407 -#define _LIBCPP_HAS_GCC_ATOMIC_IMP +# define _LIBCPP_HAS_GCC_ATOMIC_IMP #endif #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ @@ -1114,73 +1126,73 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) -#if defined(__clang__) && __has_attribute(acquire_capability) +# if defined(__clang__) && __has_attribute(acquire_capability) // Work around the attribute handling in clang. When both __declspec and // __attribute__ are present, the processing goes awry preventing the definition // of the types. -#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) -#define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS -#endif -#endif +# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# endif +# endif #endif #if __has_attribute(require_constant_initialization) -#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) +# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) #else -#define _LIBCPP_SAFE_STATIC +# define _LIBCPP_SAFE_STATIC #endif #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 -# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF +#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) -#if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION) -#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS -#endif +# if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION) +# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS +# endif #endif #if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) -# define _LIBCPP_DIAGNOSE_WARNING(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "warning"))) -# define _LIBCPP_DIAGNOSE_ERROR(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "error"))) +# define _LIBCPP_DIAGNOSE_WARNING(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "warning"))) +# define _LIBCPP_DIAGNOSE_ERROR(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "error"))) #else -# define _LIBCPP_DIAGNOSE_WARNING(...) -# define _LIBCPP_DIAGNOSE_ERROR(...) +# define _LIBCPP_DIAGNOSE_WARNING(...) +# define _LIBCPP_DIAGNOSE_ERROR(...) #endif #if __has_attribute(fallthough) || _GNUC_VER >= 700 // Use a function like macro to imply that it must be followed by a semicolon -#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) +# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) #else -#define _LIBCPP_FALLTHROUGH() ((void)0) +# define _LIBCPP_FALLTHROUGH() ((void)0) #endif #if defined(_LIBCPP_ABI_MICROSOFT) && \ - (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) -# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) + (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) +# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) #else -# define _LIBCPP_DECLSPEC_EMPTY_BASES +# define _LIBCPP_DECLSPEC_EMPTY_BASES #endif #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) -# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR +#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 -# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES +#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES #endif #if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) -# define _LIBCPP_HAS_NO_IS_AGGREGATE +#define _LIBCPP_HAS_NO_IS_AGGREGATE #endif #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L -# define _LIBCPP_HAS_NO_COROUTINES +#define _LIBCPP_HAS_NO_COROUTINES #endif // Decide whether to use availability macros. @@ -1188,65 +1200,65 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ __has_feature(attribute_availability_with_strict) && \ __has_feature(attribute_availability_in_templates) -#ifdef __APPLE__ -#define _LIBCPP_USE_AVAILABILITY_APPLE -#endif +# ifdef __APPLE__ +# define _LIBCPP_USE_AVAILABILITY_APPLE +# endif #endif // Define availability macros. #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) -#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ - __attribute__((availability(ios,strict,introduced=6.0))) -#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ + __attribute__((availability(ios,strict,introduced=6.0))) +# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) #else -#define _LIBCPP_AVAILABILITY_SHARED_MUTEX -#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS -#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST -#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS -#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE -#define _LIBCPP_AVAILABILITY_FUTURE_ERROR -#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE -#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY -#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +# define _LIBCPP_AVAILABILITY_SHARED_MUTEX +# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH +# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST +# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS +# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE +# define _LIBCPP_AVAILABILITY_FUTURE_ERROR +# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE +# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY +# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR #endif // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. #ifdef _LIBCPP_NO_EXCEPTIONS -#define _LIBCPP_AVAILABILITY_DYNARRAY -#define _LIBCPP_AVAILABILITY_FUTURE -#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST +# define _LIBCPP_AVAILABILITY_DYNARRAY +# define _LIBCPP_AVAILABILITY_FUTURE +# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST #else -#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR -#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \ - _LIBCPP_AVAILABILITY_BAD_ANY_CAST +# define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH +# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR +# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \ + _LIBCPP_AVAILABILITY_BAD_ANY_CAST #endif // Availability of stream API in the dylib got dropped and re-added. The @@ -1266,39 +1278,39 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -# define _LIBCPP_PUSH_MACROS -# define _LIBCPP_POP_MACROS +# define _LIBCPP_PUSH_MACROS +# define _LIBCPP_POP_MACROS #else // Don't warn about macro conflicts when we can restore them at the // end of the header. -# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# endif -# if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_PUSH_MACROS \ - __pragma(push_macro("min")) \ - __pragma(push_macro("max")) -# define _LIBCPP_POP_MACROS \ - __pragma(pop_macro("min")) \ - __pragma(pop_macro("max")) -# else -# define _LIBCPP_PUSH_MACROS \ - _Pragma("push_macro(\"min\")") \ - _Pragma("push_macro(\"max\")") -# define _LIBCPP_POP_MACROS \ - _Pragma("pop_macro(\"min\")") \ - _Pragma("pop_macro(\"max\")") -# endif +# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS +# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS +# endif +# if defined(_LIBCPP_COMPILER_MSVC) +# define _LIBCPP_PUSH_MACROS \ + __pragma(push_macro("min")) \ + __pragma(push_macro("max")) +# define _LIBCPP_POP_MACROS \ + __pragma(pop_macro("min")) \ + __pragma(pop_macro("max")) +# else +# define _LIBCPP_PUSH_MACROS \ + _Pragma("push_macro(\"min\")") \ + _Pragma("push_macro(\"max\")") +# define _LIBCPP_POP_MACROS \ + _Pragma("pop_macro(\"min\")") \ + _Pragma("pop_macro(\"max\")") +# endif #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) #ifndef _LIBCPP_NO_AUTO_LINK -# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -# if defined(_DLL) -# pragma comment(lib, "c++.lib") -# else -# pragma comment(lib, "libc++.lib") -# endif -# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if defined(_DLL) +# pragma comment(lib, "c++.lib") +# else +# pragma comment(lib, "libc++.lib") +# endif +# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) #endif // _LIBCPP_NO_AUTO_LINK #endif // __cplusplus From 76c246434a99b0fb4c5217dbff737c9ec8809fa3 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 26 Feb 2018 20:47:46 +0000 Subject: [PATCH 0386/1520] [libcxx] [test] Fix MSVC warnings and errors. test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Fix MSVC x64 truncation warnings. warning C4267: conversion from 'size_t' to 'int', possible loss of data test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp Fix MSVC uninitialized memory warning. warning C6001: Using uninitialized memory 'vl'. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp Include for the assert() macro. Fixes D43273. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326120 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../exclusive.scan/exclusive_scan.pass.cpp | 16 +++++----- .../exclusive_scan_init_op.pass.cpp | 4 +-- .../inclusive.scan/inclusive_scan.pass.cpp | 12 ++++---- .../inclusive.scan/inclusive_scan_op.pass.cpp | 12 ++++---- .../inclusive_scan_op_init.pass.cpp | 26 ++++++++-------- ...sform_exclusive_scan_init_bop_uop.pass.cpp | 30 +++++++++---------- .../transform_inclusive_scan_bop_uop.pass.cpp | 18 +++++------ ...sform_inclusive_scan_bop_uop_init.pass.cpp | 30 +++++++++---------- .../string_append/push_back.pass.cpp | 2 +- ...855_tuple_ref_binding_diagnostics.pass.cpp | 1 + 10 files changed, 76 insertions(+), 75 deletions(-) diff --git a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp index 0cf6f2345..7026b73c6 100644 --- a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp +++ b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp @@ -55,31 +55,31 @@ test() test(Iter(ia), Iter(ia + i), 0, pRes, pRes + i); } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::exclusive_scan(v.begin(), v.end(), v.begin(), 50); + std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{50}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int) i * 3); + assert(v[i] == 50 + i * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::exclusive_scan(v.begin(), v.end(), v.begin(), 30); + std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{30}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 30 + triangle(i-1)); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::exclusive_scan(v.begin(), v.end(), v.begin(), 40); + std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{40}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 40 + triangle(i)); } diff --git a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp index c67716976..4fd5e236e 100644 --- a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp +++ b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp @@ -74,11 +74,11 @@ int main() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; + std::vector res; std::exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>()); assert(res.size() == 10); - int j = 1; + size_t j = 1; assert(res[0] == 1); for (size_t i = 1; i < v.size(); ++i) { diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp index a6ebe86c9..2058b8e3d 100644 --- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp +++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp @@ -55,21 +55,21 @@ test() test(Iter(ia), Iter(ia + i), pRes, pRes + i); } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == (int)(i+1) * 3); + assert(v[i] == (i+1) * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) @@ -77,7 +77,7 @@ void basic_tests() } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) @@ -85,7 +85,7 @@ void basic_tests() } { - std::vector v, res; + std::vector v, res; std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res)); assert(res.empty()); } diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp index ee1c48934..ca4da9841 100644 --- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp +++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp @@ -61,21 +61,21 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == (int)(i+1) * 3); + assert(v[i] == (i+1) * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) @@ -83,7 +83,7 @@ void basic_tests() } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) @@ -91,7 +91,7 @@ void basic_tests() } { - std::vector v, res; + std::vector v, res; std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>()); assert(res.empty()); } diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp index d0e1eb133..c3b0feb34 100644 --- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp +++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp @@ -60,38 +60,38 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 50); + std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{50}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int)(i+1) * 3); + assert(v[i] == 50 + (i+1) * 3); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 40); + std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{40}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 40 + triangle(i)); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 30); + std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{30}); for (size_t i = 0; i < v.size(); ++i) assert(v[i] == 30 + triangle(i + 1)); } { - std::vector v, res; - std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), 40); + std::vector v, res; + std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), size_t{40}); assert(res.empty()); } @@ -99,11 +99,11 @@ void basic_tests() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; - std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), 1); + std::vector res; + std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), size_t{1}); assert(res.size() == 10); - int j = 1; + size_t j = 1; assert(res[0] == 1); for (size_t i = 1; i < v.size(); ++i) { diff --git a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp index 84e18785d..ff0cb29f4 100644 --- a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp +++ b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp @@ -87,38 +87,38 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 50, std::plus<>(), add_one{}); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{50}, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int) i * 4); + assert(v[i] == 50 + i * 4); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_one{}); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{30}, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i - 1) + (int) i); + assert(v[i] == 30 + triangle(i - 1) + i); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<>(), add_one{}); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{40}, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i) + (int) i); + assert(v[i] == 40 + triangle(i) + i); } { - std::vector v, res; - std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 40, std::plus<>(), add_one{}); + std::vector v, res; + std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), size_t{40}, std::plus<>(), add_one{}); assert(res.empty()); } @@ -126,11 +126,11 @@ void basic_tests() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; - std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>(), add_one{}); + std::vector res; + std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), size_t{1}, std::multiplies<>(), add_one{}); assert(res.size() == 10); - int j = 1; + size_t j = 1; assert(res[0] == 1); for (size_t i = 1; i < res.size(); ++i) { diff --git a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp index 1cffc167e..48aeadb87 100644 --- a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp +++ b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp @@ -76,39 +76,39 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); - std::copy(v.begin(), v.end(), std::ostream_iterator(std::cout, " ")); + std::copy(v.begin(), v.end(), std::ostream_iterator(std::cout, " ")); std::cout << std::endl; for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == (int)(i+1) * 4); + assert(v[i] == (i+1) * 4); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i) + (int)(i + 1)); + assert(v[i] == triangle(i) + i + 1); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i + 1) + (int)(i + 1)); + assert(v[i] == triangle(i + 1) + i + 1); } { - std::vector v, res; + std::vector v, res; std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}); assert(res.empty()); } diff --git a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp index 7a3cdd252..00c4aafdf 100644 --- a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp +++ b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp @@ -87,38 +87,38 @@ test() } } -int triangle(int n) { return n*(n+1)/2; } +size_t triangle(size_t n) { return n*(n+1)/2; } // Basic sanity void basic_tests() { { - std::vector v(10); + std::vector v(10); std::fill(v.begin(), v.end(), 3); - std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 50); + std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{50}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 50 + (int) (i + 1) * 4); + assert(v[i] == 50 + (i + 1) * 4); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 0); - std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 30); + std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{30}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i) + (int) (i + 1)); + assert(v[i] == 30 + triangle(i) + i + 1); } { - std::vector v(10); + std::vector v(10); std::iota(v.begin(), v.end(), 1); - std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 40); + std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{40}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i + 1) + (int) (i + 1)); + assert(v[i] == 40 + triangle(i + 1) + i + 1); } { - std::vector v, res; - std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}, 1); + std::vector v, res; + std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}, size_t{1}); assert(res.empty()); } @@ -126,11 +126,11 @@ void basic_tests() { std::vector v(10); std::iota(v.begin(), v.end(), static_cast(1)); - std::vector res; - std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), add_one{}, 1); + std::vector res; + std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), add_one{}, size_t{1}); assert(res.size() == 10); - int j = 2; + size_t j = 2; assert(res[0] == 2); for (size_t i = 1; i < res.size(); ++i) { diff --git a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp index 128446534..38b68aa69 100644 --- a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -52,7 +52,7 @@ int main() { // https://bugs.llvm.org/show_bug.cgi?id=31454 std::basic_string s; - veryLarge vl; + veryLarge vl = {}; s.push_back(vl); s.push_back(vl); s.push_back(vl); diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp index 468063544..457df5602 100644 --- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp +++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "test_macros.h" #if TEST_HAS_BUILTIN_IDENTIFIER(__reference_binds_to_temporary) From 04dd960ff3d2d2b580e4cdff7f450beae1ffb9aa Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Wed, 28 Feb 2018 23:27:40 +0000 Subject: [PATCH 0387/1520] [libcxx] Fix last_write_time test for filesystems that don't support very small times. APFS minimum supported file write time is -2^63 nanoseconds, which doesn't go as far as `file_time_type::min()` that is equal to -2^63 microseconds on macOS. This change doesn't affect filesystems that support `file_time_type` range only for in-memory file time representation but not for on-disk representation. Such filesystems are considered as `SupportsMinTime`. rdar://problem/35865151 Reviewers: EricWF, Hahnfeld Subscribers: jkorous-apple, mclow.lists, cfe-commits, christof Differential Revision: https://reviews.llvm.org/D42755 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326383 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../last_write_time.pass.cpp | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp index cdd177399..0ca82b21f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -116,12 +116,31 @@ bool TestSupportsMaxTime() { return !ec && new_write_time > max_sec - 1; } +bool TestSupportsMinTime() { + using namespace std::chrono; + using Lim = std::numeric_limits; + auto min_sec = duration_cast(file_time_type::min().time_since_epoch()).count(); + if (min_sec < Lim::min()) return false; + std::error_code ec; + std::time_t old_write_time, new_write_time; + { // WARNING: Do not assert in this scope. + scoped_test_env env; + const path file = env.create_file("file", 42); + old_write_time = LastWriteTime(file); + file_time_type tp = file_time_type::min(); + fs::last_write_time(file, tp, ec); + new_write_time = LastWriteTime(file); + } + return !ec && new_write_time < min_sec + 1; +} + #if defined(__clang__) #pragma clang diagnostic pop #endif static const bool SupportsNegativeTimes = TestSupportsNegativeTimes(); static const bool SupportsMaxTime = TestSupportsMaxTime(); +static const bool SupportsMinTime = TestSupportsMinTime(); } // end namespace @@ -140,6 +159,8 @@ static const bool SupportsMaxTime = TestSupportsMaxTime(); // (B) 'tp' is non-negative or the filesystem supports negative times. // (C) 'tp' is not 'file_time_type::max()' or the filesystem supports the max // value. +// (D) 'tp' is not 'file_time_type::min()' or the filesystem supports the min +// value. inline bool TimeIsRepresentableByFilesystem(file_time_type tp) { using namespace std::chrono; using Lim = std::numeric_limits; @@ -148,6 +169,7 @@ inline bool TimeIsRepresentableByFilesystem(file_time_type tp) { if (sec < Lim::min() || sec > Lim::max()) return false; else if (microsec < 0 && !SupportsNegativeTimes) return false; else if (tp == file_time_type::max() && !SupportsMaxTime) return false; + else if (tp == file_time_type::min() && !SupportsMinTime) return false; return true; } @@ -355,20 +377,20 @@ TEST_CASE(test_write_min_time) TEST_CHECK(!ec); TEST_CHECK(tt >= new_time); TEST_CHECK(tt < new_time + Sec(1)); - } - ec = GetTestEC(); - last_write_time(p, Clock::now()); + ec = GetTestEC(); + last_write_time(p, Clock::now()); - new_time = file_time_type::min() + MicroSec(1); + new_time = file_time_type::min() + MicroSec(1); - last_write_time(p, new_time, ec); - tt = last_write_time(p); + last_write_time(p, new_time, ec); + tt = last_write_time(p); - if (TimeIsRepresentableByFilesystem(new_time)) { - TEST_CHECK(!ec); - TEST_CHECK(tt >= new_time); - TEST_CHECK(tt < new_time + Sec(1)); + if (TimeIsRepresentableByFilesystem(new_time)) { + TEST_CHECK(!ec); + TEST_CHECK(tt >= new_time); + TEST_CHECK(tt < new_time + Sec(1)); + } } } From f31b30dc555601e103a07ebeb6028ce7bf7e350d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 1 Mar 2018 21:16:07 +0000 Subject: [PATCH 0388/1520] Added P0805 to the list of ready bits git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326485 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/upcoming_meeting.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index fa2b259ed..f10e823a0 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -48,7 +48,8 @@

    Paper Status

    - + + @@ -150,7 +151,7 @@
  • 2936 - Eric - don't we do this already?
  • -

    Last Updated: 7-Feb-2018

    +

    Last Updated: 1-Mar-2018

    From 06ac7cdfc798999dddaaf55f96e4f8986a6f87d7 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Mar 2018 15:01:19 +0000 Subject: [PATCH 0389/1520] Implement P0767R1 - Deprecate POD git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326801 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../support.types/byte.pass.cpp | 6 +- .../support.types/max_align_t.pass.cpp | 7 ++ .../meta.trans.other/aligned_storage.pass.cpp | 102 ++++++++++++++++++ www/cxx2a_status.html | 4 +- 4 files changed, 116 insertions(+), 3 deletions(-) diff --git a/test/std/language.support/support.types/byte.pass.cpp b/test/std/language.support/support.types/byte.pass.cpp index 66b2a5531..a1abefa84 100644 --- a/test/std/language.support/support.types/byte.pass.cpp +++ b/test/std/language.support/support.types/byte.pass.cpp @@ -9,14 +9,18 @@ #include #include -#include +#include "test_macros.h" // XFAIL: c++98, c++03, c++11, c++14 // std::byte is not an integer type, nor a character type. // It is a distinct type for accessing the bits that ultimately make up object storage. +#if TEST_STD_VER > 17 +static_assert( std::is_trivial::value, "" ); // P0767 +#else static_assert( std::is_pod::value, "" ); +#endif static_assert(!std::is_arithmetic::value, "" ); static_assert(!std::is_integral::value, "" ); diff --git a/test/std/language.support/support.types/max_align_t.pass.cpp b/test/std/language.support/support.types/max_align_t.pass.cpp index 08a6c28a4..603b6f107 100644 --- a/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/test/std/language.support/support.types/max_align_t.pass.cpp @@ -14,11 +14,18 @@ // great as that of every scalar type #include +#include "test_macros.h" int main() { +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, + "std::is_trivial::value"); +#else static_assert(std::is_pod::value, "std::is_pod::value"); +#endif static_assert((std::alignment_of::value >= std::alignment_of::value), "std::alignment_of::value >= " diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp index 079661d0c..216cb7b5b 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -21,6 +21,12 @@ int main() typedef std::aligned_storage<10, 1 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 10, ""); @@ -29,6 +35,12 @@ int main() typedef std::aligned_storage<10, 2 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); @@ -37,6 +49,12 @@ int main() typedef std::aligned_storage<10, 4 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 12, ""); @@ -45,6 +63,12 @@ int main() typedef std::aligned_storage<10, 8 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); @@ -53,6 +77,12 @@ int main() typedef std::aligned_storage<10, 16 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); @@ -61,6 +91,12 @@ int main() typedef std::aligned_storage<10, 32 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); @@ -69,6 +105,12 @@ int main() typedef std::aligned_storage<20, 32 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); @@ -77,6 +119,12 @@ int main() typedef std::aligned_storage<40, 32 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 64, ""); @@ -85,6 +133,12 @@ int main() typedef std::aligned_storage<12, 16 >::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); @@ -93,6 +147,12 @@ int main() typedef std::aligned_storage<1>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 1, ""); @@ -101,6 +161,12 @@ int main() typedef std::aligned_storage<2>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 2, ""); @@ -109,6 +175,12 @@ int main() typedef std::aligned_storage<3>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 4, ""); @@ -117,6 +189,12 @@ int main() typedef std::aligned_storage<4>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); @@ -125,6 +203,12 @@ int main() typedef std::aligned_storage<5>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 8, ""); @@ -141,6 +225,12 @@ int main() typedef std::aligned_storage<8>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 8, ""); @@ -149,6 +239,12 @@ int main() typedef std::aligned_storage<9>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); @@ -157,6 +253,12 @@ int main() typedef std::aligned_storage<15>::type T1; #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); +#endif +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, "" ); +#else + static_assert(std::is_pod::value, "" ); #endif static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index efe59106b..7bdef1515 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -69,7 +69,7 @@ - + @@ -135,7 +135,7 @@
    Paper #GroupPaper NameMeetingStatusFirst released version
    Paper #Paper NameMeetingStatus
    P0805R1Comparing ContainersJacksonvillePatch Ready: D43773
    P0616R0LWGde-pessimize legacy algorithms with std::moveAlbuquerque
    P0653R2LWGUtility to convert a pointer to a raw pointerAlbuquerqueComplete6.0
    P0718R2LWGAtomic shared_ptrAlbuquerque
    P0767R1CWGDeprecate PODAlbuquerque
    P0767R1CWGDeprecate PODAlbuquerqueComplete7.0
    P0768R1CWGLibrary Support for the Spaceship (Comparison) OperatorAlbuquerque
    P0777R1LWGTreating Unnecessary decayAlbuquerqueComplete7.0
    -

    Last Updated: 6-Feb-2018

    +

    Last Updated: 6-Mar-2018

    From c80697556ad25765cd8b454c9b25274d06e30f85 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 6 Mar 2018 15:01:55 +0000 Subject: [PATCH 0390/1520] One more test for P0767: git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326802 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/depr/depr.c.headers/stddef_h.pass.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/test/std/depr/depr.c.headers/stddef_h.pass.cpp index 0c08c782a..219534651 100644 --- a/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stddef_h.pass.cpp @@ -13,6 +13,8 @@ #include #include +#include "test_macros.h" + #ifndef NULL #error NULL not defined #endif @@ -42,8 +44,14 @@ int main() "decltype(nullptr) == nullptr_t"); static_assert(sizeof(nullptr_t) == sizeof(void*), "sizeof(nullptr_t) == sizeof(void*)"); +#if TEST_STD_VER > 17 +// P0767 + static_assert(std::is_trivial::value, + "std::is_trivial::value"); +#else static_assert(std::is_pod::value, "std::is_pod::value"); +#endif static_assert((std::alignment_of::value >= std::alignment_of::value), "std::alignment_of::value >= " From 66c652fe0865a35afcff1195a277af810ea93522 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 7 Mar 2018 22:51:16 +0000 Subject: [PATCH 0391/1520] Include since we use it. Thanks to Andrey Maksimov for the catch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326958 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/std/numerics/rand/rand.device/eval.pass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp index 56690316c..e5a2a32ee 100644 --- a/test/std/numerics/rand/rand.device/eval.pass.cpp +++ b/test/std/numerics/rand/rand.device/eval.pass.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "test_macros.h" From 46b8a51b49ec0930425a4c55c68e24f47f47a481 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 8 Mar 2018 15:01:50 +0000 Subject: [PATCH 0392/1520] Implement LWG#2518 - Non-member swap for propagate_const should call member swap git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327005 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/propagate_const | 3 +-- www/cxx1z_status.html | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/experimental/propagate_const b/include/experimental/propagate_const index e7f7e9fc6..188548596 100644 --- a/include/experimental/propagate_const +++ b/include/experimental/propagate_const @@ -463,8 +463,7 @@ template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { - using _VSTD::swap; - swap(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); + __pc1.swap(__pc2); } template diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 5cead9b1c..29f99c059 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -375,7 +375,7 @@ 2503multiline option should be added to syntax_option_typeIssaquah 2510Tag types should not be DefaultConstructibleIssaquah 2514Type traits must not be finalIssaquahComplete - 2518[fund.ts.v2] Non-member swap for propagate_const should call member swapIssaquah + 2518[fund.ts.v2] Non-member swap for propagate_const should call member swapIssaquahComplete 2519Iterator operator-= has gratuitous undefined behaviourIssaquahComplete 2521[fund.ts.v2] weak_ptr's converting move constructor should be modified as well for array supportIssaquah 2525[fund.ts.v2] get_memory_resource should be const and noexceptIssaquah @@ -504,7 +504,7 @@ -

    Last Updated: 12-Feb-2018

    +

    Last Updated: 8-Mar-2018

    From 2b588cbf15d89fae557dc03221e67ee4d61d43d2 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 8 Mar 2018 21:15:26 +0000 Subject: [PATCH 0393/1520] Low-hanging fruit optimization in string::__move_assign(). shrink_to_fit() ends up doing a lot work to get information that we already know since we just called clear(). This change seems concise enough to be worth the couple extra lines and my benchmarks show that it is indeed a pretty decent win. It looks like the same thing is going on twice in __copy_assign_alloc(), but I didn't want to go overboard since this is my first contribution to llvm/libc++. Patch by Timothy VanSlyke! Differential Revision: https://reviews.llvm.org/D41976 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327064 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 27 ++++++++--- .../clear_and_shrink_db1.pass.cpp | 48 +++++++++++++++++++ 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp diff --git a/include/string b/include/string index e8ec709c2..2630799c0 100644 --- a/include/string +++ b/include/string @@ -1257,6 +1257,8 @@ public: _LIBCPP_INLINE_VISIBILITY bool __invariants() const; + _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink(); + _LIBCPP_INLINE_VISIBILITY bool __is_long() const _NOEXCEPT {return bool(__r_.first().__s.__size_ & __short_mask);} @@ -1426,16 +1428,14 @@ private: { if (!__str.__is_long()) { - clear(); - shrink_to_fit(); + __clear_and_shrink(); __alloc() = __str.__alloc(); } else { allocator_type __a = __str.__alloc(); pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap()); - clear(); - shrink_to_fit(); + __clear_and_shrink(); __alloc() = _VSTD::move(__a); __set_long_pointer(__p); __set_long_cap(__str.__get_long_cap()); @@ -2125,8 +2125,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr _NOEXCEPT_(is_nothrow_move_assignable::value) #endif { - clear(); - shrink_to_fit(); + __clear_and_shrink(); __r_.first() = __str.__r_.first(); __move_assign_alloc(__str); __str.__zero(); @@ -3579,6 +3578,22 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const return true; } +// __clear_and_shrink + +template +inline _LIBCPP_INLINE_VISIBILITY +void +basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() +{ + clear(); + if(__is_long()) + { + __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); + __set_long_cap(0); + __set_short_size(0); + } +} + // operator== template diff --git a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp new file mode 100644 index 000000000..b7e278b75 --- /dev/null +++ b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// Call __clear_and_shrink() and ensure string invariants hold + +#if _LIBCPP_DEBUG >= 1 + +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include + +int main() +{ + std::string l = "Long string so that allocation definitely, for sure, absolutely happens. Probably."; + std::string s = "short"; + + assert(l.__invariants()); + assert(s.__invariants()); + + s.__clear_and_shrink(); + assert(s.__invariants()); + assert(s.size() == 0); + + { + std::string::size_type cap = l.capacity(); + l.__clear_and_shrink(); + assert(l.__invariants()); + assert(l.size() == 0); + assert(l.capacity() < cap); + } +} + +#else + +int main() +{ +} + +#endif From 057ac7c9daee48ca8a7cbfe2687db54e5abd279b Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Fri, 9 Mar 2018 22:13:12 +0000 Subject: [PATCH 0394/1520] XFAIL: libcpp-no-deduction-guides in libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp Summary: Refactor the previous version method of marking each apple-clang version as UNSUPPORTED and just XFAIL'ing the libcpp-no-deduction-guides instead. This brings this test inline with the same style as iter_alloc_deduction.pass.cpp Reviewers: EricWF, dexonsmith Reviewed By: EricWF Subscribers: EricWF, vsapsai, vsk, cfe-commits Differential Revision: https://reviews.llvm.org/D44103 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327178 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 65aba0493..ce710072b 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,8 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// XFAIL: libcpp-no-deduction-guides // template::value_type>> From 00c27d8a40788386d324528e75dc41f2e798af45 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Sat, 10 Mar 2018 00:19:25 +0000 Subject: [PATCH 0395/1520] [libcxx][test] Marking libcpp-no-deduction-guides unsupported. This fixes linux bot failures with r327178. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327190 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index ce710072b..94b9e25f4 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: libcpp-no-deduction-guides +// UNSUPPORTED: libcpp-no-deduction-guides // template::value_type>> From 7c796ffe54f43310299cf8e3d3ff1f492eb3a4bf Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Sat, 10 Mar 2018 00:53:05 +0000 Subject: [PATCH 0396/1520] [libcxx][test] Reverting r327178 and r327190. Reverting changes made to iter_alloc_deduction.fail.cpp as my changes seem to be making several Linux bots angry. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327191 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 94b9e25f4..65aba0493 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -9,7 +9,8 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 // template::value_type>> From 698b6951472a52d1a26de1cbab1e831d3db37189 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Sat, 10 Mar 2018 01:20:11 +0000 Subject: [PATCH 0397/1520] [CMake] Copy the generated __config header into build directory When the generated __config file is being used, it is currently only copied during installation process. However, that means that the file that gets copied into LLVM build directory is the vanilla __config file, and any parts of the build that depend on the just built toolchain like sanitizers will get that instead of the generated version. To avoid this issue, we need to copy the generated header into the LLVM build directory as well. Differential Revision: https://reviews.llvm.org/D43797 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327194 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/CMakeLists.txt | 40 ++++++++++++++++++++++++++-------------- lib/CMakeLists.txt | 2 +- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index b98e09260..5bf92f016 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -2,6 +2,23 @@ if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS) set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE) endif() +if (LIBCXX_NEEDS_SITE_CONFIG) + # Generate a custom __config header. The new header is created + # by prepending __config_site to the current __config header. + add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config + COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py + ${LIBCXX_BINARY_DIR}/__config_site + ${LIBCXX_SOURCE_DIR}/include/__config + -o ${LIBCXX_BINARY_DIR}/__generated_config + DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config + ${LIBCXX_BINARY_DIR}/__config_site + ) + # Add a target that executes the generation commands. + add_custom_target(generate_config_header ALL + DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) + set(generated_config_deps generate_config_header) +endif() + set(LIBCXX_HEADER_PATTERN PATTERN "*" PATTERN "CMakeLists.txt" EXCLUDE @@ -16,6 +33,15 @@ if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR) FILES_MATCHING ${LIBCXX_HEADER_PATTERN} ) + + if (LIBCXX_NEEDS_SITE_CONFIG) + # Copy the generated header as __config into build directory. + add_custom_command( + TARGET generate_config_header POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${LIBCXX_BINARY_DIR}/__generated_config + ${LLVM_BINARY_DIR}/include/c++/v1/__config) + endif() endif() if (LIBCXX_INSTALL_HEADERS) @@ -28,20 +54,6 @@ if (LIBCXX_INSTALL_HEADERS) ) if (LIBCXX_NEEDS_SITE_CONFIG) - # Generate and install a custom __config header. The new header is created - # by prepending __config_site to the current __config header. - add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config - COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py - ${LIBCXX_BINARY_DIR}/__config_site - ${LIBCXX_SOURCE_DIR}/include/__config - -o ${LIBCXX_BINARY_DIR}/__generated_config - DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config - ${LIBCXX_BINARY_DIR}/__config_site - ) - # Add a target that executes the generation commands. - add_custom_target(generate_config_header ALL - DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) - set(generated_config_deps generate_config_header) # Install the generated header as __config. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5d7111156..30fdc3075 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -283,7 +283,7 @@ if (LIBCXX_ENABLE_STATIC) endif() # Add a meta-target for both libraries. -add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS}) +add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps}) if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) From ddb6e5f2ef142a5af2060ded298dffc887b2fbea Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 12 Mar 2018 18:06:37 +0000 Subject: [PATCH 0398/1520] [libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp. After two failed attempts last week to make this work I am going back to a known good method of making this test pass on macOS...adding the current apple-clang version to the UNSUPPORTED list. During a previous patch review (https://reviews.llvm.org/D44103) it was suggested to just XFAIL libcpp-no-deduction-guides as was done to iter_alloc_deduction.pass.cpp. However this caused a an unexpected pass on: http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std/builds/214 I then attempted to just mark libcpp-no-deduction-guides as UNSUPPORTED, however this caused an additional bot failure. So I reverted everything (https://reviews.llvm.org/rCXX327191). To solve this and get work unblocked I am adding apple-clang-9 to the original UNSUPPORTED list. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327304 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../basic.string/string.cons/iter_alloc_deduction.fail.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp index 65aba0493..321dc9f02 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp @@ -10,7 +10,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0, apple-clang-9 // template::value_type>> From 6ce040b9aabec88e616853f0c48408d60b41a151 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 18 Mar 2018 19:29:21 +0000 Subject: [PATCH 0399/1520] Updated C++2a status with changes from Jacksonville WG21 meeting git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327806 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/cxx2a_status.html | 47 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 7bdef1515..1ed30839f 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -72,6 +72,15 @@ P0767R1CWGDeprecate PODAlbuquerqueComplete7.0 P0768R1CWGLibrary Support for the Spaceship (Comparison) OperatorAlbuquerque P0777R1LWGTreating Unnecessary decayAlbuquerqueComplete7.0 + P0122R7LWG<span>Jacksonville + P0355R7LWGExtending chrono to Calendars and Time ZonesJacksonville + P0551R3LWGThou Shalt Not Specialize std Function Templates!Jacksonville + P0753R2LWGManipulators for C++ Synchronized Buffered OstreamJacksonville + P0754R2LWG<version>Jacksonville + P0809R0LWGComparing Unordered ContainersJacksonville + P0858R0LWGConstexpr iterator requirementsJacksonville + P0905R1CWGSymmetry for spaceshipJacksonville + P0966R1LWGstring::reserve Should Not ShrinkJacksonville @@ -132,10 +141,46 @@ 3001weak_ptr::element_type needs remove_extent_tAlbuquerque 3024variant's copies must be deleted instead of disabled via SFINAEAlbuquerque + + 2164What are the semantics of vector.emplace(vector.begin(), vector.back())?Jacksonville + 2243istream::putback problemJacksonvilleComplete + 2816resize_file has impossible postconditionJacksonvilleNothing to do + 2843Unclear behavior of std::pmr::memory_resource::do_allocate()Jacksonville + 2849Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?JacksonvilleNothing to do + 2851std::filesystem enum classes are now underspecifiedJacksonvilleNothing to do + 2946LWG 2758's resolution missed further correctionsJacksonville + 2969polymorphic_allocator::construct() shouldn't pass resource()Jacksonville + 2975Missing case for pair construction in scoped and polymorphic allocatorsJacksonville + 2989path's stream insertion operator lets you insert everything under the sunJacksonvilleCompleted + 3000monotonic_memory_resource::do_is_equal uses dynamic_cast unnecessarilyJacksonville + 3002[networking.ts] basic_socket_acceptor::is_open() isn't noexceptJacksonville + 3004§[string.capacity] and §[vector.capacity] should specify time complexity for capacity()JacksonvilleNothing to do + 3005Destruction order of arrays by make_shared/allocate_shared only recommended?Jacksonville + 3007allocate_shared should rebind allocator to cv-unqualified value_type for constructionJacksonville + 3009Including <string_view> doesn't provide std::size/empty/dataJacksonvilleComplete + 3010[networking.ts] uses_executor says "if a type T::executor_type exists"Jacksonville + 3013(recursive_)directory_iterator construction and traversal should not be noexceptJacksonvilleComplete + 3014More noexcept issues with filesystem operationsJacksonvilleComplete + 3015copy_options::unspecified underspecifiedJacksonvilleNothing to do + 3017list splice functions should use addressofJacksonville + 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville + 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville + 3030Who shall meet the requirements of try_lock?JacksonvilleNothing to do + 3034P0767R1 breaks previously-standard-layout typesJacksonville + 3035std::allocator's constructors should be constexprJacksonville + 3039Unnecessary decay in thread and packaged_taskJacksonville + 3041Unnecessary decay in reference_wrapperJacksonville + 3042is_literal_type_v should be inlineJacksonvilleComplete + 3043Bogus postcondition for filesystem_error constructorJacksonville + 3045atomic<floating-point> doesn't have value_type or difference_typeJacksonville + 3048transform_reduce(exec, first1, last1, first2, init) discards execution policyJacksonville + 3051Floating point classifications were inadvertently changed in P0175JacksonvilleNothing to do + 3075basic_string needs deduction guides from basic_string_viewJacksonville + -

    Last Updated: 6-Mar-2018

    +

    Last Updated: 18-Mar-2018

    From 483bc7c64a43ff86c2f082b2a8305efbc70b97ca Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 20 Mar 2018 22:37:37 +0000 Subject: [PATCH 0400/1520] Implement LWG 3039 and 3041 - 'Treating Unnecessary decay'. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328054 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/future | 8 ++++---- include/thread | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/future b/include/future index a7c28a474..536574e75 100644 --- a/include/future +++ b/include/future @@ -2021,7 +2021,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type @@ -2032,7 +2032,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type @@ -2150,7 +2150,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type @@ -2161,7 +2161,7 @@ public: class = typename enable_if < !is_same< - typename decay<_Fp>::type, + typename __uncvref<_Fp>::type, packaged_task >::value >::type diff --git a/include/thread b/include/thread index 1b8dca394..0629d70ef 100644 --- a/include/thread +++ b/include/thread @@ -298,7 +298,7 @@ public: template ::type, thread>::value + !is_same::type, thread>::value >::type > _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS From dfeb9b2af78112e21e2aaf6be8f15634c549409f Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 20 Mar 2018 23:02:53 +0000 Subject: [PATCH 0401/1520] Implement LWG3035: std::allocator's constructors should be constexpr. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328059 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/memory | 25 +++++++--- .../default.allocator/allocator.ctor.pass.cpp | 50 +++++++++++++++++++ 2 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp diff --git a/include/memory b/include/memory index bc5c4c653..ea52ba2cb 100644 --- a/include/memory +++ b/include/memory @@ -126,9 +126,10 @@ public: template struct rebind {typedef allocator other;}; - allocator() noexcept; - allocator(const allocator&) noexcept; - template allocator(const allocator&) noexcept; + constexpr allocator() noexcept; // constexpr in C++20 + constexpr allocator(const allocator&) noexcept; // constexpr in C++20 + template + constexpr allocator(const allocator&) noexcept; // constexpr in C++20 ~allocator(); pointer address(reference x) const noexcept; const_pointer address(const_reference x) const noexcept; @@ -1778,8 +1779,13 @@ public: template struct rebind {typedef allocator<_Up> other;}; - _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} - template _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator() _NOEXCEPT {} + + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT @@ -1877,8 +1883,13 @@ public: template struct rebind {typedef allocator<_Up> other;}; - _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} - template _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator() _NOEXCEPT {} + + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator::const_pointer = 0) diff --git a/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp new file mode 100644 index 000000000..3841cb533 --- /dev/null +++ b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// +// template +// class allocator +// { +// public: // All of these are constexpr after C++17 +// constexpr allocator() noexcept; +// constexpr allocator(const allocator&) noexcept; +// template constexpr allocator(const allocator&) noexcept; +// ... +// }; + +#include +#include + +#include "test_macros.h" + + +int main() +{ + { + typedef std::allocator AC; + typedef std::allocator AL; + + constexpr AC a1; + constexpr AC a2{a1}; + constexpr AL a3{a2}; + (void) a3; + } + { + typedef std::allocator AC; + typedef std::allocator AL; + + constexpr AC a1; + constexpr AC a2{a1}; + constexpr AL a3{a2}; + (void) a3; + } + +} From 256f187bc66b6771968af526a4626c058dcc4c40 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 21 Mar 2018 00:36:05 +0000 Subject: [PATCH 0402/1520] Implement LWG3034: P0767R1 breaks previously-standard-layout types git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328064 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/string | 8 +-- include/string_view | 4 +- .../std/depr/depr.c.headers/stddef_h.pass.cpp | 2 + .../support.types/max_align_t.pass.cpp | 7 ++- .../strings/basic.string/char.bad.fail.cpp | 53 +++++++++++++++++++ .../std/strings/string.view/char.bad.fail.cpp | 53 +++++++++++++++++++ .../meta.trans.other/aligned_storage.pass.cpp | 45 ++++++++++++++++ .../meta.trans.other/aligned_union.pass.cpp | 21 ++++++++ www/cxx2a_status.html | 10 ++-- 9 files changed, 192 insertions(+), 11 deletions(-) create mode 100644 test/std/strings/basic.string/char.bad.fail.cpp create mode 100644 test/std/strings/string.view/char.bad.fail.cpp diff --git a/include/string b/include/string index 2630799c0..7218aa2e4 100644 --- a/include/string +++ b/include/string @@ -658,10 +658,12 @@ public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; - static_assert(is_trivial::value, "Character type of basic_string must be trivial"); - static_assert((is_same<_CharT, typename traits_type::char_type>::value), + static_assert((!is_array::value), "Character type of basic_string must not be an array"); + static_assert(( is_standard_layout::value), "Character type of basic_string must be standard-layout"); + static_assert(( is_trivial::value), "Character type of basic_string must be trivial"); + static_assert(( is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); - static_assert((is_same::value), + static_assert(( is_same::value), "Allocator::value_type must be same type as value_type"); #if defined(_LIBCPP_RAW_ITERATORS) typedef pointer iterator; diff --git a/include/string_view b/include/string_view index fd8c3790b..6377aeb6d 100644 --- a/include/string_view +++ b/include/string_view @@ -208,7 +208,9 @@ public: typedef ptrdiff_t difference_type; static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); - static_assert(is_trivial::value, "Character type of basic_string_view must be trivial"); + static_assert((!is_array::value), "Character type of basic_string_view must not be an array"); + static_assert(( is_standard_layout::value), "Character type of basic_string_view must be standard-layout"); + static_assert(( is_trivial::value), "Character type of basic_string_view must be trivial"); static_assert((is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); diff --git a/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/test/std/depr/depr.c.headers/stddef_h.pass.cpp index 219534651..68f70b80e 100644 --- a/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stddef_h.pass.cpp @@ -48,6 +48,8 @@ int main() // P0767 static_assert(std::is_trivial::value, "std::is_trivial::value"); + static_assert(std::is_standard_layout::value, + "std::is_standard_layout::value"); #else static_assert(std::is_pod::value, "std::is_pod::value"); diff --git a/test/std/language.support/support.types/max_align_t.pass.cpp b/test/std/language.support/support.types/max_align_t.pass.cpp index 603b6f107..dc202897a 100644 --- a/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/test/std/language.support/support.types/max_align_t.pass.cpp @@ -10,18 +10,21 @@ #include #include -// max_align_t is a POD type whose alignment requirement is at least as -// great as that of every scalar type +// max_align_t is a trivial standard-layout type whose alignment requirement +// is at least as great as that of every scalar type #include #include "test_macros.h" int main() { + #if TEST_STD_VER > 17 // P0767 static_assert(std::is_trivial::value, "std::is_trivial::value"); + static_assert(std::is_standard_layout::value, + "std::is_standard_layout::value"); #else static_assert(std::is_pod::value, "std::is_pod::value"); diff --git a/test/std/strings/basic.string/char.bad.fail.cpp b/test/std/strings/basic.string/char.bad.fail.cpp new file mode 100644 index 000000000..1878cd02c --- /dev/null +++ b/test/std/strings/basic.string/char.bad.fail.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// ... manipulating sequences of any non-array trivial standard-layout types. + +#include +#include "test_traits.h" + +struct NotTrivial { + NotTrivial() : value(3) {} + int value; +}; + +struct NotStandardLayout { +public: + NotStandardLayout() : one(1), two(2) {} + int sum() const { return one + two; } // silences "unused field 'two' warning" + int one; +private: + int two; +}; + +int main() +{ + { +// array + typedef char C[3]; + static_assert(std::is_array::value, ""); + std::basic_string > s; +// expected-error-re@string:* {{static_assert failed{{.*}} "Character type of basic_string must not be an array"}} + } + + { +// not trivial + static_assert(!std::is_trivial::value, ""); + std::basic_string > s; +// expected-error-re@string:* {{static_assert failed{{.*}} "Character type of basic_string must be trivial"}} + } + + { +// not standard layout + static_assert(!std::is_standard_layout::value, ""); + std::basic_string > s; +// expected-error-re@string:* {{static_assert failed{{.*}} "Character type of basic_string must be standard-layout"}} + } +} diff --git a/test/std/strings/string.view/char.bad.fail.cpp b/test/std/strings/string.view/char.bad.fail.cpp new file mode 100644 index 000000000..cbd2b47b9 --- /dev/null +++ b/test/std/strings/string.view/char.bad.fail.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// ... manipulating sequences of any non-array trivial standard-layout types. + +#include +#include "../basic.string/test_traits.h" + +struct NotTrivial { + NotTrivial() : value(3) {} + int value; +}; + +struct NotStandardLayout { +public: + NotStandardLayout() : one(1), two(2) {} + int sum() const { return one + two; } // silences "unused field 'two' warning" + int one; +private: + int two; +}; + +int main() +{ + { +// array + typedef char C[3]; + static_assert(std::is_array::value, ""); + std::basic_string_view > sv; +// expected-error-re@string_view:* {{static_assert failed{{.*}} "Character type of basic_string_view must not be an array"}} + } + + { +// not trivial + static_assert(!std::is_trivial::value, ""); + std::basic_string_view > sv; +// expected-error-re@string_view:* {{static_assert failed{{.*}} "Character type of basic_string_view must be trivial"}} + } + + { +// not standard layout + static_assert(!std::is_standard_layout::value, ""); + std::basic_string_view > sv; +// expected-error-re@string_view:* {{static_assert failed{{.*}} "Character type of basic_string_view must be standard-layout"}} + } +} diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp index 216cb7b5b..5f3146edd 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -10,6 +10,9 @@ // type_traits // aligned_storage +// +// Issue 3034 added: +// The member typedef type shall be a trivial standard-layout type. #include #include // for std::max_align_t @@ -28,6 +31,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 10, ""); } @@ -42,6 +47,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -56,6 +63,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 12, ""); } @@ -70,6 +79,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -84,6 +95,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); } @@ -98,6 +111,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); } @@ -112,6 +127,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 32, ""); } @@ -126,6 +143,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 32, ""); static_assert(sizeof(T1) == 64, ""); } @@ -140,6 +159,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 16, ""); static_assert(sizeof(T1) == 16, ""); } @@ -154,6 +175,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 1, ""); } @@ -168,6 +191,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 2, ""); } @@ -182,6 +207,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 4, ""); } @@ -196,6 +223,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } @@ -210,6 +239,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 8, ""); } @@ -218,6 +249,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 8, ""); } @@ -232,6 +265,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 8, ""); } @@ -246,6 +281,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -260,6 +297,8 @@ int main() #else static_assert(std::is_pod::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -274,6 +313,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == alignof(std::max_align_t), ""); static_assert(sizeof(T1) == 16, ""); @@ -283,6 +324,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == alignof(std::max_align_t), ""); static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), ""); @@ -292,6 +335,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp index 883548270..3e58b51a6 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp @@ -13,6 +13,9 @@ // aligned_union +// Issue 3034 added: +// The member typedef type shall be a trivial standard-layout type. + #include #include "test_macros.h" @@ -24,6 +27,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 1, ""); static_assert(sizeof(T1) == 10, ""); } @@ -32,6 +37,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -40,6 +47,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 12, ""); } @@ -48,6 +57,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 8, ""); static_assert(sizeof(T1) == 16, ""); } @@ -56,6 +67,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -64,6 +77,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 2, ""); static_assert(sizeof(T1) == 10, ""); } @@ -72,6 +87,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } @@ -80,6 +97,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } @@ -88,6 +107,8 @@ int main() #if TEST_STD_VER > 11 static_assert(std::is_same, T1>::value, "" ); #endif + static_assert(std::is_trivial::value, ""); + static_assert(std::is_standard_layout::value, ""); static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 1ed30839f..4ecfc795d 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -166,10 +166,10 @@ 3020[networking.ts] Remove spurious nested value_type buffer sequence requirementJacksonville 3026filesystem::weakly_canonical still defined in terms of canonical(p, base)Jacksonville 3030Who shall meet the requirements of try_lock?JacksonvilleNothing to do - 3034P0767R1 breaks previously-standard-layout typesJacksonville - 3035std::allocator's constructors should be constexprJacksonville - 3039Unnecessary decay in thread and packaged_taskJacksonville - 3041Unnecessary decay in reference_wrapperJacksonville + 3034P0767R1 breaks previously-standard-layout typesJacksonvilleComplete + 3035std::allocator's constructors should be constexprJacksonvilleComplete + 3039Unnecessary decay in thread and packaged_taskJacksonvilleComplete + 3041Unnecessary decay in reference_wrapperJacksonvilleComplete 3042is_literal_type_v should be inlineJacksonvilleComplete 3043Bogus postcondition for filesystem_error constructorJacksonville 3045atomic<floating-point> doesn't have value_type or difference_typeJacksonville @@ -180,7 +180,7 @@ -

    Last Updated: 18-Mar-2018

    +

    Last Updated: 20-Mar-2018

    From a83128739983c83eaf1ba4c2bc0e3aa570082d15 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 04:42:56 +0000 Subject: [PATCH 0403/1520] Fix PR22634 - std::allocator doesn't respect over-aligned types. This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328180 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 1 + include/__sso_allocator | 4 +- include/memory | 37 +--- include/new | 51 +++++- include/valarray | 58 +++--- src/experimental/memory_resource.cpp | 6 +- .../allocator.members/allocate.pass.cpp | 98 +++++++--- test/support/count_new.hpp | 169 +++++++++++++++++- test/support/test_macros.h | 6 + 9 files changed, 343 insertions(+), 87 deletions(-) diff --git a/include/__config b/include/__config index f96d74374..d150ede18 100644 --- a/include/__config +++ b/include/__config @@ -955,6 +955,7 @@ template struct __static_assert_check {}; # endif #endif // defined(__APPLE__) + #if defined(__APPLE__) || defined(__FreeBSD__) #define _LIBCPP_HAS_DEFAULTRUNELOCALE #endif diff --git a/include/__sso_allocator b/include/__sso_allocator index 8147e75ec..40027363a 100644 --- a/include/__sso_allocator +++ b/include/__sso_allocator @@ -55,14 +55,14 @@ public: __allocated_ = true; return (pointer)&buf_; } - return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) { if (__p == (pointer)&buf_) __allocated_ = false; else - _VSTD::__libcpp_deallocate(__p); + _VSTD::__libcpp_deallocate(__p, __alignof(_Tp)); } _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);} diff --git a/include/memory b/include/memory index ea52ba2cb..021bd136a 100644 --- a/include/memory +++ b/include/memory @@ -1796,10 +1796,10 @@ public: if (__n > max_size()) __throw_length_error("allocator::allocate(size_t n)" " 'n' exceeds maximum supported size"); - return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {_VSTD::__libcpp_deallocate((void*)__p);} + {_VSTD::__libcpp_deallocate((void*)__p, __alignof(_Tp));} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -1897,10 +1897,10 @@ public: if (__n > max_size()) __throw_length_error("allocator::allocate(size_t n)" " 'n' exceeds maximum supported size"); - return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p));} + {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __alignof(_Tp));} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -2016,12 +2016,7 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT while (__n > 0) { #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) -#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) - if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -#else - if (std::alignment_of<_Tp>::value > - std::alignment_of::value) -#endif + if (__is_overaligned_for_new(__alignof(_Tp))) { std::align_val_t __al = std::align_val_t(std::alignment_of<_Tp>::value); @@ -2032,12 +2027,7 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT __n * sizeof(_Tp), nothrow)); } #else -#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) - if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -#else - if (std::alignment_of<_Tp>::value > - std::alignment_of::value) -#endif + if (__is_overaligned_for_new(__alignof(_Tp))) { // Since aligned operator new is unavailable, return an empty // buffer rather than one with invalid alignment. @@ -2061,20 +2051,7 @@ template inline _LIBCPP_INLINE_VISIBILITY void return_temporary_buffer(_Tp* __p) _NOEXCEPT { -#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) -#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__) - if (std::alignment_of<_Tp>::value > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -#else - if (std::alignment_of<_Tp>::value > - std::alignment_of::value) -#endif - { - std::align_val_t __al = std::align_val_t(std::alignment_of<_Tp>::value); - ::operator delete(__p, __al); - return; - } -#endif - ::operator delete(__p); + _VSTD::__libcpp_deallocate((void*)__p, __alignof(_Tp)); } #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) diff --git a/include/new b/include/new index 27c248c83..e42ffad27 100644 --- a/include/new +++ b/include/new @@ -89,6 +89,7 @@ void operator delete[](void* ptr, void*) noexcept; #include <__config> #include +#include #include #ifdef _LIBCPP_NO_EXCEPTIONS #include @@ -113,6 +114,14 @@ void operator delete[](void* ptr, void*) noexcept; # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION #endif + +#if !__has_builtin(__builtin_operator_new) || \ + __has_builtin(__builtin_operator_new) < 201802L || \ + defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ + !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606 +#define _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE +#endif + namespace std // purposefully not using versioning namespace { @@ -223,7 +232,27 @@ inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT _LIBCPP_BEGIN_NAMESPACE_STD -inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { +_LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT { +#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ + return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__; +#else + return __align > alignment_of::value; +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) { +#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) { + const align_val_t __align_val = static_cast(__align); +# ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE + return ::operator new(__size, __align_val); +# else + return __builtin_operator_new(__size, __align_val); +# endif + } +#else + ((void)__align); +#endif #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE return ::operator new(__size); #else @@ -231,11 +260,23 @@ inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { #endif } -inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) { -#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE - ::operator delete(__ptr); +inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __align) { +#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) { + const align_val_t __align_val = static_cast(__align); +# ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE + return ::operator delete(__ptr, __align_val); +# else + return __builtin_operator_delete(__ptr, __align_val); +# endif + } #else - __builtin_operator_delete(__ptr); + ((void)__align); +#endif +#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE + return ::operator delete(__ptr); +#else + return __builtin_operator_delete(__ptr); #endif } diff --git a/include/valarray b/include/valarray index b495ccf57..8d3892ad3 100644 --- a/include/valarray +++ b/include/valarray @@ -2738,7 +2738,8 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(result_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(result_type), __alignof(result_type))); for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i) ::new (__r.__end_) result_type(__expr_[__i]); } @@ -2755,7 +2756,8 @@ valarray<_Tp>::valarray(size_t __n) { if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2789,7 +2791,8 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n) { if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2814,7 +2817,8 @@ valarray<_Tp>::valarray(const valarray& __v) { if (__v.size()) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__v.size() * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__v.size() * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2851,7 +2855,8 @@ valarray<_Tp>::valarray(initializer_list __il) size_t __n = __il.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( +_VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2879,7 +2884,8 @@ valarray<_Tp>::valarray(const slice_array& __sa) size_t __n = __sa.__size_; if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2905,7 +2911,8 @@ valarray<_Tp>::valarray(const gslice_array& __ga) size_t __n = __ga.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2934,7 +2941,8 @@ valarray<_Tp>::valarray(const mask_array& __ma) size_t __n = __ma.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2963,7 +2971,8 @@ valarray<_Tp>::valarray(const indirect_array& __ia) size_t __n = __ia.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2999,7 +3008,8 @@ valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) if (size() != __n) { __clear(); - __begin_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); __end_ = __begin_ + __n; _VSTD::uninitialized_copy(__f, __l, __begin_); } else { @@ -3254,7 +3264,8 @@ valarray<_Tp>::operator+() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(+*__p); } @@ -3271,7 +3282,8 @@ valarray<_Tp>::operator-() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(-*__p); } @@ -3288,7 +3300,8 @@ valarray<_Tp>::operator~() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(~*__p); } @@ -3305,7 +3318,7 @@ valarray<_Tp>::operator!() const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(bool))); + static_cast(_VSTD::__libcpp_allocate(__n * sizeof(bool), __alignof(bool))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) bool(!*__p); } @@ -3625,7 +3638,8 @@ valarray<_Tp>::shift(int __i) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); const value_type* __sb; value_type* __tb; value_type* __te; @@ -3663,7 +3677,8 @@ valarray<_Tp>::cshift(int __i) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); __i %= static_cast(__n); const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i; for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s) @@ -3684,7 +3699,8 @@ valarray<_Tp>::apply(value_type __f(value_type)) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(__f(*__p)); } @@ -3701,7 +3717,8 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const { __r.__begin_ = __r.__end_ = - static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(__f(*__p)); } @@ -3716,7 +3733,7 @@ valarray<_Tp>::__clear() { while (__end_ != __begin_) (--__end_)->~value_type(); - _VSTD::__libcpp_deallocate(__begin_); + _VSTD::__libcpp_deallocate(__begin_, __alignof(value_type)); __begin_ = __end_ = nullptr; } } @@ -3728,7 +3745,8 @@ valarray<_Tp>::resize(size_t __n, value_type __x) __clear(); if (__n) { - __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast( + _VSTD::__libcpp_allocate(__n * sizeof(value_type), __alignof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { diff --git a/src/experimental/memory_resource.cpp b/src/experimental/memory_resource.cpp index c4dc1ca89..a6eca3743 100644 --- a/src/experimental/memory_resource.cpp +++ b/src/experimental/memory_resource.cpp @@ -31,10 +31,10 @@ public: protected: virtual void* do_allocate(size_t __size, size_t __align) - { return __allocate(__size); } + { return _VSTD::__libcpp_allocate(__size, __align); /* FIXME */} - virtual void do_deallocate(void * __p, size_t, size_t) - { _VSTD::__libcpp_deallocate(__p); } + virtual void do_deallocate(void * __p, size_t, size_t __align) + { _VSTD::__libcpp_deallocate(__p, __align); /* FIXME */ } virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT { return &__other == this; } diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp index f2cf9f2d4..930da0b79 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp @@ -15,39 +15,93 @@ #include #include +#include "test_macros.h" #include "count_new.hpp" -int A_constructed = 0; -struct A -{ - int data; - A() {++A_constructed;} - A(const A&) {++A_constructed;} - ~A() {--A_constructed;} +#ifdef TEST_HAS_NO_ALIGNED_ALLOCATION +static const bool UsingAlignedNew = false; +#else +static const bool UsingAlignedNew = true; +#endif + +#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ +static const size_t MaxAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__; +#else +static const size_t MaxAligned = std::alignment_of::value; +#endif + +static const size_t OverAligned = MaxAligned * 2; + + +template +struct TEST_ALIGNAS(Align) AlignedType { + char data; + static int constructed; + AlignedType() { ++constructed; } + AlignedType(AlignedType const&) { ++constructed; } + ~AlignedType() { --constructed; } }; +template +int AlignedType::constructed = 0; -int main() -{ - globalMemCounter.reset(); - std::allocator a; + +template +void test_aligned() { + typedef AlignedType T; + T::constructed = 0; + globalMemCounter.reset(); + std::allocator a; + const bool IsOverAlignedType = Align > MaxAligned; + const bool ExpectAligned = IsOverAlignedType && UsingAlignedNew; + { assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A_constructed == 0); + assert(T::constructed == 0); globalMemCounter.last_new_size = 0; - A* volatile ap = a.allocate(3); + globalMemCounter.last_new_align = 0; + T* volatile ap = a.allocate(3); assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); - assert(A_constructed == 0); + assert(globalMemCounter.checkNewCalledEq(1)); + assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(T))); + assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + globalMemCounter.last_delete_align = 0; a.deallocate(ap, 3); assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A_constructed == 0); - + assert(globalMemCounter.checkDeleteCalledEq(1)); + assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + } + globalMemCounter.reset(); + { globalMemCounter.last_new_size = 0; - A* volatile ap2 = a.allocate(3, (const void*)5); + globalMemCounter.last_new_align = 0; + T* volatile ap2 = a.allocate(11, (const void*)5); assert(globalMemCounter.checkOutstandingNewEq(1)); - assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); - assert(A_constructed == 0); - a.deallocate(ap2, 3); + assert(globalMemCounter.checkNewCalledEq(1)); + assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastNewSizeEq(11 * sizeof(T))); + assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + globalMemCounter.last_delete_align = 0; + a.deallocate(ap2, 11); assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A_constructed == 0); + assert(globalMemCounter.checkDeleteCalledEq(1)); + assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned)); + assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0)); + assert(T::constructed == 0); + } +} + +int main() { + test_aligned<1>(); + test_aligned<2>(); + test_aligned<4>(); + test_aligned<8>(); + test_aligned<16>(); + test_aligned(); + test_aligned(); + test_aligned(); } diff --git a/test/support/count_new.hpp b/test/support/count_new.hpp index c001c0340..e3111e7a5 100644 --- a/test/support/count_new.hpp +++ b/test/support/count_new.hpp @@ -59,12 +59,20 @@ public: int outstanding_new; int new_called; int delete_called; + int aligned_new_called; + int aligned_delete_called; std::size_t last_new_size; + std::size_t last_new_align; + std::size_t last_delete_align; int outstanding_array_new; int new_array_called; int delete_array_called; + int aligned_new_array_called; + int aligned_delete_array_called; std::size_t last_new_array_size; + std::size_t last_new_array_align; + std::size_t last_delete_array_align; public: void newCalled(std::size_t s) @@ -82,6 +90,12 @@ public: last_new_size = s; } + void alignedNewCalled(std::size_t s, std::size_t a) { + newCalled(s); + ++aligned_new_called; + last_new_align = a; + } + void deleteCalled(void * p) { assert(p); @@ -89,6 +103,12 @@ public: ++delete_called; } + void alignedDeleteCalled(void *p, std::size_t a) { + deleteCalled(p); + ++aligned_delete_called; + last_delete_align = a; + } + void newArrayCalled(std::size_t s) { assert(disable_allocations == false); @@ -104,6 +124,12 @@ public: last_new_array_size = s; } + void alignedNewArrayCalled(std::size_t s, std::size_t a) { + newArrayCalled(s); + ++aligned_new_array_called; + last_new_array_align = a; + } + void deleteArrayCalled(void * p) { assert(p); @@ -111,6 +137,12 @@ public: ++delete_array_called; } + void alignedDeleteArrayCalled(void * p, std::size_t a) { + deleteArrayCalled(p); + ++aligned_delete_array_called; + last_delete_array_align = a; + } + void disableAllocations() { disable_allocations = true; @@ -121,7 +153,6 @@ public: disable_allocations = false; } - void reset() { disable_allocations = false; @@ -130,12 +161,18 @@ public: outstanding_new = 0; new_called = 0; delete_called = 0; + aligned_new_called = 0; + aligned_delete_called = 0; last_new_size = 0; + last_new_align = 0; outstanding_array_new = 0; new_array_called = 0; delete_array_called = 0; + aligned_new_array_called = 0; + aligned_delete_array_called = 0; last_new_array_size = 0; + last_new_array_align = 0; } public: @@ -174,6 +211,31 @@ public: return disable_checking || n != delete_called; } + bool checkAlignedNewCalledEq(int n) const + { + return disable_checking || n == aligned_new_called; + } + + bool checkAlignedNewCalledNotEq(int n) const + { + return disable_checking || n != aligned_new_called; + } + + bool checkAlignedNewCalledGreaterThan(int n) const + { + return disable_checking || aligned_new_called > n; + } + + bool checkAlignedDeleteCalledEq(int n) const + { + return disable_checking || n == aligned_delete_called; + } + + bool checkAlignedDeleteCalledNotEq(int n) const + { + return disable_checking || n != aligned_delete_called; + } + bool checkLastNewSizeEq(std::size_t n) const { return disable_checking || n == last_new_size; @@ -184,6 +246,26 @@ public: return disable_checking || n != last_new_size; } + bool checkLastNewAlignEq(std::size_t n) const + { + return disable_checking || n == last_new_align; + } + + bool checkLastNewAlignNotEq(std::size_t n) const + { + return disable_checking || n != last_new_align; + } + + bool checkLastDeleteAlignEq(std::size_t n) const + { + return disable_checking || n == last_delete_align; + } + + bool checkLastDeleteAlignNotEq(std::size_t n) const + { + return disable_checking || n != last_delete_align; + } + bool checkOutstandingArrayNewEq(int n) const { return disable_checking || n == outstanding_array_new; @@ -214,6 +296,31 @@ public: return disable_checking || n != delete_array_called; } + bool checkAlignedNewArrayCalledEq(int n) const + { + return disable_checking || n == aligned_new_array_called; + } + + bool checkAlignedNewArrayCalledNotEq(int n) const + { + return disable_checking || n != aligned_new_array_called; + } + + bool checkAlignedNewArrayCalledGreaterThan(int n) const + { + return disable_checking || aligned_new_array_called > n; + } + + bool checkAlignedDeleteArrayCalledEq(int n) const + { + return disable_checking || n == aligned_delete_array_called; + } + + bool checkAlignedDeleteArrayCalledNotEq(int n) const + { + return disable_checking || n != aligned_delete_array_called; + } + bool checkLastNewArraySizeEq(std::size_t n) const { return disable_checking || n == last_new_array_size; @@ -223,6 +330,16 @@ public: { return disable_checking || n != last_new_array_size; } + + bool checkLastNewArrayAlignEq(std::size_t n) const + { + return disable_checking || n == last_new_array_align; + } + + bool checkLastNewArrayAlignNotEq(std::size_t n) const + { + return disable_checking || n != last_new_array_align; + } }; #ifdef DISABLE_NEW_COUNT @@ -254,22 +371,65 @@ void operator delete(void* p) TEST_NOEXCEPT std::free(p); } - void* operator new[](std::size_t s) TEST_THROW_SPEC(std::bad_alloc) { getGlobalMemCounter()->newArrayCalled(s); return operator new(s); } - void operator delete[](void* p) TEST_NOEXCEPT { getGlobalMemCounter()->deleteArrayCalled(p); operator delete(p); } -#endif // DISABLE_NEW_COUNT +#ifndef TEST_HAS_NO_ALIGNED_ALLOCATION +#if defined(_LIBCPP_MSVCRT_LIKE) || \ + (!defined(_LIBCPP_VERSION) && defined(_WIN32)) +#define USE_ALIGNED_ALLOC +#endif +void* operator new(std::size_t s, std::align_val_t av) TEST_THROW_SPEC(std::bad_alloc) { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedNewCalled(s, a); + void *ret; +#ifdef USE_ALIGNED_ALLOC + ret = _aligned_malloc(s, a); +#else + posix_memalign(&ret, a, s); +#endif + if (ret == nullptr) + detail::throw_bad_alloc_helper(); + return ret; +} + +void operator delete(void *p, std::align_val_t av) TEST_NOEXCEPT { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedDeleteCalled(p, a); + if (p) { +#ifdef USE_ALIGNED_ALLOC + ::_aligned_free(p); +#else + ::free(p); +#endif + } +} + +void* operator new[](std::size_t s, std::align_val_t av) TEST_THROW_SPEC(std::bad_alloc) { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedNewArrayCalled(s, a); + return operator new(s, av); +} + +void operator delete[](void *p, std::align_val_t av) TEST_NOEXCEPT { + const std::size_t a = static_cast(av); + getGlobalMemCounter()->alignedDeleteArrayCalled(p, a); + return operator delete(p, av); +} + +#endif // TEST_HAS_NO_ALIGNED_ALLOCATION + +#endif // DISABLE_NEW_COUNT struct DisableAllocationGuard { explicit DisableAllocationGuard(bool disable = true) : m_disabled(disable) @@ -295,7 +455,6 @@ private: DisableAllocationGuard& operator=(DisableAllocationGuard const&); }; - struct RequireAllocationGuard { explicit RequireAllocationGuard(std::size_t RequireAtLeast = 1) : m_req_alloc(RequireAtLeast), diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 257875a35..06800bdd3 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -157,6 +157,11 @@ #define TEST_NORETURN [[noreturn]] #endif +#if !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606L || \ + defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) +#define TEST_HAS_NO_ALIGNED_ALLOCATION +#endif + #if defined(_LIBCPP_SAFE_STATIC) #define TEST_SAFE_STATIC _LIBCPP_SAFE_STATIC #else @@ -228,6 +233,7 @@ inline void DoNotOptimize(Tp const& value) { } #endif + #if defined(__GNUC__) #pragma GCC diagnostic pop #endif From f4f3025362f07982d0d90e5436562901aa636bbb Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 05:44:48 +0000 Subject: [PATCH 0404/1520] Fix dynarray test failures after changing __libcpp_allocate/deallocate git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328182 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/dynarray | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/experimental/dynarray b/include/experimental/dynarray index 16193317a..cebfc208d 100644 --- a/include/experimental/dynarray +++ b/include/experimental/dynarray @@ -135,17 +135,18 @@ private: value_type * __base_; _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {} - static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count ) - { - if ( numeric_limits::max() / sizeof (value_type) <= count ) + static inline _LIBCPP_INLINE_VISIBILITY + value_type* __allocate(size_t __count) { + if (numeric_limits::max() / sizeof (value_type) <= __count) __throw_bad_array_length(); - return static_cast (_VSTD::__allocate (sizeof(value_type) * count)); + return static_cast( + _VSTD::__libcpp_allocate(sizeof(value_type) * __count, __alignof(value_type))); } - static inline _LIBCPP_INLINE_VISIBILITY void __deallocate_value( value_type* __ptr ) noexcept - { - _VSTD::__libcpp_deallocate (static_cast (__ptr)); + static inline _LIBCPP_INLINE_VISIBILITY + void __deallocate_value(value_type* __ptr ) noexcept { + _VSTD::__libcpp_deallocate(static_cast(__ptr), __alignof(value_type)); } public: From 6d7a11eb53295570453ba6a1b0935d4a7035aa5a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 06:21:07 +0000 Subject: [PATCH 0405/1520] Correct TEST_HAS_NO_ALIGNED_ALLOCATION macro definition git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328185 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/support/test_macros.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 06800bdd3..42eed4ce4 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -157,8 +157,9 @@ #define TEST_NORETURN [[noreturn]] #endif -#if !defined(__cpp_aligned_new) || __cpp_aligned_new < 201606L || \ - defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) +#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ + (!(TEST_STD_VER > 14 || \ + (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L))) #define TEST_HAS_NO_ALIGNED_ALLOCATION #endif From 959c89de1f79f3f9bb7e603bb1dd96e3f8408bc9 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 07:53:47 +0000 Subject: [PATCH 0406/1520] commit temporary workaround for new Clang exception warning git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328186 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/libcxx/test/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 2af4a473e..24bbbd523 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -918,6 +918,11 @@ class Configuration(object): self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals') self.cxx.addWarningFlagIfSupported('-Wno-noexcept-type') self.cxx.addWarningFlagIfSupported('-Wno-aligned-allocation-unavailable') + # FIXME: Remove this work-around. It is a temporary hack to get the + # throwing debug tests passing. For example: + # * test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp + # * test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp + self.cxx.addWarningFlagIfSupported("-Wno-exceptions") # These warnings should be enabled in order to support the MSVC # team using the test suite; They enable the warnings below and # expect the test suite to be clean. From e9e128b0a656d3c0ac58fc896a7d23565b4f25c1 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 22 Mar 2018 18:27:28 +0000 Subject: [PATCH 0407/1520] Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328225 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ostream | 4 +--- .../memory/unique.ptr/unique.ptr.special/io.fail.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/ostream b/include/ostream index f3250a708..197636eac 100644 --- a/include/ostream +++ b/include/ostream @@ -1071,19 +1071,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) return __os << __p.get(); } -#ifndef _LIBCPP_HAS_NO_DECLTYPE template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_same&>() << declval<_Yp>())>::type>::value, + is_same&>() << declval::pointer>()))>::type>::value, basic_ostream<_CharT, _Traits>& >::type operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) { return __os << __p.get(); } -#endif template basic_ostream<_CharT, _Traits>& diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp index 48c90f7b9..54c85e943 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp @@ -24,11 +24,12 @@ #include #include -class A {}; +#include "min_allocator.h" +#include "deleter_types.h" int main() { - std::unique_ptr p(new A); + std::unique_ptr> p; std::ostringstream os; - os << p; + os << p; // expected-error {{invalid operands to binary expression}} } From b7f27d421f98e10c4cc9f10b47ec100955c3aaa7 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 19:18:08 +0000 Subject: [PATCH 0408/1520] Un-XFAIL a test under new GCC version; the GCC bug has been fixed git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328229 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../function.objects/comparisons/constexpr_init.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp b/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp index 6ebca1e3c..abb80d06d 100644 --- a/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp +++ b/test/std/utilities/function.objects/comparisons/constexpr_init.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: gcc-7, gcc-8 +// XFAIL: gcc-7 // From b06c8f07b24c63eac7a69153a47d12893fe7dd68 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 21:28:09 +0000 Subject: [PATCH 0409/1520] Use DoNotOptimize to prevent new/delete elision. The new/delete tests, in particular those which test replacement functions, often fail when the optimizer is enabled because the calls to new/delete may be optimized away, regardless of their side-effects. This patch converts the tests to use DoNotOptimize in order to prevent the elision. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328245 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../delete_align_val_t_replace.pass.cpp | 11 ++++++----- .../new_align_val_t_replace.pass.cpp | 5 ++++- .../new.delete/new.delete.array/new_array.pass.cpp | 6 ++++-- .../new.delete.array/new_array_nothrow.pass.cpp | 5 ++++- .../new_array_nothrow_replace.pass.cpp | 8 ++++---- .../new.delete.array/new_array_replace.pass.cpp | 8 ++++---- ...elete_array_calls_unsized_delete_array.pass.cpp | 6 +++--- .../delete_align_val_t_replace.pass.cpp | 11 ++++++----- .../new_align_val_t_replace.pass.cpp | 5 ++++- .../new.delete.single/new_nothrow_replace.pass.cpp | 6 +++--- .../new.delete.single/new_replace.pass.cpp | 6 +++--- .../new.delete.single/sized_delete11.pass.cpp | 6 +++--- .../new.delete.single/sized_delete14.pass.cpp | 6 +++--- .../sized_delete_calls_unsized_delete.pass.cpp | 6 +++--- .../sized_delete_fsizeddeallocation.sh.cpp | 6 +++--- .../allocator.members/allocate.pass.cpp | 6 +++++- test/support/test_macros.h | 14 ++++++++++++-- 17 files changed, 74 insertions(+), 47 deletions(-) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp index 828feabd2..2175e29a0 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp @@ -69,31 +69,32 @@ void operator delete [] (void* p, std::align_val_t) TEST_NOEXCEPT struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; -B* volatile b; // Escape the memory -A* volatile a; - int main() { reset(); { - b = new B[2]; + B *b = new B[2]; + DoNotOptimize(b); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] b; + DoNotOptimize(b); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { - a = new A[2]; + A *a = new A[2]; + DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] a; + DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp index 82dc77efe..d8e08a3a0 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp @@ -53,7 +53,9 @@ void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad assert(s <= sizeof(DummyData)); assert(static_cast(a) == OverAligned); ++new_called; - return DummyData; + void *Ret = DummyData; + DoNotOptimize(Ret); + return Ret; } void operator delete[](void* p, std::align_val_t) TEST_NOEXCEPT @@ -61,6 +63,7 @@ void operator delete[](void* p, std::align_val_t) TEST_NOEXCEPT assert(new_called == 1); --new_called; assert(p == DummyData); + DoNotOptimize(p); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp index 5aecc2da0..58ff728e6 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp @@ -41,8 +41,8 @@ int main() std::set_new_handler(my_new_handler); try { - void* volatile vp = operator new[] (std::numeric_limits::max()); - ((void)vp); + void* vp = operator new[] (std::numeric_limits::max()); + DoNotOptimize(vp); assert(false); } catch (std::bad_alloc&) @@ -55,8 +55,10 @@ int main() } #endif A* ap = new A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp index c1606b27d..f29f0c09e 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp @@ -42,7 +42,8 @@ int main() try #endif { - void*volatile vp = operator new [] (std::numeric_limits::max(), std::nothrow); + void* vp = operator new [] (std::numeric_limits::max(), std::nothrow); + DoNotOptimize(vp); assert(new_handler_called == 1); assert(vp == 0); } @@ -53,8 +54,10 @@ int main() } #endif A* ap = new(std::nothrow) A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp index ba3f930c5..3d8467faa 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp @@ -36,7 +36,7 @@ void operator delete(void* p) TEST_NOEXCEPT std::free(p); } -volatile int A_constructed = 0; +int A_constructed = 0; struct A { @@ -44,15 +44,15 @@ struct A ~A() {--A_constructed;} }; -A* volatile ap; - int main() { - ap = new (std::nothrow) A[3]; + A *ap = new (std::nothrow) A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); assert(new_called); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); assert(!new_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp index 3f8122745..ad4d9f469 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp @@ -21,7 +21,7 @@ #include "test_macros.h" -volatile int new_called = 0; +int new_called = 0; void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc) { @@ -45,15 +45,15 @@ struct A ~A() {--A_constructed;} }; -A* volatile ap; - int main() { - ap = new A[3]; + A *ap = new A[3]; + DoNotOptimize(ap); assert(ap); assert(A_constructed == 3); assert(new_called == 1); delete [] ap; + DoNotOptimize(ap); assert(A_constructed == 0); assert(new_called == 0); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp index 3925f2f5c..a988b803d 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp @@ -46,15 +46,15 @@ void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT // selected. struct A { ~A() {} }; -A *volatile x; - int main() { - x = new A[3]; + A *x = new A[3]; + DoNotOptimize(x); assert(0 == delete_called); assert(0 == delete_nothrow_called); delete [] x; + DoNotOptimize(x); assert(1 == delete_called); assert(0 == delete_nothrow_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp index d64a63300..6f1c75112 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp @@ -68,31 +68,32 @@ void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; -B* volatile bp; -A* volatile ap; - int main() { reset(); { - bp = new B; + B *bp = new B; + DoNotOptimize(bp); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete bp; + DoNotOptimize(bp); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { - ap = new A; + A *ap = new A; + DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete ap; + DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp index bace5c036..2dd4631e7 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp @@ -53,7 +53,9 @@ void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_a assert(s <= sizeof(DummyData)); assert(static_cast(a) == OverAligned); ++new_called; - return DummyData; + void *Ret = DummyData; + DoNotOptimize(Ret); + return Ret; } void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT @@ -61,6 +63,7 @@ void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT assert(new_called == 1); --new_called; assert(p == DummyData); + DoNotOptimize(DummyData); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp index 31e190151..a0e3eda57 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp @@ -44,15 +44,15 @@ struct A ~A() {A_constructed = false;} }; -A* volatile ap; - int main() { - ap = new (std::nothrow) A; + A *ap = new (std::nothrow) A; + DoNotOptimize(ap); assert(ap); assert(A_constructed); assert(new_called); delete ap; + DoNotOptimize(ap); assert(!A_constructed); assert(!new_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp index ea6c9367b..aa00fee56 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp @@ -43,15 +43,15 @@ struct A ~A() {A_constructed = false;} }; -A *volatile ap; - int main() { - ap = new A; + A *ap = new A; + DoNotOptimize(ap); assert(ap); assert(A_constructed); assert(new_called); delete ap; + DoNotOptimize(ap); assert(!A_constructed); assert(!new_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp index 3d947de42..d9e0f5ca3 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp @@ -44,16 +44,16 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } -int *volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == sized_delete_called); delete x; + DoNotOptimize(x); assert(1 == unsized_delete_called); assert(0 == sized_delete_called); assert(0 == unsized_delete_nothrow_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp index 7a76725a9..5b08eb4b8 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp @@ -49,16 +49,16 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } -int *volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == sized_delete_called); delete x; + DoNotOptimize(x); assert(0 == unsized_delete_called); assert(1 == sized_delete_called); assert(0 == unsized_delete_nothrow_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp index cb093f363..178e26db1 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp @@ -35,15 +35,15 @@ void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT std::free(p); } -int* volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == delete_called); assert(0 == delete_nothrow_called); delete x; + DoNotOptimize(x); assert(1 == delete_called); assert(0 == delete_nothrow_called); } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp index 40de3a098..d5b610f71 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp @@ -62,16 +62,16 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } -int* volatile x; - int main() { - x = new int(42); + int *x = new int(42); + DoNotOptimize(x); assert(0 == sized_delete_called); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); delete x; + DoNotOptimize(x); assert(1 == sized_delete_called); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp index 930da0b79..70c5e4696 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "test_macros.h" #include "count_new.hpp" @@ -59,7 +60,8 @@ void test_aligned() { assert(T::constructed == 0); globalMemCounter.last_new_size = 0; globalMemCounter.last_new_align = 0; - T* volatile ap = a.allocate(3); + T* ap = a.allocate(3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkNewCalledEq(1)); assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); @@ -79,6 +81,7 @@ void test_aligned() { globalMemCounter.last_new_size = 0; globalMemCounter.last_new_align = 0; T* volatile ap2 = a.allocate(11, (const void*)5); + DoNotOptimize(ap2); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkNewCalledEq(1)); assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned)); @@ -87,6 +90,7 @@ void test_aligned() { assert(T::constructed == 0); globalMemCounter.last_delete_align = 0; a.deallocate(ap2, 11); + DoNotOptimize(ap2); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(globalMemCounter.checkDeleteCalledEq(1)); assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned)); diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 42eed4ce4..848f14076 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -221,8 +221,18 @@ struct is_same { enum {value = 1}; }; #if defined(__GNUC__) || defined(__clang__) template -inline void DoNotOptimize(Tp const& value) { - asm volatile("" : : "g"(value) : "memory"); +inline +void DoNotOptimize(Tp const& value) { + asm volatile("" : : "r,m"(value) : "memory"); +} + +template +inline void DoNotOptimize(Tp& value) { +#if defined(__clang__) + asm volatile("" : "+r,m"(value) : : "memory"); +#else + asm volatile("" : "+m,r"(value) : : "memory"); +#endif } #else #include From 493b609b272b6f59e737d9ad04be71b0fc10edc2 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 22:32:55 +0000 Subject: [PATCH 0410/1520] Workaround GCC bug PR78489 - SFINAE order is not respected. This patch works around variant test failures which are new to GCC 8. GCC 8 either doesn't perform SFINAE in lexical order, or it doesn't halt after encountering the first failure. This causes hard error to occur instead of substitution failure. See gcc.gnu.org/PR78489 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328261 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/variant | 29 ++++++++----------- .../in_place_index_init_list_args.pass.cpp | 6 ++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/variant b/include/variant index f9098f422..6f78e2de1 100644 --- a/include/variant +++ b/include/variant @@ -1156,29 +1156,24 @@ public: : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template , - class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, - enable_if_t, int> = 0> + enable_if_t<(_Ip < sizeof...(_Types)), size_t> _Ip2 = _Ip, + class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, + enable_if_t::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant( - in_place_index_t<_Ip>, - _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) + explicit constexpr variant(in_place_index_t<_Ip>, + _Args&&... __args) + noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} - template < - size_t _Ip, - class _Up, - class... _Args, - enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, - class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, + template _Ip2 = _Ip, + class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant( - in_place_index_t<_Ip>, - initializer_list<_Up> __il, - _Args&&... __args) noexcept( - is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) + explicit constexpr variant(in_place_index_t<_Ip>, initializer_list<_Up> __il, + _Args&&... __args) + noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} template < diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp index 608cdf9d6..9d0bf55fb 100644 --- a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp +++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp @@ -73,6 +73,12 @@ void test_ctor_sfinae() { !std::is_constructible, IL>::value, ""); static_assert(!test_convertible, IL>(), ""); } + { // index not in variant + using V = std::variant; + static_assert( + !std::is_constructible, IL>::value, ""); + static_assert(!test_convertible, IL>(), ""); + } } void test_ctor_basic() { From 111f042e6c13b8987bcbe4133f48c1ac03b4a8e5 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 22 Mar 2018 22:59:02 +0000 Subject: [PATCH 0411/1520] [libcxx] [test] Strip trailing whitespace. NFC. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328264 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../string.modifiers/clear_and_shrink_db1.pass.cpp | 4 ++-- test/std/language.support/support.types/max_align_t.pass.cpp | 2 +- .../memory/default.allocator/allocator.ctor.pass.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp index b7e278b75..920c0d185 100644 --- a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp +++ b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp @@ -25,12 +25,12 @@ int main() assert(l.__invariants()); assert(s.__invariants()); - + s.__clear_and_shrink(); assert(s.__invariants()); assert(s.size() == 0); - { + { std::string::size_type cap = l.capacity(); l.__clear_and_shrink(); assert(l.__invariants()); diff --git a/test/std/language.support/support.types/max_align_t.pass.cpp b/test/std/language.support/support.types/max_align_t.pass.cpp index dc202897a..b7fe0ac64 100644 --- a/test/std/language.support/support.types/max_align_t.pass.cpp +++ b/test/std/language.support/support.types/max_align_t.pass.cpp @@ -10,7 +10,7 @@ #include #include -// max_align_t is a trivial standard-layout type whose alignment requirement +// max_align_t is a trivial standard-layout type whose alignment requirement // is at least as great as that of every scalar type #include diff --git a/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp index 3841cb533..0afab685f 100644 --- a/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp @@ -46,5 +46,5 @@ int main() constexpr AL a3{a2}; (void) a3; } - + } From 73e00f8321b13559b3c41f6656686d980fe92fbe Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 23:01:08 +0000 Subject: [PATCH 0412/1520] Avoid Clang error about throwing _LIBCPP_ASSERT in noexcept function. This fixes a couple of tests which produced a warning that a 'throw' occurred in a noexcept function (by way of _LIBCPP_ASSERT). It does so by hiding the 'throw' across an opaque function boundary. This fix isn't ideal, since we still have _LIBCPP_ASSERT's in functions marked noexcept -- and this problem should be addressed in the future. However, throwing _LIBCPP_ASSERT is really only meant to allow testing of the assertions, and is not yet ready for general use. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328265 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../class.path/path.itr/iterator_db.pass.cpp | 19 +++++++++++-------- .../futures.promise/set_exception.pass.cpp | 13 +++++++------ .../set_exception_at_thread_exit.pass.cpp | 13 +++++++------ utils/libcxx/test/config.py | 5 ----- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp index aea46f10c..b8b7124ad 100644 --- a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp +++ b/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp @@ -10,13 +10,15 @@ // UNSUPPORTED: c++98, c++03 // UNSUPPORTED: libcpp-no-exceptions +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// MODULES_DEFINES: _LIBCPP_DEBUG=0 + // // class path #define _LIBCPP_DEBUG 0 -#define _LIBCPP_ASSERT(cond, msg) ((cond) ? ((void)0) : throw 42) - +#define _LIBCPP_DEBUG_USE_EXCEPTIONS #include #include #include @@ -29,17 +31,18 @@ namespace fs = std::experimental::filesystem; int main() { using namespace fs; + using ExType = std::__libcpp_debug_exception; // Test incrementing/decrementing a singular iterator { path::iterator singular; try { ++singular; assert(false); - } catch (int) {} + } catch (ExType const&) {} try { --singular; assert(false); - } catch (int) {} + } catch (ExType const&) {} } // Test decrementing the begin iterator { @@ -48,13 +51,13 @@ int main() { try { --it; assert(false); - } catch (int) {} + } catch (ExType const&) {} ++it; ++it; try { ++it; assert(false); - } catch (int) {} + } catch (ExType const&) {} } // Test incrementing the end iterator { @@ -63,12 +66,12 @@ int main() { try { ++it; assert(false); - } catch (int) {} + } catch (ExType const&) {} --it; --it; try { --it; assert(false); - } catch (int) {} + } catch (ExType const&) {} } } diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index 9efa597d7..abfbb685d 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -11,6 +11,9 @@ // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// MODULES_DEFINES: _LIBCPP_DEBUG=0 + // // class promise @@ -18,9 +21,8 @@ // void set_exception(exception_ptr p); // Test that a null exception_ptr is diagnosed. -#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42) - #define _LIBCPP_DEBUG 0 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS #include #include #include @@ -29,14 +31,14 @@ int main() { + typedef std::__libcpp_debug_exception ExType; { typedef int T; std::promise p; try { p.set_exception(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const&) { } } { @@ -45,8 +47,7 @@ int main() try { p.set_exception(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const&) { } } } diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index dca493382..6736bae97 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -11,6 +11,9 @@ // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 +// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// MODULES_DEFINES: _LIBCPP_DEBUG=0 + // // class promise @@ -18,9 +21,8 @@ // void set_exception_on_thread_exit(exception_ptr p); // Test that a null exception_ptr is diagnosed. -#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42) - #define _LIBCPP_DEBUG 0 +#define _LIBCPP_DEBUG_USE_EXCEPTIONS #include #include #include @@ -29,14 +31,14 @@ int main() { + typedef std::__libcpp_debug_exception ExType; { typedef int T; std::promise p; try { p.set_exception_at_thread_exit(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const& value) { } } { @@ -45,8 +47,7 @@ int main() try { p.set_exception_at_thread_exit(std::exception_ptr()); assert(false); - } catch (int const& value) { - assert(value == 42); + } catch (ExType const& value) { } } } diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 24bbbd523..2af4a473e 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -918,11 +918,6 @@ class Configuration(object): self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals') self.cxx.addWarningFlagIfSupported('-Wno-noexcept-type') self.cxx.addWarningFlagIfSupported('-Wno-aligned-allocation-unavailable') - # FIXME: Remove this work-around. It is a temporary hack to get the - # throwing debug tests passing. For example: - # * test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp - # * test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp - self.cxx.addWarningFlagIfSupported("-Wno-exceptions") # These warnings should be enabled in order to support the MSVC # team using the test suite; They enable the warnings below and # expect the test suite to be clean. From 078131e6d2dfabdb0e69216d070f91805650640a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 22 Mar 2018 23:14:20 +0000 Subject: [PATCH 0413/1520] Add temporary printouts to test to help debug failures. Some debian libc++ bots started having failures in the locale tests due to what I assume is a change in the locale data for fr_FR in glibc. This change prints the actual value from the test to help debugging. It should be reverted once the bots cycle. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328268 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../locale.moneypunct.byname/decimal_point.pass.cpp | 6 ++++++ .../locale.numpunct.byname/thousands_sep.pass.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp index 4051d451f..09e6e94ca 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp @@ -21,6 +21,7 @@ #include #include #include +#include // FIXME: for debugging purposes only #include "test_macros.h" #include "platform_support.h" // locale name macros @@ -119,6 +120,11 @@ int main() #endif { Fnf f(LOCALE_ru_RU_UTF_8, 1); + if (f.decimal_point() != sep) { + std::cout << "f.decimal_point() = '" << f.decimal_point() << "'\n"; + std::cout << "sep = '" << sep << "'\n"; + std::cout << std::endl; + } assert(f.decimal_point() == sep); } { diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp index 38cbcfda4..08ce35bf5 100644 --- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp +++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp @@ -19,6 +19,7 @@ #include #include +#include // FIXME: for debugging purposes only #include "test_macros.h" #include "platform_support.h" // locale name macros @@ -63,6 +64,11 @@ int main() { typedef char C; const std::numpunct& np = std::use_facet >(l); + if (np.thousands_sep() != sep) { + std::cout << "np.thousands_sep() = '" << np.thousands_sep() << "'\n"; + std::cout << "sep = '" << sep << "'\n"; + std::cout << std::endl; + } assert(np.thousands_sep() == sep); } { From 5a424a985612452d4f7a3f02422207456d54a53e Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 23 Mar 2018 23:42:30 +0000 Subject: [PATCH 0414/1520] Partially Revert "Workaround GCC bug PR78489 - SFINAE order is not respected." This partially reverts commit r328261. The GCC bug has been fixed in trunk and has never existed in a released version. Therefore the changes to variant are unneeded. However, the additional tests have been left in place. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328388 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/variant | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/include/variant b/include/variant index 6f78e2de1..f9098f422 100644 --- a/include/variant +++ b/include/variant @@ -1156,24 +1156,29 @@ public: : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template _Ip2 = _Ip, - class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, - enable_if_t::value, int> = 0> + class = enable_if_t<(_Ip < sizeof...(_Types)), int>, + class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, + enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant(in_place_index_t<_Ip>, - _Args&&... __args) - noexcept(is_nothrow_constructible_v<_Tp, _Args...>) + explicit constexpr variant( + in_place_index_t<_Ip>, + _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} - template _Ip2 = _Ip, - class _Tp = variant_alternative_t<_Ip2, variant<_Types...>>, + template < + size_t _Ip, + class _Up, + class... _Args, + enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, + class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - explicit constexpr variant(in_place_index_t<_Ip>, initializer_list<_Up> __il, - _Args&&... __args) - noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) + explicit constexpr variant( + in_place_index_t<_Ip>, + initializer_list<_Up> __il, + _Args&&... __args) noexcept( + is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} template < From 85e9de93e25a31a4e8ddfeb5cd7d255bb83749ac Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 25 Mar 2018 03:00:42 +0000 Subject: [PATCH 0415/1520] avoid new/delete ellision in construct.pass.cpp git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328445 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../default.allocator/allocator.members/construct.pass.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp index 28dadd831..9ba987440 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp @@ -63,6 +63,7 @@ int main() globalMemCounter.last_new_size = 0; A* ap = a.allocate(3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); assert(A_constructed == 0); @@ -100,6 +101,7 @@ int main() assert(A_constructed == 0); a.deallocate(ap, 3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(A_constructed == 0); } @@ -111,6 +113,7 @@ int main() globalMemCounter.last_new_size = 0; move_only* ap = a.allocate(3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int))); assert(move_only_constructed == 0); @@ -132,6 +135,7 @@ int main() assert(move_only_constructed == 0); a.deallocate(ap, 3); + DoNotOptimize(ap); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(move_only_constructed == 0); } From f1471a367b35d1d1fa4fff374b771ecf2671fb34 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 26 Mar 2018 05:46:57 +0000 Subject: [PATCH 0416/1520] Make filesystem tests generic between experimental and std versions. As I move towards implementing std::filesystem, there is a need to make the existing tests run against both the std and experimental versions. Additionally, it's helpful to allow running the tests against other implementations of filesystem. This patch converts the test to easily target either. First, it adds a filesystem_include.hpp header which is soley responsible for selecting and including the correct implementation. Second, it converts existing tests to use this header instead of including filesystem directly. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328475 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../directory_entry.cons.pass.cpp | 3 +-- .../directory_entry.mods.pass.cpp | 3 +-- .../directory_entry.obs/comparisons.pass.cpp | 3 +-- .../directory_entry.obs/path.pass.cpp | 3 +-- .../directory_entry.obs/status.pass.cpp | 2 +- .../symlink_status.pass.cpp | 2 +- .../directory_iterator.members/copy.pass.cpp | 4 ++-- .../copy_assign.pass.cpp | 4 ++-- .../directory_iterator.members/ctor.pass.cpp | 8 ++++---- .../default_ctor.pass.cpp | 3 +-- .../increment.pass.cpp | 4 ++-- .../directory_iterator.members/move.pass.cpp | 4 ++-- .../move_assign.pass.cpp | 4 ++-- .../begin_end.pass.cpp | 4 ++-- .../class.directory_iterator/types.pass.cpp | 3 +-- .../file_status.cons.pass.cpp | 3 +-- .../file_status.mods.pass.cpp | 3 +-- .../class.file_status/file_status.obs.pass.cpp | 3 +-- .../filesystem_error.members.pass.cpp | 3 +-- .../class.path/path.itr/iterator.pass.cpp | 3 +-- .../path.member/path.append.pass.cpp | 3 +-- .../path.assign/braced_init.pass.cpp | 3 +-- .../path.member/path.assign/copy.pass.cpp | 3 +-- .../path.member/path.assign/move.pass.cpp | 3 +-- .../path.member/path.assign/source.pass.cpp | 3 +-- .../path.member/path.compare.pass.cpp | 3 +-- .../path.member/path.concat.pass.cpp | 3 +-- .../path.member/path.construct/copy.pass.cpp | 3 +-- .../path.construct/default.pass.cpp | 3 +-- .../path.member/path.construct/move.pass.cpp | 3 +-- .../path.member/path.construct/source.pass.cpp | 3 +-- .../path.member/path.decompose/empty.fail.cpp | 5 ++--- .../path.decompose/path.decompose.pass.cpp | 3 +-- .../generic_string_alloc.pass.cpp | 3 +-- .../path.generic.obs/named_overloads.pass.cpp | 3 +-- .../path.member/path.modifiers/clear.pass.cpp | 3 +-- .../path.modifiers/make_preferred.pass.cpp | 3 +-- .../path.modifiers/remove_filename.pass.cpp | 3 +-- .../path.modifiers/replace_extension.pass.cpp | 3 +-- .../path.modifiers/replace_filename.pass.cpp | 3 +-- .../path.member/path.modifiers/swap.pass.cpp | 3 +-- .../path.member/path.native.obs/c_str.pass.cpp | 3 +-- .../path.native.obs/named_overloads.pass.cpp | 3 +-- .../path.native.obs/native.pass.cpp | 3 +-- .../path.native.obs/operator_string.pass.cpp | 3 +-- .../path.native.obs/string_alloc.pass.cpp | 3 +-- .../path.nonmember/append_op.pass.cpp | 3 +-- .../path.nonmember/path.factory.pass.cpp | 3 +-- .../class.path/path.nonmember/path.io.pass.cpp | 2 +- .../path.io.unicode_bug.pass.cpp | 2 +- .../class.path/path.nonmember/swap.pass.cpp | 3 +-- .../filesystem/class.path/synop.pass.cpp | 3 +-- .../rec.dir.itr.members/copy.pass.cpp | 4 ++-- .../rec.dir.itr.members/copy_assign.pass.cpp | 4 ++-- .../rec.dir.itr.members/ctor.pass.cpp | 8 ++++---- .../rec.dir.itr.members/depth.pass.cpp | 4 ++-- .../disable_recursion_pending.pass.cpp | 4 ++-- .../rec.dir.itr.members/increment.pass.cpp | 12 ++++++------ .../rec.dir.itr.members/move.pass.cpp | 4 ++-- .../rec.dir.itr.members/move_assign.pass.cpp | 4 ++-- .../rec.dir.itr.members/pop.pass.cpp | 4 ++-- .../recursion_pending.pass.cpp | 4 ++-- .../rec.dir.itr.nonmembers/begin_end.pass.cpp | 4 ++-- .../fs.enum/enum.copy_options.pass.cpp | 3 +-- .../fs.enum/enum.directory_options.pass.cpp | 3 +-- .../filesystem/fs.enum/enum.file_type.pass.cpp | 3 +-- .../filesystem/fs.enum/enum.perms.pass.cpp | 3 +-- .../file_time_type.pass.cpp | 4 ++-- .../fs.op.absolute/absolute.pass.cpp | 4 ++-- .../fs.op.canonical/canonical.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.copy/copy.pass.cpp | 5 ++--- .../fs.op.copy_file/copy_file.pass.cpp | 5 ++--- .../fs.op.copy_symlink/copy_symlink.pass.cpp | 5 ++--- .../create_directories.pass.cpp | 5 ++--- .../create_directory.pass.cpp | 5 ++--- .../create_directory_with_attributes.pass.cpp | 5 ++--- .../create_directory_symlink.pass.cpp | 5 ++--- .../create_hard_link.pass.cpp | 5 ++--- .../create_symlink.pass.cpp | 5 ++--- .../fs.op.current_path/current_path.pass.cpp | 4 ++-- .../fs.op.equivalent/equivalent.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.exists/exists.pass.cpp | 4 ++-- .../fs.op.file_size/file_size.pass.cpp | 4 ++-- .../fs.op.hard_lk_ct/hard_link_count.pass.cpp | 4 ++-- .../fs.op.is_block_file/is_block_file.pass.cpp | 4 ++-- .../is_character_file.pass.cpp | 4 ++-- .../fs.op.is_directory/is_directory.pass.cpp | 4 ++-- .../fs.op.is_empty/is_empty.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp | 4 ++-- .../fs.op.is_other/is_other.pass.cpp | 4 ++-- .../is_regular_file.pass.cpp | 4 ++-- .../fs.op.is_socket/is_socket.pass.cpp | 4 ++-- .../fs.op.is_symlink/is_symlink.pass.cpp | 4 ++-- .../last_write_time.pass.cpp | 4 ++-- .../fs.op.permissions/permissions.pass.cpp | 5 ++--- .../fs.op.read_symlink/read_symlink.pass.cpp | 5 ++--- .../fs.op.funcs/fs.op.remove/remove.pass.cpp | 5 ++--- .../fs.op.remove_all/remove_all.pass.cpp | 5 ++--- .../fs.op.funcs/fs.op.rename/rename.pass.cpp | 5 ++--- .../fs.op.resize_file/resize_file.pass.cpp | 5 ++--- .../fs.op.funcs/fs.op.space/space.pass.cpp | 4 ++-- .../fs.op.funcs/fs.op.status/status.pass.cpp | 4 ++-- .../fs.op.status_known/status_known.pass.cpp | 4 ++-- .../symlink_status.pass.cpp | 4 ++-- .../system_complete.pass.cpp | 4 ++-- .../temp_directory_path.pass.cpp | 4 ++-- .../fs.req.macros/feature_macro.pass.cpp | 2 +- test/support/filesystem_include.hpp | 18 ++++++++++++++++++ test/support/filesystem_test_helper.hpp | 3 +-- 109 files changed, 192 insertions(+), 235 deletions(-) create mode 100644 test/support/filesystem_include.hpp diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp index 9a92f0698..8a9a1b5d3 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp @@ -18,11 +18,10 @@ // directory_entry(directory_entry&&) noexcept = default; // explicit directory_entry(const path); -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; void test_default_ctor() { diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp index 97ecbefac..13428db19 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp @@ -18,11 +18,10 @@ // void assign(path const&); // void replace_filename(path const&); -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; void test_copy_assign_operator() { diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp index 96e509300..48997ca20 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp @@ -21,11 +21,10 @@ // bool operator>=(directory_entry const&) const noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; #define CHECK_OP(Op) \ static_assert(std::is_same::value, ""); \ diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp index d228a3d92..80168ef2a 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp @@ -16,11 +16,10 @@ // const path& path() const noexcept; // operator const path&() const noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; void test_path_method() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp index 54c5172eb..f234f0c1a 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp @@ -16,7 +16,7 @@ // file_status status() const; // file_status status(error_code const&) const noexcept; -#include +#include "filesystem_include.hpp" #include #include diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp index 3a99eb671..2ed22df3b 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp @@ -16,7 +16,7 @@ // file_status symlink_status() const; // file_status symlink_status(error_code&) const noexcept; -#include +#include "filesystem_include.hpp" #include #include diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp index 5c4583391..777e6144c 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator(directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_copy_construct_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp index 0d5ebf3eb..067e6c62d 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator& operator=(directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_copy_assign_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp index 4fd60887b..6a24a52d5 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp @@ -18,7 +18,7 @@ // directory_iterator(const path& p, error_code& ec); // directory_iterator(const path& p, directory_options options, error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -27,7 +27,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_constructor_tests) @@ -86,7 +86,7 @@ TEST_CASE(test_construction_from_bad_path) TEST_CASE(access_denied_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testDir = env.make_env_path("dir1"); path const testFile = testDir / "testFile"; @@ -122,7 +122,7 @@ TEST_CASE(access_denied_test_case) TEST_CASE(access_denied_to_file_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testFile = env.make_env_path("file1"); env.create_file(testFile, 42); diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp index 94ace185a..787f3975e 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp @@ -16,13 +16,12 @@ // directory_iterator::directory_iterator() noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { { diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp index 8d888717b..ad55e05a7 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp @@ -16,7 +16,7 @@ // directory_iterator& operator++(); // directory_iterator& increment(error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,7 +26,7 @@ #include "filesystem_test_helper.hpp" #include -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_increment_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp index f6c94e18e..97a34a9bd 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator(directory_iterator&&) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_move_construct_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp index 445f05a3c..538256626 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp @@ -15,7 +15,7 @@ // directory_iterator& operator=(directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -30,7 +30,7 @@ #pragma clang diagnostic ignored "-Wself-move" #endif -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_move_assign_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp index f93a18452..95bb78c42 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp @@ -16,7 +16,7 @@ // directory_iterator begin(directory_iterator iter) noexcept; // directory_iterator end(directory_iterator iter) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,7 +26,7 @@ #include "filesystem_test_helper.hpp" #include -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(directory_iterator_begin_end_tests) diff --git a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp index dad278f43..ca583bedd 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp +++ b/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp @@ -19,13 +19,12 @@ // typedef ... reference; // typedef ... iterator_category -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp index a744e659f..4c7d5e337 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp @@ -16,13 +16,12 @@ // explicit file_status() noexcept; // explicit file_status(file_type, perms prms = perms::unknown) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_convertible.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp index 8681b2dc5..5492ccde7 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp @@ -16,11 +16,10 @@ // void type(file_type) noexcept; // void permissions(perms) noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp index 4113dee45..462670fd8 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp @@ -16,11 +16,10 @@ // file_type type() const noexcept; // perms permissions(p) const noexcept; -#include +#include "filesystem_include.hpp" #include #include -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp b/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp index 68b67ed72..e9b117a79 100644 --- a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp +++ b/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp @@ -21,13 +21,12 @@ // const path& path1() const noexcept; // const path& path2() const noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; void test_constructors() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp b/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp index 12330ebb5..e5b3c8482 100644 --- a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp @@ -19,7 +19,7 @@ // path(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -27,7 +27,6 @@ #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; template diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp index a6172d198..ca072d161 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp @@ -22,7 +22,7 @@ // path& append(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -32,7 +32,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct AppendOperatorTestcase { MultiStringType lhs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp index c5da52f65..bbf331310 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp @@ -15,14 +15,13 @@ // path& operator=(path const&); -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "count_new.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp index 5c26f8464..8b54be6ed 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp @@ -15,13 +15,12 @@ // path& operator=(path const&); -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp index 7263424ad..c5cb37fac 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp @@ -15,14 +15,13 @@ // path& operator=(path&&) noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "count_new.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp index 8c31ef51d..2e064fa48 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp @@ -22,7 +22,7 @@ // path& assign(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -33,7 +33,6 @@ #include "filesystem_test_helper.hpp" #include -namespace fs = std::experimental::filesystem; template void RunTestCase(MultiStringType const& MS) { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp index 69d08e6eb..ea3567826 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp @@ -26,7 +26,7 @@ // // size_t hash_value(path const&) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -36,7 +36,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct PathCompareTest { const char* LHS; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp index 76df0e9ee..13203d6c6 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp @@ -28,7 +28,7 @@ // path& concat(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include #include @@ -39,7 +39,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct ConcatOperatorTestcase { MultiStringType lhs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp index 67b8a0404..14b4b38c9 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp @@ -15,13 +15,12 @@ // path(path const&) -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp index f26504616..fddeff989 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp @@ -15,13 +15,12 @@ // path() noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp index b8ac4b307..16f89d0a2 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp @@ -15,14 +15,13 @@ // path(path&&) noexcept -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "count_new.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp index a04f35af5..e80ae45b8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp @@ -19,7 +19,7 @@ // path(InputIterator first, InputIterator last); -#include +#include "filesystem_include.hpp" #include #include @@ -28,7 +28,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; template void RunTestCase(MultiStringType const& MS) { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp index 7e1fea7d3..377b94e52 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp @@ -17,12 +17,11 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 -#include - +#include "filesystem_include.hpp" #include "test_macros.h" int main () { - std::experimental::filesystem::path c; + fs::path c; c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp index 267d4932c..6dd24b511 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -44,7 +44,7 @@ // iterator end() const; -#include +#include "filesystem_include.hpp" #include #include #include @@ -54,7 +54,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct PathDecomposeTestcase { std::string raw; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp index 47e94c9a2..7e329376c 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp @@ -18,7 +18,7 @@ // basic_string // generic_string(const Allocator& a = Allocator()) const; -#include +#include "filesystem_include.hpp" #include #include @@ -28,7 +28,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp index 81d068436..d3df09ed9 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp @@ -20,7 +20,7 @@ // std::u32string generic_u32string() const; -#include +#include "filesystem_include.hpp" #include #include @@ -30,7 +30,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp index 7881c9700..1d697571c 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp @@ -15,7 +15,7 @@ // void clear() noexcept -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp index 559538cf0..b09806c23 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp @@ -15,7 +15,7 @@ // path& make_preferred() -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct MakePreferredTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp index e414202bf..84cdd5214 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp @@ -15,7 +15,7 @@ // path& remove_filename() -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct RemoveFilenameTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp index 98f6e9b88..2e7d92555 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp @@ -15,7 +15,7 @@ // path& replace_extension(path const& p = path()) -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct ReplaceExtensionTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp index 66c97218c..fb7741110 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp @@ -15,7 +15,7 @@ // path& replace_filename() -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct ReplaceFilenameTestcase { const char* value; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp index 04bbe3751..3aac1ed60 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp @@ -15,7 +15,7 @@ // void swap(path& rhs) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; struct SwapTestcase { const char* value1; diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp index 796609432..f907410a8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp @@ -16,14 +16,13 @@ // const value_type* c_str() const noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp index 2a83fef9f..9034ad450 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp @@ -20,7 +20,7 @@ // std::u32string u32string() const; -#include +#include "filesystem_include.hpp" #include #include @@ -30,7 +30,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp index db1326483..35ea49346 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp @@ -15,14 +15,13 @@ // const string_type& native() const noexcept; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp index 013d26cdb..9aa1b14c8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp @@ -16,14 +16,13 @@ // operator string_type() const; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp index e98329735..503c29c32 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp @@ -18,7 +18,7 @@ // basic_string // string(const Allocator& a = Allocator()) const; -#include +#include "filesystem_include.hpp" #include #include @@ -28,7 +28,6 @@ #include "min_allocator.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; // the SSO is always triggered for strings of size 2. MultiStringType shortString = MKSTR("a"); diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp index 589837784..3648da57a 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp @@ -13,14 +13,13 @@ // path operator/(path const&, path const&); -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; // This is mainly tested via the member append functions. int main() diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp index 4853994b4..5d9194b4e 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp @@ -16,7 +16,7 @@ // template // path u8path(InputIter, InputIter); -#include +#include "filesystem_include.hpp" #include #include @@ -25,7 +25,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; int main() { diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp index 8dd82a845..58e333aad 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp @@ -22,7 +22,7 @@ // operator>>(basic_istream& is, path& p) // -#include +#include "filesystem_include.hpp" #include #include #include diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp index 3a9b48b26..ff622532e 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp @@ -27,7 +27,7 @@ // passes. // XFAIL: * -#include +#include "filesystem_include.hpp" #include #include #include diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp index 8d180463a..4f7b93a05 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp @@ -13,7 +13,7 @@ // void swap(path& lhs, path& rhs) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -21,7 +21,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; // NOTE: this is tested in path.members/path.modifiers via the member swap. int main() diff --git a/test/std/experimental/filesystem/class.path/synop.pass.cpp b/test/std/experimental/filesystem/class.path/synop.pass.cpp index 883feb287..3ed0a8f19 100644 --- a/test/std/experimental/filesystem/class.path/synop.pass.cpp +++ b/test/std/experimental/filesystem/class.path/synop.pass.cpp @@ -17,13 +17,12 @@ // typedef basic_string string_type; // static constexpr value_type preferred_separator = ...; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; int main() { using namespace fs; diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp index 4dbd599e5..15cf50569 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp @@ -15,7 +15,7 @@ // recursive_recursive_directory_iterator(recursive_recursive_directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_copy_construct_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp index 3e9257eac..ebe4c87d0 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp @@ -15,7 +15,7 @@ // recursive_directory_iterator& operator=(recursive_directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_copy_assign_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp index 1469dae04..29a86258d 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp @@ -20,7 +20,7 @@ // recursive_directory_iterator(const path& p, directory_options options, error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -29,7 +29,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; using RDI = recursive_directory_iterator; @@ -87,7 +87,7 @@ TEST_CASE(test_construction_from_bad_path) TEST_CASE(access_denied_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testDir = env.make_env_path("dir1"); path const testFile = testDir / "testFile"; @@ -124,7 +124,7 @@ TEST_CASE(access_denied_test_case) TEST_CASE(access_denied_to_file_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; path const testFile = env.make_env_path("file1"); env.create_file(testFile, 42); diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp index 676e6f27c..d27194abe 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp @@ -15,7 +15,7 @@ // int depth() const -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_depth_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp index 387c6145b..e385624bc 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp @@ -15,7 +15,7 @@ // void disable_recursion_pending(); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_disable_recursion_pending_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index 87c10c499..d2a5b8c18 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -16,7 +16,7 @@ // recursive_directory_iterator& operator++(); // recursive_directory_iterator& increment(error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -25,7 +25,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_increment_tests) @@ -140,7 +140,7 @@ TEST_CASE(test_follow_symlinks) TEST_CASE(access_denied_on_recursion_test_case) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), @@ -239,7 +239,7 @@ TEST_CASE(access_denied_on_recursion_test_case) // See llvm.org/PR35078 TEST_CASE(test_PR35078) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), @@ -309,7 +309,7 @@ TEST_CASE(test_PR35078) // See llvm.org/PR35078 TEST_CASE(test_PR35078_with_symlink) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), @@ -393,7 +393,7 @@ TEST_CASE(test_PR35078_with_symlink) // See llvm.org/PR35078 TEST_CASE(test_PR35078_with_symlink_file) { - using namespace std::experimental::filesystem; + using namespace fs; scoped_test_env env; const path testFiles[] = { env.create_dir("dir1"), diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp index 16dde66d2..6fe26d5ed 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp @@ -15,7 +15,7 @@ // recursive_directory_iterator(recursive_directory_iterator&&) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_move_construct_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp index 915d00267..fc6d05cb0 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp @@ -15,7 +15,7 @@ // recursive_directory_iterator& operator=(recursive_directory_iterator const&); -#include +#include "filesystem_include.hpp" #include #include #include @@ -30,7 +30,7 @@ #pragma clang diagnostic ignored "-Wself-move" #endif -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_move_assign_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp index befa30484..39e0f4f57 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp @@ -16,7 +16,7 @@ // void pop(); // void pop(error_code& ec); -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_pop_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp index 5a3bdd9d4..36453a279 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp @@ -15,7 +15,7 @@ // bool recursion_pending() const; -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_recursion_pending_tests) diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp index ca5117f0e..8d9f14dfe 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp @@ -16,7 +16,7 @@ // recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; // recursive_directory_iterator end(recursive_directory_iterator iter) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,7 +26,7 @@ #include "filesystem_test_helper.hpp" #include -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(recursive_directory_iterator_begin_end_tests) diff --git a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp index 22f0cb845..4e3a33ce3 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp @@ -13,14 +13,13 @@ // enum class copy_options; -#include +#include "filesystem_include.hpp" #include #include #include "check_bitmask_types.hpp" #include "test_macros.h" -namespace fs = std::experimental::filesystem; constexpr fs::copy_options ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp index 7dbf7b288..d866c0b45 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp @@ -13,7 +13,7 @@ // enum class directory_options; -#include +#include "filesystem_include.hpp" #include #include #include @@ -21,7 +21,6 @@ #include "test_macros.h" #include "check_bitmask_types.hpp" -namespace fs = std::experimental::filesystem; constexpr fs::directory_options ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp index ab94ad287..6b6e069ff 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp @@ -13,13 +13,12 @@ // enum class file_type; -#include +#include "filesystem_include.hpp" #include #include #include "test_macros.h" -namespace fs = std::experimental::filesystem; constexpr fs::file_type ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp index c0b14ba4b..bfc769f55 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp @@ -13,7 +13,7 @@ // enum class perms; -#include +#include "filesystem_include.hpp" #include #include #include @@ -21,7 +21,6 @@ #include "test_macros.h" #include "check_bitmask_types.hpp" -namespace fs = std::experimental::filesystem; constexpr fs::perms ME(int val) { return static_cast(val); } diff --git a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp index 447fb46e8..62a0e74a1 100644 --- a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp +++ b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp @@ -13,7 +13,7 @@ // typedef TrivialClock file_time_type; -#include +#include "filesystem_include.hpp" #include #include @@ -25,7 +25,7 @@ typedef std::chrono::time_point ExpectedTimePoint; int main() { static_assert(std::is_same< - std::experimental::filesystem::file_time_type, + fs::file_time_type, ExpectedTimePoint >::value, ""); } diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp index 28e945b68..97d168a4a 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp @@ -13,7 +13,7 @@ // path absolute(const path& p, const path& base=current_path()); -#include +#include "filesystem_include.hpp" #include #include @@ -21,7 +21,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_absolute_path_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp index 407f5b111..0872b7b30 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp @@ -15,7 +15,7 @@ // path canonical(const path& p, error_code& ec); // path canonical(const path& p, const path& base, error_code& ec); -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_canonical_path_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp index 8f44e0d5a..ce853b636 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp @@ -17,7 +17,7 @@ // void copy(const path& from, const path& to, copy_options options, // error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,8 +26,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; using CO = fs::copy_options; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index fe5f00128..33b3ba9b5 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -17,7 +17,7 @@ // bool copy_file(const path& from, const path& to, copy_options options, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -26,8 +26,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; using CO = fs::copy_options; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp index fe4729806..2530bc9b6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp @@ -15,7 +15,7 @@ // void copy_symlink(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,8 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_copy_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp index c7d9339df..e7962941c 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp @@ -14,7 +14,7 @@ // bool create_directories(const path& p); // bool create_directories(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,8 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_directories_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp index 5fce217bc..4bc30c2b3 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp @@ -16,7 +16,7 @@ // bool create_directory(const path& p, const path& attr); // bool create_directory(const path& p, const path& attr, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -27,8 +27,7 @@ #include #include -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; fs::perms read_umask() { mode_t old_mask = umask(0); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp index c32bdd2d1..d0fff583a 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp @@ -14,7 +14,7 @@ // bool create_directory(const path& p, const path& attr); // bool create_directory(const path& p, const path& attr, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,8 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_directory_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp index 85a3b6cb3..e7cba97dd 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp @@ -15,15 +15,14 @@ // void create_directory_symlink(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_directory_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp index 7aefece46..7dbc705f4 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp @@ -15,14 +15,13 @@ // void create_hard_link(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_hard_link_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp index d261d987a..46519ad77 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp @@ -15,15 +15,14 @@ // void create_symlink(const path& existing_symlink, const path& new_symlink, // error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_create_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp index 9d004ab85..82ba91c0f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp @@ -16,7 +16,7 @@ // void current_path(path const&); // void current_path(path const&, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_current_path_path_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp index a3591e026..3381f64d5 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp @@ -14,7 +14,7 @@ // bool equivalent(path const& lhs, path const& rhs); // bool equivalent(path const& lhs, path const& rhs, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(equivalent_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp index 2b9f57e7e..4b6ed9642 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp @@ -15,7 +15,7 @@ // bool exists(path const& p); // bool exists(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(exists_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp index 460e42dd1..1f7b87ae8 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp @@ -14,7 +14,7 @@ // uintmax_t file_size(const path& p); // uintmax_t file_size(const path& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(file_size_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp index 6b542a5b6..f90e3f772 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp @@ -14,7 +14,7 @@ // uintmax_t hard_link_count(const path& p); // uintmax_t hard_link_count(const path& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(hard_link_count_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp index dee28aa5b..c27565e5f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp @@ -15,7 +15,7 @@ // bool is_block_file(path const& p); // bool is_block_file(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_block_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp index 2de42bf20..546881920 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp @@ -15,7 +15,7 @@ // bool is_character_file(path const& p); // bool is_character_file(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_character_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp index d6ecb1a1e..3270fcc80 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp @@ -15,7 +15,7 @@ // bool is_directory(path const& p); // bool is_directory(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_directory_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp index 2da163c33..ffe60a823 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp @@ -14,7 +14,7 @@ // bool is_empty(path const& p); // bool is_empty(path const& p, std::error_code& ec); -#include +#include "filesystem_include.hpp" #include #include @@ -22,7 +22,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_empty_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp index 44892f65d..9c56f7356 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp @@ -15,7 +15,7 @@ // bool is_fifo(path const& p); // bool is_fifo(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_fifo_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp index e86b66b4e..d01268a73 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp @@ -15,7 +15,7 @@ // bool is_other(path const& p); // bool is_other(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_other_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp index be68dcfc3..96e027d2c 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp @@ -15,7 +15,7 @@ // bool is_regular_file(path const& p); // bool is_regular_file(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_regular_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp index 49fd402eb..1593d6a3b 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp @@ -15,7 +15,7 @@ // bool is_socket(path const& p); // bool is_socket(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_socket_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp index 3de002978..97cd0a3d0 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp @@ -15,7 +15,7 @@ // bool is_symlink(path const& p); // bool is_symlink(path const& p, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -23,7 +23,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(is_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp index 0ca82b21f..b842b4a18 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -18,7 +18,7 @@ // std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include #include @@ -31,7 +31,7 @@ #include #include -using namespace std::experimental::filesystem; +using namespace fs; std::pair GetTimes(path const& p) { diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 794aeb992..1082a62fa 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -15,14 +15,13 @@ // void permissions(const path& p, perms prms, std::error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; using PR = fs::perms; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp index d69e95ce5..8011da343 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp @@ -14,14 +14,13 @@ // path read_symlink(const path& p); // path read_symlink(const path& p, error_code& ec); -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_read_symlink_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp index 2fdb4ad47..2b5f52c75 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp @@ -14,14 +14,13 @@ // bool remove(const path& p); // bool remove(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_remove_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp index 64c5c88c8..99935f44b 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp @@ -14,14 +14,13 @@ // uintmax_t remove_all(const path& p); // uintmax_t remove_all(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_remove_all_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp index e265c7af6..f20d73fcc 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp @@ -14,14 +14,13 @@ // void rename(const path& old_p, const path& new_p); // void rename(const path& old_p, const path& new_p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_rename_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp index f7c2ee14e..38596cd4c 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp @@ -14,14 +14,13 @@ // void resize_file(const path& p, uintmax_t new_size); // void resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; -namespace fs = std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_resize_file_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp index 8f241810f..4f617cd66 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp @@ -14,14 +14,14 @@ // space_info space(const path& p); // space_info space(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; bool EqualDelta(std::uintmax_t x, std::uintmax_t y, std::uintmax_t delta) { if (x >= y) { diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp index fdc3d2b4a..997f318f7 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp @@ -14,13 +14,13 @@ // file_status status(const path& p); // file_status status(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_status_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp index 169c5be9d..ed6733fb6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp @@ -13,7 +13,7 @@ // bool status_known(file_status s) noexcept; -#include +#include "filesystem_include.hpp" #include #include @@ -21,7 +21,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(status_known_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp index 647504f6e..9db83fbc3 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp @@ -14,13 +14,13 @@ // file_status symlink_status(const path& p); // file_status symlink_status(const path& p, error_code& ec) noexcept; -#include +#include "filesystem_include.hpp" #include "test_macros.h" #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_symlink_status_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp index 634184e24..b4fb1f19a 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp @@ -17,7 +17,7 @@ // Note: For POSIX based operating systems, 'system_complete(p)' has the // same semantics as 'absolute(p, current_path())'. -#include +#include "filesystem_include.hpp" #include #include @@ -25,7 +25,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; TEST_SUITE(filesystem_system_complete_test_suite) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp index 021dd7fc8..1942bd8b4 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -14,7 +14,7 @@ // path temp_directory_path(); // path temp_directory_path(error_code& ec); -#include +#include "filesystem_include.hpp" #include #include #include @@ -24,7 +24,7 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -using namespace std::experimental::filesystem; +using namespace fs; void PutEnv(std::string var, std::string value) { assert(::setenv(var.c_str(), value.c_str(), /* overwrite */ 1) == 0); diff --git a/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp b/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp index d57dff4a7..42dfe9480 100644 --- a/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp +++ b/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp @@ -13,7 +13,7 @@ // #define __cpp_lib_experimental_filesystem 201406L -#include +#include "filesystem_include.hpp" #ifndef __cpp_lib_experimental_filesystem #error Filesystem feature test macro is not defined (__cpp_lib_experimental_filesystem) diff --git a/test/support/filesystem_include.hpp b/test/support/filesystem_include.hpp new file mode 100644 index 000000000..228e710f3 --- /dev/null +++ b/test/support/filesystem_include.hpp @@ -0,0 +1,18 @@ +#ifndef TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP +#define TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP + +#include +// Test against std::filesystem for STL's other than libc++ +#ifndef _LIBCPP_VERSION +#define TEST_INCLUDE_STD_FILESYSTEM +#endif + +#ifdef TEST_INCLUDE_STD_FILESYSTEM +#include +namespace fs = std::filesystem; +#else +#include +namespace fs = std::experimental::filesystem; +#endif + +#endif diff --git a/test/support/filesystem_test_helper.hpp b/test/support/filesystem_test_helper.hpp index 755be9035..622a60d1c 100644 --- a/test/support/filesystem_test_helper.hpp +++ b/test/support/filesystem_test_helper.hpp @@ -1,7 +1,7 @@ #ifndef FILESYSTEM_TEST_HELPER_HPP #define FILESYSTEM_TEST_HELPER_HPP -#include +#include "filesystem_include.hpp" #include #include // for printf #include @@ -9,7 +9,6 @@ #include #include -namespace fs = std::experimental::filesystem; // static test helpers From f2c93738b886428c46476c36dfa38296aef1b2ef Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 26 Mar 2018 06:23:55 +0000 Subject: [PATCH 0417/1520] Implement filesystem::perm_options specified in NB comments. The NB comments for filesystem changed permissions and added a new enum `perm_options` which control how the permissions are applied. This implements than NB resolution git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328476 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/filesystem | 64 ++++++++++++--- src/experimental/filesystem/operations.cpp | 19 +++-- .../rec.dir.itr.members/increment.pass.cpp | 12 +-- .../filesystem/fs.enum/enum.perms.pass.cpp | 5 +- .../create_directory_with_attributes.pass.cpp | 2 +- .../fs.op.permissions/permissions.pass.cpp | 77 +++++++++++-------- 6 files changed, 119 insertions(+), 60 deletions(-) diff --git a/include/experimental/filesystem b/include/experimental/filesystem index cdfe9e254..47cc0c5aa 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -68,6 +68,7 @@ enum class file_type; enum class perms; + enum class perm_options; enum class copy_options; enum class directory_options; @@ -178,8 +179,11 @@ void last_write_time(const path& p, file_time_type new_time, error_code& ec) _NOEXCEPT; - void permissions(const path& p, perms prms); - void permissions(const path& p, perms prms, error_code& ec) _NOEXCEPT; + void permissions(const path& p, perms prms, + perm_options opts=perm_options::replace); + void permissions(const path& p, perms prms, error_code& ec) noexcept; + void permissions(const path& p, perms prms, perm_options opts, + error_code& ec); path read_symlink(const path& p); path read_symlink(const path& p, error_code& ec); @@ -290,10 +294,6 @@ enum class _LIBCPP_ENUM_VIS perms : unsigned sticky_bit = 01000, mask = 07777, unknown = 0xFFFF, - - add_perms = 0x10000, - remove_perms = 0x20000, - symlink_nofollow = 0x40000 }; _LIBCPP_INLINE_VISIBILITY @@ -324,6 +324,41 @@ _LIBCPP_INLINE_VISIBILITY inline perms& operator^=(perms& _LHS, perms _RHS) { return _LHS = _LHS ^ _RHS; } +enum class _LIBCPP_ENUM_VIS perm_options : unsigned char { + replace = 1, + add = 2, + remove = 4, + nofollow = 8 +}; + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator&(perm_options _LHS, perm_options _RHS) +{ return static_cast(static_cast(_LHS) & static_cast(_RHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator|(perm_options _LHS, perm_options _RHS) +{ return static_cast(static_cast(_LHS) | static_cast(_RHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator^(perm_options _LHS, perm_options _RHS) +{ return static_cast(static_cast(_LHS) ^ static_cast(_RHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR perm_options operator~(perm_options _LHS) +{ return static_cast(~static_cast(_LHS)); } + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) +{ return _LHS = _LHS & _RHS; } + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) +{ return _LHS = _LHS | _RHS; } + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) +{ return _LHS = _LHS ^ _RHS; } + enum class _LIBCPP_ENUM_VIS copy_options : unsigned short { none = 0, @@ -1286,7 +1321,7 @@ _LIBCPP_FUNC_VIS void __last_write_time(const path& p, file_time_type new_time, error_code *ec=nullptr); _LIBCPP_FUNC_VIS -void __permissions(const path& p, perms prms, error_code *ec=nullptr); +void __permissions(const path&, perms, perm_options, error_code* = nullptr); _LIBCPP_FUNC_VIS path __read_symlink(const path& p, error_code *ec=nullptr); _LIBCPP_FUNC_VIS @@ -1664,13 +1699,20 @@ void last_write_time(const path& __p, file_time_type __t, error_code& __ec) _NOE } inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms) { - __permissions(__p, __prms); +void permissions(const path& __p, perms __prms, + perm_options __opts = perm_options::replace) { + __permissions(__p, __prms, __opts); } inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms, error_code& __ec) { - __permissions(__p, __prms, &__ec); +void permissions(const path& __p, perms __prms, error_code& __ec) _NOEXCEPT { + __permissions(__p, __prms, perm_options::replace, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY +void permissions(const path& __p, perms __prms, perm_options __opts, + error_code& __ec) { + __permissions(__p, __prms, __opts, &__ec); } inline _LIBCPP_INLINE_VISIBILITY diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index bd173893c..b52022ac3 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -178,7 +178,7 @@ bool copy_file_impl(const path& from, const path& to, perms from_perms, ec, "copy_file", from, to); return false; } - __permissions(to, from_perms, ec); + __permissions(to, from_perms, perm_options::replace, ec); // TODO what if permissions fails? return true; } @@ -635,14 +635,17 @@ void __last_write_time(const path& p, file_time_type new_time, } -void __permissions(const path& p, perms prms, std::error_code *ec) +void __permissions(const path& p, perms prms, perm_options opts, + std::error_code *ec) { - - const bool resolve_symlinks = !bool(perms::symlink_nofollow & prms); - const bool add_perms = bool(perms::add_perms & prms); - const bool remove_perms = bool(perms::remove_perms & prms); - _LIBCPP_ASSERT(!(add_perms && remove_perms), - "Both add_perms and remove_perms are set"); + auto has_opt = [&](perm_options o) { return bool(o & opts); }; + const bool resolve_symlinks = !has_opt(perm_options::nofollow); + const bool add_perms = has_opt(perm_options::add); + const bool remove_perms = has_opt(perm_options::remove); + _LIBCPP_ASSERT( + (add_perms + remove_perms + has_opt(perm_options::replace)) == 1, + "One and only one of the perm_options constants replace, add, or remove " + "is present in opts"); bool set_sym_perms = false; prms &= perms::mask; diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index d2a5b8c18..1699a414a 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -255,8 +255,8 @@ TEST_CASE(test_PR35078) // Change the permissions so we can no longer iterate permissions(permDeniedDir, - perms::remove_perms|perms::group_exec - |perms::owner_exec|perms::others_exec); + perms::group_exec|perms::owner_exec|perms::others_exec, + perm_options::remove); const std::error_code eacess_ec = std::make_error_code(std::errc::permission_denied); @@ -329,8 +329,8 @@ TEST_CASE(test_PR35078_with_symlink) // Change the permissions so we can no longer iterate permissions(permDeniedDir, - perms::remove_perms|perms::group_exec - |perms::owner_exec|perms::others_exec); + perms::group_exec|perms::owner_exec|perms::others_exec, + perm_options::remove); const std::error_code eacess_ec = std::make_error_code(std::errc::permission_denied); @@ -413,8 +413,8 @@ TEST_CASE(test_PR35078_with_symlink_file) // Change the permissions so we can no longer iterate permissions(permDeniedDir, - perms::remove_perms|perms::group_exec - |perms::owner_exec|perms::others_exec); + perms::group_exec|perms::owner_exec|perms::others_exec, + perm_options::remove); const std::error_code eacess_ec = std::make_error_code(std::errc::permission_denied); diff --git a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp index bfc769f55..7cd8f6779 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp +++ b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp @@ -59,9 +59,6 @@ int main() { E::set_gid == ME(02000) && E::sticky_bit == ME(01000) && E::mask == ME(07777) && - E::unknown == ME(0xFFFF) && - E::add_perms == ME(0x10000) && - E::remove_perms == ME(0x20000) && - E::symlink_nofollow == ME(0x40000), + E::unknown == ME(0xFFFF), "Expected enumeration values do not match"); } diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp index d0fff583a..8ec22f1f9 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp @@ -60,7 +60,7 @@ TEST_CASE(create_directory_one_level) { scoped_test_env env; // Remove setgid which mkdir would inherit - permissions(env.test_root, perms::remove_perms | perms::set_gid); + permissions(env.test_root, perms::set_gid, perm_options::remove); const path dir = env.make_env_path("dir1"); const path attr_dir = env.create_dir("dir2"); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 1082a62fa..3783f5f34 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -11,8 +11,11 @@ // -// void permissions(const path& p, perms prms); +// void permissions(const path& p, perms prms, +// perm_options opts = perm_options::replace); // void permissions(const path& p, perms prms, std::error_code& ec) noexcept; +// void permissions(const path& p, perms prms, perm_options opts, std::error_code); + #include "filesystem_include.hpp" @@ -30,17 +33,19 @@ TEST_SUITE(filesystem_permissions_test_suite) TEST_CASE(test_signatures) { const path p; ((void)p); - const perms opts{}; ((void)opts); + const perms pr{}; ((void)pr); + const perm_options opts{}; ((void)opts); std::error_code ec; ((void)ec); - ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts)); - // Not noexcept because of narrow contract - LIBCPP_ONLY( - ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec))); + ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr)); + ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts)); + ASSERT_NOEXCEPT(fs::permissions(p, pr, ec)); + ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts, ec)); } TEST_CASE(test_error_reporting) { - auto checkThrow = [](path const& f, fs::perms opts, const std::error_code& ec) + auto checkThrow = [](path const& f, fs::perms opts, + const std::error_code& ec) { #ifndef TEST_HAS_NO_EXCEPTIONS try { @@ -61,15 +66,17 @@ TEST_CASE(test_error_reporting) const path dne = env.make_env_path("dne"); const path dne_sym = env.create_symlink(dne, "dne_sym"); { // !exists - std::error_code ec; + std::error_code ec = GetTestEC(); fs::permissions(dne, fs::perms{}, ec); TEST_REQUIRE(ec); + TEST_CHECK(ec != GetTestEC()); TEST_CHECK(checkThrow(dne, fs::perms{}, ec)); } { - std::error_code ec; + std::error_code ec = GetTestEC(); fs::permissions(dne_sym, fs::perms{}, ec); TEST_REQUIRE(ec); + TEST_CHECK(ec != GetTestEC()); TEST_CHECK(checkThrow(dne_sym, fs::perms{}, ec)); } } @@ -81,42 +88,51 @@ TEST_CASE(basic_permissions_test) const path dir = env.create_dir("dir1"); const path file_for_sym = env.create_file("file2", 42); const path sym = env.create_symlink(file_for_sym, "sym"); - const perms AP = perms::add_perms; - const perms RP = perms::remove_perms; - const perms NF = perms::symlink_nofollow; + const perm_options AP = perm_options::add; + const perm_options RP = perm_options::remove; + const perm_options NF = perm_options::nofollow; struct TestCase { path p; perms set_perms; perms expected; + perm_options opts = perm_options::replace; } cases[] = { // test file {file, perms::none, perms::none}, {file, perms::owner_all, perms::owner_all}, - {file, perms::group_all | AP, perms::owner_all | perms::group_all}, - {file, perms::group_all | RP, perms::owner_all}, + {file, perms::group_all, perms::owner_all | perms::group_all, AP}, + {file, perms::group_all, perms::owner_all, RP}, // test directory {dir, perms::none, perms::none}, {dir, perms::owner_all, perms::owner_all}, - {dir, perms::group_all | AP, perms::owner_all | perms::group_all}, - {dir, perms::group_all | RP, perms::owner_all}, + {dir, perms::group_all, perms::owner_all | perms::group_all, AP}, + {dir, perms::group_all, perms::owner_all, RP}, // test symlink without symlink_nofollow {sym, perms::none, perms::none}, {sym, perms::owner_all, perms::owner_all}, - {sym, perms::group_all | AP, perms::owner_all | perms::group_all}, - {sym, perms::group_all | RP , perms::owner_all}, + {sym, perms::group_all, perms::owner_all | perms::group_all, AP}, + {sym, perms::group_all, perms::owner_all, RP}, // test non-symlink with symlink_nofollow. The last test on file/dir // will have set their permissions to perms::owner_all - {file, perms::group_all | AP | NF, perms::owner_all | perms::group_all}, - {dir, perms::group_all | AP | NF, perms::owner_all | perms::group_all} + {file, perms::group_all, perms::owner_all | perms::group_all, AP | NF}, + {dir, perms::group_all, perms::owner_all | perms::group_all, AP | NF} }; for (auto const& TC : cases) { TEST_CHECK(status(TC.p).permissions() != TC.expected); - // Set the error code to ensure it's cleared. - std::error_code ec = std::make_error_code(std::errc::bad_address); - permissions(TC.p, TC.set_perms, ec); - TEST_CHECK(!ec); - auto pp = status(TC.p).permissions(); - TEST_CHECK(pp == TC.expected); + { + std::error_code ec = GetTestEC(); + permissions(TC.p, TC.set_perms, TC.opts, ec); + TEST_CHECK(!ec); + auto pp = status(TC.p).permissions(); + TEST_CHECK(pp == TC.expected); + } + if (TC.opts == perm_options::replace) { + std::error_code ec = GetTestEC(); + permissions(TC.p, TC.set_perms, ec); + TEST_CHECK(!ec); + auto pp = status(TC.p).permissions(); + TEST_CHECK(pp == TC.expected); + } } } @@ -130,10 +146,11 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) struct TestCase { perms set_perms; perms expected; // only expected on platform that support symlink perms. + perm_options opts = perm_options::replace; } cases[] = { {perms::owner_all, perms::owner_all}, - {perms::group_all | perms::add_perms, perms::owner_all | perms::group_all}, - {perms::owner_all | perms::remove_perms, perms::group_all}, + {perms::group_all, perms::owner_all | perms::group_all, perm_options::add}, + {perms::owner_all, perms::group_all, perm_options::remove}, }; for (auto const& TC : cases) { #if defined(__APPLE__) || defined(__FreeBSD__) @@ -148,8 +165,8 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) const auto expected_link_perms = symlink_status(sym).permissions(); std::error_code expected_ec = std::make_error_code(std::errc::operation_not_supported); #endif - std::error_code ec = std::make_error_code(std::errc::bad_address); - permissions(sym, TC.set_perms | perms::symlink_nofollow, ec); + std::error_code ec = GetTestEC(); + permissions(sym, TC.set_perms, TC.opts | perm_options::nofollow, ec); TEST_CHECK(ec == expected_ec); TEST_CHECK(status(file).permissions() == file_perms); TEST_CHECK(symlink_status(sym).permissions() == expected_link_perms); From 245b3a06a17b95cd11ef9d59e74d35095d5b7c14 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 26 Mar 2018 07:06:25 +0000 Subject: [PATCH 0418/1520] Fix test case initialization issues in permissions test git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328477 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../fs.op.funcs/fs.op.permissions/permissions.pass.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 3783f5f34..65d8d7164 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -95,7 +95,10 @@ TEST_CASE(basic_permissions_test) path p; perms set_perms; perms expected; - perm_options opts = perm_options::replace; + perm_options opts; + TestCase(path xp, perms xperms, perms xexpect, + perm_options xopts = perm_options::replace) + : p(xp), set_perms(xperms), expected(xexpect), opts(xopts) {} } cases[] = { // test file {file, perms::none, perms::none}, @@ -147,6 +150,9 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) perms set_perms; perms expected; // only expected on platform that support symlink perms. perm_options opts = perm_options::replace; + TestCase(perms xperms, perms xexpect, + perm_options xopts = perm_options::replace) + : set_perms(xperms), expected(xexpect), opts(xopts) {} } cases[] = { {perms::owner_all, perms::owner_all}, {perms::group_all, perms::owner_all | perms::group_all, perm_options::add}, From f382e530159b42de9120ddecaf57d540471f5962 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 29 Mar 2018 01:18:53 +0000 Subject: [PATCH 0419/1520] Fix PR36914 - num_get::get(unsigned) incorrectly handles negative numbers. This patch corrects num_get for unsigned types to support strings with a leading `-` character. According to the standard the number should be parsed as an unsigned integer and then negated. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328751 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/locale | 15 +- .../test_min_max.pass.cpp | 23 +-- .../test_neg_one.pass.cpp | 159 ++++++++++++++++++ 3 files changed, 180 insertions(+), 17 deletions(-) create mode 100644 test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp diff --git a/include/locale b/include/locale index a86645d2c..52885b768 100644 --- a/include/locale +++ b/include/locale @@ -768,10 +768,10 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, { if (__a != __a_end) { - if (*__a == '-') - { - __err = ios_base::failbit; - return 0; + const bool __negate = *__a == '-'; + if (__negate && ++__a == __a_end) { + __err = ios_base::failbit; + return 0; } typename remove_reference::type __save_errno = errno; errno = 0; @@ -785,13 +785,14 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, __err = ios_base::failbit; return 0; } - else if (__current_errno == ERANGE || - numeric_limits<_Tp>::max() < __ll) + else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) { __err = ios_base::failbit; return numeric_limits<_Tp>::max(); } - return static_cast<_Tp>(__ll); + _Tp __res = static_cast<_Tp>(__ll); + if (__negate) __res = -__res; + return __res; } __err = ios_base::failbit; return 0; diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp index 6ba5a89e6..e2218fffb 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp @@ -15,9 +15,17 @@ using namespace std; +template +bool check_stream_failed(std::string const& val) { + istringstream ss(val); + T result; + return !(ss >> result); +} + template void check_limits() { + const bool is_unsigned = std::is_unsigned::value; T minv = numeric_limits::min(); T maxv = numeric_limits::max(); @@ -36,17 +44,12 @@ void check_limits() assert(new_minv == minv); assert(new_maxv == maxv); - if(mins == "0") - mins = "-1"; - else - mins[mins.size() - 1]++; - maxs[maxs.size() - 1]++; - - istringstream maxoss2(maxs), minoss2(mins); - - assert(! (maxoss2 >> new_maxv)); - assert(! (minoss2 >> new_minv)); + assert(check_stream_failed(maxs)); + if (!is_unsigned) { + mins[mins.size() - 1]++; + assert(check_stream_failed(mins)); + } } int main(void) diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp new file mode 100644 index 000000000..fa0641f61 --- /dev/null +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp @@ -0,0 +1,159 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class num_get + +// iter_type get(iter_type in, iter_type end, ios_base&, +// ios_base::iostate& err, unsigned int& v) const; + +#include +#include +#include +#include +#include +#include +#include "test_iterators.h" + +typedef std::num_get > F; + +class my_facet + : public F +{ +public: + explicit my_facet(std::size_t refs = 0) + : F(refs) {} +}; + +template +std::string make_neg_string(T value) { + std::ostringstream ss; + assert(ss << value); + std::string res = ss.str(); + return '-' + res; +} + +template +void test_neg_one() { + const my_facet f(1); + std::ios ios(0); + T v = static_cast(42); + { + const char str[] = "-1"; + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+sizeof(str)), + ios, err, v); + assert(iter.base() == str+sizeof(str)-1); + assert(err == ios.goodbit); + assert(v == T(-1)); + } + v = 42; + { + const char str[] = "-"; + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+sizeof(str)), + ios, err, v); + assert(iter.base() == str+sizeof(str)-1); + assert(err == ios.failbit); + assert(v == 0); + } +} + +template +void test_negate() { + typedef typename std::make_signed::type SignedT; + const my_facet f(1); + std::ios ios(0); + T v = 42; + { + T value = std::numeric_limits::max(); + ++value; + std::string std_str = make_neg_string(value); + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.goodbit); + T expected = -value; + assert(v == expected); + } + v = 42; + { + T value = std::numeric_limits::max(); + ++value; + ++value; + std::string std_str = make_neg_string(value); + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.goodbit); + T expected = -value; + assert(v == expected); + } + v = 42; + { + T value = std::numeric_limits::max(); + std::string std_str = make_neg_string(value); + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.goodbit); + T expected = -value; + assert(v == expected); + } + v = 42; + { + std::string std_str = make_neg_string(std::numeric_limits::max()); + std_str.back()++; + const char* str = std_str.data(); + size_t size = std_str.size(); + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+size+1), + ios, err, v); + assert(iter.base() == str+size); + assert(err == ios.failbit); + assert(v == T(-1)); + } +} + +int main(void) +{ + test_neg_one(); + test_neg_one(); + test_neg_one(); + test_neg_one(); + test_neg_one(); + test_neg_one(); + + test_negate(); + test_negate(); + test_negate(); + test_negate(); +} From 3e005cc5834a4b9773db07ed52bf29470798c5e1 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 29 Mar 2018 03:30:00 +0000 Subject: [PATCH 0420/1520] Move libc++ pair/tuple assign test to libcxx/ test directory. Libc++ implements the pair& operator=(pair) assignment operator using a single template that handles assignment from all tuple-like types. This patch moves the test for that to the libcxx test directory since it's non-standard. It also adds additional tests to the std/.../pair directory to test the standard behavior this template implements. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328758 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../pairs.pair/assign_tuple_like.pass.cpp} | 52 +++---------------- .../pairs.pair/assign_const_pair_U_V.pass.cpp | 22 ++++++++ .../pairs.pair/assign_rv_pair_U_V.pass.cpp | 16 ++++++ 3 files changed, 46 insertions(+), 44 deletions(-) rename test/{std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp => libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp} (67%) diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp similarity index 67% rename from test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp rename to test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp index ef7bebcf5..0e0117e4e 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp +++ b/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp @@ -21,58 +21,22 @@ #include #include +#include "archetypes.hpp" + // Clang warns about missing braces when initializing std::array. #if defined(__clang__) #pragma clang diagnostic ignored "-Wmissing-braces" #endif -struct CountingType { - static int constructed; - static int copy_constructed; - static int move_constructed; - static int assigned; - static int copy_assigned; - static int move_assigned; - static void reset() { - constructed = copy_constructed = move_constructed = 0; - assigned = copy_assigned = move_assigned = 0; - } - CountingType() : value(0) { ++constructed; } - CountingType(int v) : value(v) { ++constructed; } - CountingType(CountingType const& o) : value(o.value) { ++constructed; ++copy_constructed; } - CountingType(CountingType&& o) : value(o.value) { ++constructed; ++move_constructed; o.value = -1;} - - CountingType& operator=(CountingType const& o) { - ++assigned; - ++copy_assigned; - value = o.value; - return *this; - } - CountingType& operator=(CountingType&& o) { - ++assigned; - ++move_assigned; - value = o.value; - o.value = -1; - return *this; - } - int value; -}; -int CountingType::constructed; -int CountingType::copy_constructed; -int CountingType::move_constructed; -int CountingType::assigned; -int CountingType::copy_assigned; -int CountingType::move_assigned; - int main() { - using C = CountingType; + using C = TestTypes::TestType; { using P = std::pair; using T = std::tuple; T t(42, C{42}); P p(101, C{101}); - C::reset(); + C::reset_constructors(); p = t; assert(C::constructed == 0); assert(C::assigned == 1); @@ -86,7 +50,7 @@ int main() using T = std::tuple; T t(42, -42); P p(101, 101); - C::reset(); + C::reset_constructors(); p = std::move(t); assert(C::constructed == 0); assert(C::assigned == 1); @@ -100,7 +64,7 @@ int main() using T = std::array; T t = {42, -42}; P p{101, 101}; - C::reset(); + C::reset_constructors(); p = t; assert(C::constructed == 0); assert(C::assigned == 2); @@ -114,7 +78,7 @@ int main() using T = std::array; T t = {42, -42}; P p{101, 101}; - C::reset(); + C::reset_constructors(); p = t; assert(C::constructed == 0); assert(C::assigned == 2); @@ -128,7 +92,7 @@ int main() using T = std::array; T t = {42, -42}; P p{101, 101}; - C::reset(); + C::reset_constructors(); p = std::move(t); assert(C::constructed == 0); assert(C::assigned == 2); diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp index 132443f66..3ee6f0755 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp @@ -16,6 +16,11 @@ #include #include +#include "test_macros.h" +#if TEST_STD_VER >= 11 +#include "archetypes.hpp" +#endif + int main() { { @@ -27,4 +32,21 @@ int main() assert(p2.first == 3); assert(p2.second == 4); } +#if TEST_STD_VER >= 11 + { + using C = TestTypes::TestType; + using P = std::pair; + using T = std::pair; + const T t(42, -42); + P p(101, 101); + C::reset_constructors(); + p = t; + assert(C::constructed == 0); + assert(C::assigned == 1); + assert(C::copy_assigned == 1); + assert(C::move_assigned == 0atu); + assert(p.first == 42); + assert(p.second.value == -42); + } +#endif } diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp index 76dfc3f65..b7a89a844 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp @@ -18,6 +18,7 @@ #include #include #include +#include struct Base { @@ -40,4 +41,19 @@ int main() assert(p2.first == nullptr); assert(p2.second == 4); } + { + using C = TestTypes::TestType; + using P = std::pair; + using T = std::pair; + T t(42, -42); + P p(101, 101); + C::reset_constructors(); + p = std::move(t); + assert(C::constructed == 0); + assert(C::assigned == 1); + assert(C::copy_assigned == 0); + assert(C::move_assigned == 1); + assert(p.first == 42); + assert(p.second.value == -42); + } } From 4e177b91d0a4e6f3a1c7779309f4c02707ae3b69 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 29 Mar 2018 03:44:01 +0000 Subject: [PATCH 0421/1520] fix typo in align_const_pair_U_V.pass.cpp git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328760 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp index 3ee6f0755..90722c393 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp @@ -44,7 +44,7 @@ int main() assert(C::constructed == 0); assert(C::assigned == 1); assert(C::copy_assigned == 1); - assert(C::move_assigned == 0atu); + assert(C::move_assigned == 0); assert(p.first == 42); assert(p.second.value == -42); } From ead2a5495298faa7f52f54956fd3cb04c62ff6bd Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Mon, 2 Apr 2018 22:09:57 +0000 Subject: [PATCH 0422/1520] [libcxx] Disable testing with system lib for 2 tests verifying debug mode. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329023 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../thread/futures/futures.promise/set_exception.pass.cpp | 3 +++ .../futures.promise/set_exception_at_thread_exit.pass.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index abfbb685d..805aee138 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -14,6 +14,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS // MODULES_DEFINES: _LIBCPP_DEBUG=0 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // class promise diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index 6736bae97..88061bb5f 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -14,6 +14,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS // MODULES_DEFINES: _LIBCPP_DEBUG=0 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // class promise From 1e34c76d3374164cff168bd571f61387c3b0d3f3 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 2 Apr 2018 23:03:41 +0000 Subject: [PATCH 0423/1520] Implement filesystem NB comments, relative paths, and related issues. This is a fairly large patch that implements all of the filesystem NB comments and the relative paths changes (ex. adding weakly_canonical). These issues and papers are all interrelated so their implementation couldn't be split up nicely. This patch upgrades to match the C++17 spec and not the published experimental TS spec. Some of the changes in this patch are both API and ABI breaking, however libc++ makes no guarantee about stability for experimental implementations. The major changes in this patch are: * Implement NB comments for filesystem (P0492R2), including: * Implement `perm_options` enum as part of NB comments, and update the `permissions` function to match. * Implement changes to `remove_filename` and `replace_filename` * Implement changes to `path::stem()` and `path::extension()` which support splitting examples like `.profile`. * Change path iteration to return an empty path instead of '.' for trailing separators. * Change `operator/=` to handle absolute paths on the RHS. * Change `absolute` to no longer accept a current path argument. * Implement relative paths according to NB comments (P0219r1) * Combine `path.cpp` and `operations.cpp` since some path functions require access to the operations internals, and some fs operations require access to the path parser. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329028 91177308-0d34-0410-b5e6-96231b3b80d8 --- benchmarks/CMakeLists.txt | 2 +- benchmarks/GenerateInput.hpp | 6 +- benchmarks/filesystem.bench.cpp | 55 +- include/experimental/filesystem | 176 +++-- src/experimental/filesystem/operations.cpp | 685 +++++++++++++++++- src/experimental/filesystem/path.cpp | 448 ------------ .../path.member/path.append.pass.cpp | 70 -- .../class.path/path.itr/iterator.pass.cpp | 4 +- .../path.member/path.append.pass.cpp | 72 +- .../path.member/path.compare.pass.cpp | 17 +- .../path.member/path.decompose/empty.fail.cpp | 1 + .../path.decompose/path.decompose.pass.cpp | 108 +-- .../path.gen/lexically_normal.pass.cpp | 142 ++++ .../lexically_relative_and_proximate.pass.cpp | 89 +++ .../generic_string_alloc.pass.cpp | 1 - .../path.generic.obs/named_overloads.pass.cpp | 1 - .../path.modifiers/remove_filename.pass.cpp | 46 +- .../path.modifiers/replace_filename.pass.cpp | 15 +- .../fs.enum/enum.perm_options.pass.cpp | 48 ++ .../fs.op.absolute/absolute.pass.cpp | 95 +-- .../fs.op.canonical/canonical.pass.cpp | 56 +- .../last_write_time.pass.cpp | 2 - .../fs.op.proximate/proximate.pass.cpp | 125 ++++ .../fs.op.relative/relative.pass.cpp | 78 ++ .../system_complete.pass.cpp | 58 -- .../weakly_canonical.pass.cpp | 76 ++ test/support/filesystem_test_helper.hpp | 5 +- test/support/verbose_assert.h | 222 ++++++ www/cxx1z_status.html | 4 +- www/cxx2a_status.html | 2 +- 30 files changed, 1810 insertions(+), 899 deletions(-) delete mode 100644 src/experimental/filesystem/path.cpp delete mode 100644 test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp create mode 100644 test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_normal.pass.cpp create mode 100644 test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.enum/enum.perm_options.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.proximate/proximate.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.relative/relative.pass.cpp delete mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp create mode 100644 test/std/experimental/filesystem/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp create mode 100644 test/support/verbose_assert.h diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 8a154d86f..f557d4aea 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -68,7 +68,7 @@ set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx) set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native) set(BENCHMARK_TEST_COMPILE_FLAGS - -std=c++14 -O2 + -std=c++17 -O2 -I${BENCHMARK_LIBCXX_INSTALL}/include -I${LIBCXX_SOURCE_DIR}/test/support ) diff --git a/benchmarks/GenerateInput.hpp b/benchmarks/GenerateInput.hpp index 9d5adac4a..8c97f5881 100644 --- a/benchmarks/GenerateInput.hpp +++ b/benchmarks/GenerateInput.hpp @@ -29,14 +29,16 @@ inline std::default_random_engine& getRandomEngine() { return RandEngine; } + inline char getRandomChar() { std::uniform_int_distribution<> LettersDist(0, LettersSize-1); return Letters[LettersDist(getRandomEngine())]; } template -inline IntT getRandomInteger() { - std::uniform_int_distribution dist; +inline IntT getRandomInteger(IntT Min = 0, + IntT Max = std::numeric_limits::max()) { + std::uniform_int_distribution dist(Min, Max); return dist(getRandomEngine()); } diff --git a/benchmarks/filesystem.bench.cpp b/benchmarks/filesystem.bench.cpp index 677198035..3e4956059 100644 --- a/benchmarks/filesystem.bench.cpp +++ b/benchmarks/filesystem.bench.cpp @@ -1,17 +1,14 @@ -#include - #include "benchmark/benchmark.h" #include "GenerateInput.hpp" #include "test_iterators.h" - -namespace fs = std::experimental::filesystem; +#include "filesystem_include.hpp" static const size_t TestNumInputs = 1024; template void BM_PathConstructString(benchmark::State &st, GenInputs gen) { - using namespace fs; + using fs::path; const auto in = gen(st.range(0)); path PP; for (auto& Part : in) @@ -21,14 +18,15 @@ void BM_PathConstructString(benchmark::State &st, GenInputs gen) { const path P(PP.native()); benchmark::DoNotOptimize(P.native().data()); } + st.SetComplexityN(st.range(0)); } BENCHMARK_CAPTURE(BM_PathConstructString, large_string, - getRandomStringInputs)->Arg(TestNumInputs); + getRandomStringInputs)->Range(8, TestNumInputs)->Complexity(); template void BM_PathConstructCStr(benchmark::State &st, GenInputs gen) { - using namespace fs; + using fs::path; const auto in = gen(st.range(0)); path PP; for (auto& Part : in) @@ -45,7 +43,7 @@ BENCHMARK_CAPTURE(BM_PathConstructCStr, large_string, template