xref: /llvm-project/libcxx/test/std/re/re.regex/re.regex.const/constants.pass.cpp (revision 2df59c50688c122bbcae7467d3eaf862c3ea3088)
15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <regex>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // template <class charT, class traits = regex_traits<charT>>
125a83710eSEric Fiselier // class basic_regex
135a83710eSEric Fiselier // {
145a83710eSEric Fiselier // public:
155a83710eSEric Fiselier //     // constants:
165a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
175a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
185a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
195a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
205a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
215a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
225a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
235a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
245a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
255a83710eSEric Fiselier //     static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
265a83710eSEric Fiselier 
275a83710eSEric Fiselier #include <regex>
285a83710eSEric Fiselier #include <type_traits>
29fd5ceb22SMarshall Clow #include "test_macros.h"
305a83710eSEric Fiselier 
31aae63566SStephan T. Lavavej template <class T>
where(const T &)32aae63566SStephan T. Lavavej void where(const T &) {}
335a83710eSEric Fiselier 
345a83710eSEric Fiselier template <class CharT>
355a83710eSEric Fiselier void
test()365a83710eSEric Fiselier test()
375a83710eSEric Fiselier {
385a83710eSEric Fiselier     typedef std::basic_regex<CharT> BR;
395a83710eSEric Fiselier     static_assert((BR::icase == std::regex_constants::icase), "");
405a83710eSEric Fiselier     static_assert((BR::nosubs == std::regex_constants::nosubs), "");
415a83710eSEric Fiselier     static_assert((BR::optimize == std::regex_constants::optimize), "");
425a83710eSEric Fiselier     static_assert((BR::collate == std::regex_constants::collate), "");
435a83710eSEric Fiselier     static_assert((BR::ECMAScript == std::regex_constants::ECMAScript), "");
445a83710eSEric Fiselier     static_assert((BR::basic == std::regex_constants::basic), "");
455a83710eSEric Fiselier     static_assert((BR::extended == std::regex_constants::extended), "");
465a83710eSEric Fiselier     static_assert((BR::awk == std::regex_constants::awk), "");
475a83710eSEric Fiselier     static_assert((BR::grep == std::regex_constants::grep), "");
485a83710eSEric Fiselier     static_assert((BR::egrep == std::regex_constants::egrep), "");
495a83710eSEric Fiselier     where(BR::icase);
505a83710eSEric Fiselier     where(BR::nosubs);
515a83710eSEric Fiselier     where(BR::optimize);
525a83710eSEric Fiselier     where(BR::collate);
535a83710eSEric Fiselier     where(BR::ECMAScript);
545a83710eSEric Fiselier     where(BR::basic);
555a83710eSEric Fiselier     where(BR::extended);
565a83710eSEric Fiselier     where(BR::awk);
575a83710eSEric Fiselier     where(BR::grep);
585a83710eSEric Fiselier     where(BR::egrep);
595a83710eSEric Fiselier }
605a83710eSEric Fiselier 
main(int,char **)61*2df59c50SJF Bastien int main(int, char**)
625a83710eSEric Fiselier {
635a83710eSEric Fiselier     test<char>();
645a83710eSEric Fiselier     test<wchar_t>();
65*2df59c50SJF Bastien 
66*2df59c50SJF Bastien   return 0;
675a83710eSEric Fiselier }
68