diff options
Diffstat (limited to 'libcxx/test/re/re.regex')
-rw-r--r-- | libcxx/test/re/re.regex/re.regex.const/constants.pass.cpp | 52 | ||||
-rw-r--r-- | libcxx/test/re/re.regex/re.regex.construct/default.pass.cpp | 32 | ||||
-rw-r--r-- | libcxx/test/re/re.regex/types.pass.cpp | 35 |
3 files changed, 119 insertions, 0 deletions
diff --git a/libcxx/test/re/re.regex/re.regex.const/constants.pass.cpp b/libcxx/test/re/re.regex/re.regex.const/constants.pass.cpp new file mode 100644 index 00000000000..634cb2ecc6e --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.const/constants.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <regex> + +// template <class charT, class traits = regex_traits<charT>> +// class basic_regex +// { +// public: +// // constants: +// static constexpr regex_constants::syntax_option_type icase = regex_constants::icase; +// static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs; +// static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize; +// static constexpr regex_constants::syntax_option_type collate = regex_constants::collate; +// static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; +// static constexpr regex_constants::syntax_option_type basic = regex_constants::basic; +// static constexpr regex_constants::syntax_option_type extended = regex_constants::extended; +// static constexpr regex_constants::syntax_option_type awk = regex_constants::awk; +// static constexpr regex_constants::syntax_option_type grep = regex_constants::grep; +// static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep; + +#include <regex> +#include <type_traits> + +template <class CharT> +void +test() +{ + typedef std::basic_regex<CharT> BR; + static_assert((BR::icase == std::regex_constants::icase), ""); + static_assert((BR::nosubs == std::regex_constants::nosubs), ""); + static_assert((BR::optimize == std::regex_constants::optimize), ""); + static_assert((BR::collate == std::regex_constants::collate), ""); + static_assert((BR::ECMAScript == std::regex_constants::ECMAScript), ""); + static_assert((BR::basic == std::regex_constants::basic), ""); + static_assert((BR::extended == std::regex_constants::extended), ""); + static_assert((BR::awk == std::regex_constants::awk), ""); + static_assert((BR::grep == std::regex_constants::grep), ""); + static_assert((BR::egrep == std::regex_constants::egrep), ""); +} + +int main() +{ + test<char>(); + test<wchar_t>(); +} diff --git a/libcxx/test/re/re.regex/re.regex.construct/default.pass.cpp b/libcxx/test/re/re.regex/re.regex.construct/default.pass.cpp new file mode 100644 index 00000000000..44930f6d737 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.construct/default.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <regex> + +// template <class charT, class traits = regex_traits<charT>> class basic_regex; + +// basic_regex(); + +#include <regex> +#include <cassert> + +template <class CharT> +void +test() +{ + std::basic_regex<CharT> r; + assert(r.flags() == 0); + assert(r.mark_count() == 0); +} + +int main() +{ + test<char>(); + test<wchar_t>(); +} diff --git a/libcxx/test/re/re.regex/types.pass.cpp b/libcxx/test/re/re.regex/types.pass.cpp new file mode 100644 index 00000000000..4d90737eddd --- /dev/null +++ b/libcxx/test/re/re.regex/types.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <regex> + +// template <class charT, class traits = regex_traits<charT>> +// class basic_regex +// { +// public: +// // types: +// typedef charT value_type; +// typedef regex_constants::syntax_option_type flag_type; +// typedef typename traits::locale_type locale_type; + +#include <regex> +#include <type_traits> + +int main() +{ + static_assert((std::is_same<std::basic_regex<char>::value_type, char>::value), ""); + static_assert((std::is_same<std::basic_regex<char>::flag_type, + std::regex_constants::syntax_option_type>::value), ""); + static_assert((std::is_same<std::basic_regex<char>::locale_type, std::locale>::value), ""); + + static_assert((std::is_same<std::basic_regex<wchar_t>::value_type, wchar_t>::value), ""); + static_assert((std::is_same<std::basic_regex<wchar_t>::flag_type, + std::regex_constants::syntax_option_type>::value), ""); + static_assert((std::is_same<std::basic_regex<wchar_t>::locale_type, std::locale>::value), ""); +} |