diff --git a/libcxx/test/std/re/re.alg/re.alg.match/awk.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/awk.locale.pass.cpp deleted file mode 100644 index 8c2875de01c52..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.match/awk.locale.pass.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool regex_match(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags -// = regex_constants::match_default); - -// TODO: investigation needed -// TODO(netbsd): incomplete support for locales -// XFAIL: target={{.*}}-linux-gnu{{.*}}, netbsd, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} -// REQUIRES: locale.cs_CZ.ISO8859-2 - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; -// AIX supports character equivalence classes. What the contents of the class are depends -// on the locale and the standards do not specify any locale other than C/POSIX. -#if defined(_AIX) - assert(std::regex_match(s, m, - std::regex("[a[=m=]z]", std::regex_constants::awk))); -#else - assert(std::regex_match(s, m, - std::regex("[a[=M=]z]", std::regex_constants::awk))); -#endif - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert((std::size_t)m.length(0) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::awk | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert((std::size_t)m.length(0) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_match(s, m, std::regex("[a[=M=]z]", - std::regex_constants::awk))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; -#if defined(_AIX) - assert(std::regex_match(s, m, std::wregex(L"[a[=m=]z]", - std::regex_constants::awk))); -#else - assert(std::regex_match(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::awk))); -#endif - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert((std::size_t)m.length(0) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } -//TODO: Need to be investigated for AIX OS -#if !defined(_AIX) - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_match(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::awk | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert((std::size_t)m.length(0) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } -#endif - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::awk))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp index 988beec15e644..024738258c050 100644 --- a/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.match/awk.pass.cpp @@ -573,6 +573,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_match(s, m, + std::regex("[a[=m=]z]", std::regex_constants::awk))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert((std::size_t)m.length(0) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_match(s, m, + std::regex("[a[=M=]z]", std::regex_constants::awk))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1215,6 +1238,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_match(s, m, std::wregex(L"[a[=m=]z]", + std::regex_constants::awk))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert((std::size_t)m.length(0) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]", + std::regex_constants::awk))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.match/basic.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/basic.locale.pass.cpp deleted file mode 100644 index 9002681547b8d..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.match/basic.locale.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_match(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_match(s, m, std::regex("[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::basic | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_match(s, m, std::regex("[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_match(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_match(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::basic | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp index 9765a07f2e4fe..fd91866b9209b 100644 --- a/libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp @@ -575,6 +575,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_match(s, m, std::regex("[a[=m=]z]", + std::regex_constants::basic))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_match(s, m, std::regex("[a[=M=]z]", + std::regex_constants::basic))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1203,6 +1226,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_match(s, m, std::wregex(L"[a[=m=]z]", + std::regex_constants::basic))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]", + std::regex_constants::basic))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.match/ecma.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/ecma.locale.pass.cpp deleted file mode 100644 index 2e6f7fd285ae4..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.match/ecma.locale.pass.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_match(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_match(s, m, std::regex("[a[=M=]z]"))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_match(s, m, std::regex("[a[=M=]z]"))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_match(s, m, std::wregex(L"[a[=M=]z]"))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_match(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]"))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp index a0699634c2bc9..799a362425ad5 100644 --- a/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp @@ -563,6 +563,27 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_match(s, m, std::regex("[a[=m=]z]"))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_match(s, m, std::regex("[a[=M=]z]"))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1226,6 +1247,27 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_match(s, m, std::wregex(L"[a[=m=]z]"))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]"))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.match/extended.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/extended.locale.pass.cpp deleted file mode 100644 index 4948f68f3934c..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.match/extended.locale.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_match(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_match(s, m, std::regex("[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::extended | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_match(s, m, std::regex("[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_match(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_match(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::extended | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.match/extended.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/extended.pass.cpp index 73c1d8352ab2b..e800fa88d8300 100644 --- a/libcxx/test/std/re/re.alg/re.alg.match/extended.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.match/extended.pass.cpp @@ -590,6 +590,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_match(s, m, std::regex("[a[=m=]z]", + std::regex_constants::extended))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_match(s, m, std::regex("[a[=M=]z]", + std::regex_constants::extended))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1234,6 +1257,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_match(s, m, std::wregex(L"[a[=m=]z]", + std::regex_constants::extended))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]", + std::regex_constants::extended))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.search/awk.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/awk.locale.pass.cpp deleted file mode 100644 index 4c883a1cf380f..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.search/awk.locale.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_search(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_search(s, m, std::regex("[a[=M=]z]", - std::regex_constants::awk))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_search(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::awk | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_search(s, m, std::regex("[a[=M=]z]", - std::regex_constants::awk))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_search(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::awk))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_search(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::awk | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::awk))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.search/awk.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/awk.pass.cpp index 2c23cf0f70079..904ba066125ec 100644 --- a/libcxx/test/std/re/re.alg/re.alg.search/awk.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.search/awk.pass.cpp @@ -645,6 +645,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_search(s, m, std::regex("[a[=m=]z]", + std::regex_constants::awk))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_search(s, m, std::regex("[a[=M=]z]", + std::regex_constants::awk))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1377,6 +1400,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_search(s, m, std::wregex(L"[a[=m=]z]", + std::regex_constants::awk))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]", + std::regex_constants::awk))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.search/basic.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/basic.locale.pass.cpp deleted file mode 100644 index 7bf28a27ea604..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.search/basic.locale.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_search(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_search(s, m, std::regex("[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_search(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::basic | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_search(s, m, std::regex("[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_search(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_search(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::basic | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::basic))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.search/basic.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/basic.pass.cpp index 99f94f26b32ae..74b4d6341e9de 100644 --- a/libcxx/test/std/re/re.alg/re.alg.search/basic.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.search/basic.pass.cpp @@ -647,6 +647,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_search(s, m, std::regex("[a[=m=]z]", + std::regex_constants::basic))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_search(s, m, std::regex("[a[=M=]z]", + std::regex_constants::basic))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1365,6 +1388,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_search(s, m, std::wregex(L"[a[=m=]z]", + std::regex_constants::basic))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]", + std::regex_constants::basic))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.search/ecma.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/ecma.locale.pass.cpp deleted file mode 100644 index 64365932bfe72..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.search/ecma.locale.pass.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_search(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_search(s, m, std::regex("[a[=M=]z]"))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_search(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_search(s, m, std::regex("[a[=M=]z]"))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_search(s, m, std::wregex(L"[a[=M=]z]"))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_search(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]"))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.search/ecma.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/ecma.pass.cpp index 518c27e424484..ee88d11385c8d 100644 --- a/libcxx/test/std/re/re.alg/re.alg.search/ecma.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.search/ecma.pass.cpp @@ -630,6 +630,27 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_search(s, m, std::regex("[a[=m=]z]"))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_search(s, m, std::regex("[a[=M=]z]"))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1371,6 +1392,27 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_search(s, m, std::wregex(L"[a[=m=]z]"))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]"))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.alg/re.alg.search/extended.locale.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/extended.locale.pass.cpp deleted file mode 100644 index 22a98c601de5a..0000000000000 --- a/libcxx/test/std/re/re.alg/re.alg.search/extended.locale.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 - -// - -// template -// bool -// regex_search(BidirectionalIterator first, BidirectionalIterator last, -// match_results& m, -// const basic_regex& e, -// regex_constants::match_flag_type flags = regex_constants::match_default); - -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}}, freebsd -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - -#include -#include -#include "test_macros.h" -#include "test_iterators.h" - -#include "platform_support.h" // locale name macros - -int main(int, char**) -{ - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::cmatch m; - const char s[] = "m"; - assert(std::regex_search(s, m, std::regex("[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::cmatch m; - const char s[] = "Ch"; - assert(std::regex_search(s, m, std::regex("[a[.ch.]z]", - std::regex_constants::extended | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::cmatch m; - const char s[] = "m"; - assert(!std::regex_search(s, m, std::regex("[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 0); - } - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(std::regex_search(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - { - std::wcmatch m; - const wchar_t s[] = L"Ch"; - assert(std::regex_search(s, m, std::wregex(L"[a[.ch.]z]", - std::regex_constants::extended | std::regex_constants::icase))); - assert(m.size() == 1); - assert(!m.prefix().matched); - assert(m.prefix().first == s); - assert(m.prefix().second == m[0].first); - assert(!m.suffix().matched); - assert(m.suffix().first == m[0].second); - assert(m.suffix().second == m[0].second); - assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); - assert(m.position(0) == 0); - assert(m.str(0) == s); - } - std::locale::global(std::locale("C")); - { - std::wcmatch m; - const wchar_t s[] = L"m"; - assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]", - std::regex_constants::extended))); - assert(m.size() == 0); - } -#endif // TEST_HAS_NO_WIDE_CHARACTERS - - return 0; -} diff --git a/libcxx/test/std/re/re.alg/re.alg.search/extended.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.search/extended.pass.cpp index 0ddb49d619a18..73c37267efe86 100644 --- a/libcxx/test/std/re/re.alg/re.alg.search/extended.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.search/extended.pass.cpp @@ -663,6 +663,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::cmatch m; + const char s[] = "m"; + assert(std::regex_search(s, m, std::regex("[a[=m=]z]", + std::regex_constants::extended))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::cmatch m; + const char s[] = "m"; + assert(!std::regex_search(s, m, std::regex("[a[=M=]z]", + std::regex_constants::extended))); + assert(m.size() == 0); + } { std::cmatch m; const char s[] = "-"; @@ -1397,6 +1420,29 @@ int main(int, char**) assert(m.position(0) == 0); assert(m.str(0) == s); } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(std::regex_search(s, m, std::wregex(L"[a[=m=]z]", + std::regex_constants::extended))); + assert(m.size() == 1); + assert(!m.prefix().matched); + assert(m.prefix().first == s); + assert(m.prefix().second == m[0].first); + assert(!m.suffix().matched); + assert(m.suffix().first == m[0].second); + assert(m.suffix().second == m[0].second); + assert(m.length(0) >= 0 && static_cast(m.length(0)) == std::char_traits::length(s)); + assert(m.position(0) == 0); + assert(m.str(0) == s); + } + { + std::wcmatch m; + const wchar_t s[] = L"m"; + assert(!std::regex_search(s, m, std::wregex(L"[a[=M=]z]", + std::regex_constants::extended))); + assert(m.size() == 0); + } { std::wcmatch m; const wchar_t s[] = L"-"; diff --git a/libcxx/test/std/re/re.traits/lookup_collatename.pass.cpp b/libcxx/test/std/re/re.traits/lookup_collatename.pass.cpp index 50434832ddfff..5c690d5cfa480 100644 --- a/libcxx/test/std/re/re.traits/lookup_collatename.pass.cpp +++ b/libcxx/test/std/re/re.traits/lookup_collatename.pass.cpp @@ -5,14 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// -// NetBSD does not support LC_COLLATE at the moment -// XFAIL: netbsd - -// XFAIL: LIBCXX-AIX-FIXME -// XFAIL: LIBCXX-FREEBSD-FIXME - -// REQUIRES: locale.cs_CZ.ISO8859-2 // @@ -22,18 +14,12 @@ // string_type // lookup_collatename(ForwardIterator first, ForwardIterator last) const; -// TODO: investigation needed -// XFAIL: target={{.*}}-linux-gnu{{.*}} -// XFAIL: target={{.*}}-amazon-linux{{.*}} -// XFAIL: target={{.*}}-apple-{{.*}} - #include #include #include #include "test_macros.h" #include "test_iterators.h" -#include "platform_support.h" // locale name macros template void @@ -118,9 +104,6 @@ int main(int, char**) test("tild", std::string("")); test("ch", std::string("")); - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - test("ch", std::string("ch")); - std::locale::global(std::locale("C")); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test(L"NUL", std::wstring(L"\x00", 1)); @@ -195,9 +178,6 @@ int main(int, char**) test(L"tild", std::wstring(L"")); test(L"ch", std::wstring(L"")); - std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - test(L"ch", std::wstring(L"ch")); - std::locale::global(std::locale("C")); #endif // TEST_HAS_NO_WIDE_CHARACTERS return 0;