summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-06-17 00:34:59 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-06-17 00:34:59 +0000
commit70505305c1e191ad0cd64f3e6ee43000b867bbed (patch)
treed0beb267458cc668d927d655d65324e848a3e60f /libcxx/test
parenta68c1a2188e33cc8fef711a1d3456bf9d9ebb57a (diff)
downloadbcm5719-llvm-70505305c1e191ad0cd64f3e6ee43000b867bbed.tar.gz
bcm5719-llvm-70505305c1e191ad0cd64f3e6ee43000b867bbed.zip
Just getting our toes wet on <regex>
llvm-svn: 106187
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/re/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.badexp/regex_error.pass.cpp91
-rw-r--r--libcxx/test/re/re.const/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.const/re.err/error_type.pass.cpp143
-rw-r--r--libcxx/test/re/re.const/re.matchflag/match_flag_type.pass.cpp128
-rw-r--r--libcxx/test/re/re.const/re.synopt/syntax_option_type.pass.cpp114
-rw-r--r--libcxx/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.def/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.general/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.req/nothing_to_do.pass.cpp13
-rw-r--r--libcxx/test/re/re.traits/default.pass.cpp23
-rw-r--r--libcxx/test/re/re.traits/getloc.pass.cpp21
-rw-r--r--libcxx/test/re/re.traits/imbue.pass.cpp21
-rw-r--r--libcxx/test/re/re.traits/isctype.pass.cpp21
-rw-r--r--libcxx/test/re/re.traits/iterators.h251
-rw-r--r--libcxx/test/re/re.traits/length.pass.cpp31
-rw-r--r--libcxx/test/re/re.traits/lookup_classname.pass.cpp24
-rw-r--r--libcxx/test/re/re.traits/lookup_collatename.pass.cpp187
-rw-r--r--libcxx/test/re/re.traits/transform.pass.cpp42
-rw-r--r--libcxx/test/re/re.traits/transform_primary.pass.cpp49
-rw-r--r--libcxx/test/re/re.traits/translate.pass.cpp34
-rw-r--r--libcxx/test/re/re.traits/translate_nocase.pass.cpp62
-rw-r--r--libcxx/test/re/re.traits/types.pass.cpp32
-rw-r--r--libcxx/test/re/re.traits/value.pass.cpp21
30 files changed, 1451 insertions, 0 deletions
diff --git a/libcxx/test/re/nothing_to_do.pass.cpp b/libcxx/test/re/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.badexp/regex_error.pass.cpp b/libcxx/test/re/re.badexp/regex_error.pass.cpp
new file mode 100644
index 00000000000..6145b8eae65
--- /dev/null
+++ b/libcxx/test/re/re.badexp/regex_error.pass.cpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// class regex_error
+// : public runtime_error
+// {
+// public:
+// explicit regex_error(regex_constants::error_type ecode);
+// regex_constants::error_type code() const;
+// };
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_error e(std::regex_constants::error_collate);
+ assert(e.code() == std::regex_constants::error_collate);
+ assert(e.what() == std::string("error_collate"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_ctype);
+ assert(e.code() == std::regex_constants::error_ctype);
+ assert(e.what() == std::string("error_ctype"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_escape);
+ assert(e.code() == std::regex_constants::error_escape);
+ assert(e.what() == std::string("error_escape"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_backref);
+ assert(e.code() == std::regex_constants::error_backref);
+ assert(e.what() == std::string("error_backref"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_brack);
+ assert(e.code() == std::regex_constants::error_brack);
+ assert(e.what() == std::string("error_brack"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_paren);
+ assert(e.code() == std::regex_constants::error_paren);
+ assert(e.what() == std::string("error_paren"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_brace);
+ assert(e.code() == std::regex_constants::error_brace);
+ assert(e.what() == std::string("error_brace"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_badbrace);
+ assert(e.code() == std::regex_constants::error_badbrace);
+ assert(e.what() == std::string("error_badbrace"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_range);
+ assert(e.code() == std::regex_constants::error_range);
+ assert(e.what() == std::string("error_range"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_space);
+ assert(e.code() == std::regex_constants::error_space);
+ assert(e.what() == std::string("error_space"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_badrepeat);
+ assert(e.code() == std::regex_constants::error_badrepeat);
+ assert(e.what() == std::string("error_badrepeat"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_complexity);
+ assert(e.code() == std::regex_constants::error_complexity);
+ assert(e.what() == std::string("error_complexity"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_stack);
+ assert(e.code() == std::regex_constants::error_stack);
+ assert(e.what() == std::string("error_stack"));
+ }
+}
diff --git a/libcxx/test/re/re.const/nothing_to_do.pass.cpp b/libcxx/test/re/re.const/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.const/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.const/re.err/error_type.pass.cpp b/libcxx/test/re/re.const/re.err/error_type.pass.cpp
new file mode 100644
index 00000000000..aab6d62cfcb
--- /dev/null
+++ b/libcxx/test/re/re.const/re.err/error_type.pass.cpp
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// namespace regex_constants
+// {
+//
+// enum error_type
+// {
+// error_collate = unspecified,
+// error_ctype = unspecified,
+// error_escape = unspecified,
+// error_backref = unspecified,
+// error_brack = unspecified,
+// error_paren = unspecified,
+// error_brace = unspecified,
+// error_badbrace = unspecified,
+// error_range = unspecified,
+// error_space = unspecified,
+// error_badrepeat = unspecified,
+// error_complexity = unspecified,
+// error_stack = unspecified
+// };
+//
+// }
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_constants::error_collate != 0);
+ assert(std::regex_constants::error_ctype != 0);
+ assert(std::regex_constants::error_escape != 0);
+ assert(std::regex_constants::error_backref != 0);
+ assert(std::regex_constants::error_brack != 0);
+ assert(std::regex_constants::error_paren != 0);
+ assert(std::regex_constants::error_brace != 0);
+ assert(std::regex_constants::error_badbrace != 0);
+ assert(std::regex_constants::error_range != 0);
+ assert(std::regex_constants::error_space != 0);
+ assert(std::regex_constants::error_badrepeat != 0);
+ assert(std::regex_constants::error_complexity != 0);
+ assert(std::regex_constants::error_stack != 0);
+
+ assert(std::regex_constants::error_collate != std::regex_constants::error_ctype);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_escape);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_backref);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_range);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_space);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_escape);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_backref);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_range);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_space);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_escape != std::regex_constants::error_backref);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_range);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_space);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_backref != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_range);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_space);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_brack != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_range);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_space);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_paren != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_range);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_space);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_brace != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_range);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_space);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_range);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_space);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_range != std::regex_constants::error_space);
+ assert(std::regex_constants::error_range != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_range != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_range != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_space != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_space != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_space != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_badrepeat != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_badrepeat != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_complexity != std::regex_constants::error_stack);
+}
diff --git a/libcxx/test/re/re.const/re.matchflag/match_flag_type.pass.cpp b/libcxx/test/re/re.const/re.matchflag/match_flag_type.pass.cpp
new file mode 100644
index 00000000000..cf9a7f49cd6
--- /dev/null
+++ b/libcxx/test/re/re.const/re.matchflag/match_flag_type.pass.cpp
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// namespace regex_constants
+// {
+//
+// emum match_flag_type // bitmask type
+// {
+// match_default = 0,
+// match_not_bol = unspecified,
+// match_not_eol = unspecified,
+// match_not_bow = unspecified,
+// match_not_eow = unspecified,
+// match_any = unspecified,
+// match_not_null = unspecified,
+// match_continuous = unspecified,
+// match_prev_avail = unspecified,
+// format_default = 0,
+// format_sed = unspecified,
+// format_no_copy = unspecified,
+// format_first_only = unspecified
+// };
+//
+// }
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_constants::match_default == 0);
+ assert(std::regex_constants::match_not_bol != 0);
+ assert(std::regex_constants::match_not_eol != 0);
+ assert(std::regex_constants::match_not_bow != 0);
+ assert(std::regex_constants::match_not_eow != 0);
+ assert(std::regex_constants::match_any != 0);
+ assert(std::regex_constants::match_not_null != 0);
+ assert(std::regex_constants::match_continuous != 0);
+ assert(std::regex_constants::match_prev_avail != 0);
+ assert(std::regex_constants::format_default == 0);
+ assert(std::regex_constants::format_sed != 0);
+ assert(std::regex_constants::format_no_copy != 0);
+ assert(std::regex_constants::format_first_only != 0);
+
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_eol) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_bow) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_eow) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_bow) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_eow) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_not_eow) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_any & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_null & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_continuous & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_continuous & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_continuous & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_continuous & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_prev_avail & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_prev_avail & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_prev_avail & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::format_sed & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::format_sed & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::format_no_copy & std::regex_constants::format_first_only) == 0);
+
+ std::regex_constants::match_flag_type e1 = std::regex_constants::match_not_bol;
+ std::regex_constants::match_flag_type e2 = std::regex_constants::match_not_eol;
+ e1 = ~e1;
+ e1 = e1 & e2;
+ e1 = e1 | e2;
+ e1 = e1 ^ e2;
+ e1 &= e2;
+ e1 |= e2;
+ e1 ^= e2;
+}
diff --git a/libcxx/test/re/re.const/re.synopt/syntax_option_type.pass.cpp b/libcxx/test/re/re.const/re.synopt/syntax_option_type.pass.cpp
new file mode 100644
index 00000000000..5d82ed8254b
--- /dev/null
+++ b/libcxx/test/re/re.const/re.synopt/syntax_option_type.pass.cpp
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// namespace regex_constants
+// {
+//
+// emum syntax_option_type // bitmask type
+// {
+// icase = unspecified,
+// nosubs = unspecified,
+// optimize = unspecified,
+// collate = unspecified,
+// ECMAScript = unspecified,
+// basic = unspecified,
+// extended = unspecified,
+// awk = unspecified,
+// grep = unspecified,
+// egrep = unspecified
+// };
+//
+// }
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_constants::icase != 0);
+ assert(std::regex_constants::nosubs != 0);
+ assert(std::regex_constants::optimize != 0);
+ assert(std::regex_constants::collate != 0);
+ assert(std::regex_constants::ECMAScript != 0);
+ assert(std::regex_constants::basic != 0);
+ assert(std::regex_constants::extended != 0);
+ assert(std::regex_constants::awk != 0);
+ assert(std::regex_constants::grep != 0);
+ assert(std::regex_constants::egrep != 0);
+
+ assert((std::regex_constants::icase & std::regex_constants::nosubs) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::optimize) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::collate) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::nosubs & std::regex_constants::optimize) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::collate) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::optimize & std::regex_constants::collate) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::collate & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::ECMAScript & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::basic & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::basic & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::basic & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::basic & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::extended & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::extended & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::extended & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::awk & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::awk & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::grep & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::icase | std::regex_constants::nosubs) != 0);
+ assert((std::regex_constants::icase ^ std::regex_constants::nosubs) != 0);
+
+ std::regex_constants::syntax_option_type e1 = std::regex_constants::icase;
+ std::regex_constants::syntax_option_type e2 = std::regex_constants::nosubs;
+ e1 = ~e1;
+ e1 = e1 & e2;
+ e1 = e1 | e2;
+ e1 = e1 ^ e2;
+ e1 &= e2;
+ e1 |= e2;
+ e1 ^= e2;
+}
diff --git a/libcxx/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.def/nothing_to_do.pass.cpp b/libcxx/test/re/re.def/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.def/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.general/nothing_to_do.pass.cpp b/libcxx/test/re/re.general/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.general/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.req/nothing_to_do.pass.cpp b/libcxx/test/re/re.req/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b85601fc46f
--- /dev/null
+++ b/libcxx/test/re/re.req/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/re/re.traits/default.pass.cpp b/libcxx/test/re/re.traits/default.pass.cpp
new file mode 100644
index 00000000000..ebc3d80e390
--- /dev/null
+++ b/libcxx/test/re/re.traits/default.pass.cpp
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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> struct regex_traits;
+
+// regex_traits();
+
+#include <regex>
+
+int main()
+{
+ std::regex_traits<char> t1();
+ std::regex_traits<wchar_t> t2();
+}
diff --git a/libcxx/test/re/re.traits/getloc.pass.cpp b/libcxx/test/re/re.traits/getloc.pass.cpp
new file mode 100644
index 00000000000..b5d1b7015c7
--- /dev/null
+++ b/libcxx/test/re/re.traits/getloc.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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> struct regex_traits;
+
+// locale_type getloc()const;
+
+#include <regex>
+
+int main()
+{
+#error getloc not implemented
+}
diff --git a/libcxx/test/re/re.traits/imbue.pass.cpp b/libcxx/test/re/re.traits/imbue.pass.cpp
new file mode 100644
index 00000000000..687ff64bfd0
--- /dev/null
+++ b/libcxx/test/re/re.traits/imbue.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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> struct regex_traits;
+
+// locale_type imbue(locale_type l);
+
+#include <regex>
+
+int main()
+{
+#error imbue not implemented
+}
diff --git a/libcxx/test/re/re.traits/isctype.pass.cpp b/libcxx/test/re/re.traits/isctype.pass.cpp
new file mode 100644
index 00000000000..7cb141e2b5a
--- /dev/null
+++ b/libcxx/test/re/re.traits/isctype.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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> struct regex_traits;
+
+// bool isctype(charT c, char_class_type f) const;
+
+#include <regex>
+
+int main()
+{
+#error isctype not implemented
+}
diff --git a/libcxx/test/re/re.traits/iterators.h b/libcxx/test/re/re.traits/iterators.h
new file mode 100644
index 00000000000..85332ac725d
--- /dev/null
+++ b/libcxx/test/re/re.traits/iterators.h
@@ -0,0 +1,251 @@
+#ifndef ITERATORS_H
+#define ITERATORS_H
+
+#include <iterator>
+
+template <class It>
+class input_iterator
+{
+ It it_;
+
+ template <class U> friend class input_iterator;
+public:
+ typedef std::input_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ input_iterator() : it_() {}
+ explicit input_iterator(It it) : it_(it) {}
+ template <class U>
+ input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ input_iterator& operator++() {++it_; return *this;}
+ input_iterator operator++(int)
+ {input_iterator tmp(*this); ++(*this); return tmp;}
+
+ friend bool operator==(const input_iterator& x, const input_iterator& y)
+ {return x.it_ == y.it_;}
+ friend bool operator!=(const input_iterator& x, const input_iterator& y)
+ {return !(x == y);}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const input_iterator<T>& x, const input_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const input_iterator<T>& x, const input_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class It>
+class forward_iterator
+{
+ It it_;
+
+ template <class U> friend class forward_iterator;
+public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ forward_iterator() : it_() {}
+ explicit forward_iterator(It it) : it_(it) {}
+ template <class U>
+ forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ forward_iterator& operator++() {++it_; return *this;}
+ forward_iterator operator++(int)
+ {forward_iterator tmp(*this); ++(*this); return tmp;}
+
+ friend bool operator==(const forward_iterator& x, const forward_iterator& y)
+ {return x.it_ == y.it_;}
+ friend bool operator!=(const forward_iterator& x, const forward_iterator& y)
+ {return !(x == y);}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const forward_iterator<T>& x, const forward_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const forward_iterator<T>& x, const forward_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class It>
+class bidirectional_iterator
+{
+ It it_;
+
+ template <class U> friend class bidirectional_iterator;
+public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ bidirectional_iterator() : it_() {}
+ explicit bidirectional_iterator(It it) : it_(it) {}
+ template <class U>
+ bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ bidirectional_iterator& operator++() {++it_; return *this;}
+ bidirectional_iterator operator++(int)
+ {bidirectional_iterator tmp(*this); ++(*this); return tmp;}
+
+ bidirectional_iterator& operator--() {--it_; return *this;}
+ bidirectional_iterator operator--(int)
+ {bidirectional_iterator tmp(*this); --(*this); return tmp;}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class It>
+class random_access_iterator
+{
+ It it_;
+
+ template <class U> friend class random_access_iterator;
+public:
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ random_access_iterator() : it_() {}
+ explicit random_access_iterator(It it) : it_(it) {}
+ template <class U>
+ random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ random_access_iterator& operator++() {++it_; return *this;}
+ random_access_iterator operator++(int)
+ {random_access_iterator tmp(*this); ++(*this); return tmp;}
+
+ random_access_iterator& operator--() {--it_; return *this;}
+ random_access_iterator operator--(int)
+ {random_access_iterator tmp(*this); --(*this); return tmp;}
+
+ random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;}
+ random_access_iterator operator+(difference_type n) const
+ {random_access_iterator tmp(*this); tmp += n; return tmp;}
+ friend random_access_iterator operator+(difference_type n, random_access_iterator x)
+ {x += n; return x;}
+ random_access_iterator& operator-=(difference_type n) {return *this += -n;}
+ random_access_iterator operator-(difference_type n) const
+ {random_access_iterator tmp(*this); tmp -= n; return tmp;}
+
+ reference operator[](difference_type n) const {return it_[n];}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class T, class U>
+inline
+bool
+operator<(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return x.base() < y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator<=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return !(y < x);
+}
+
+template <class T, class U>
+inline
+bool
+operator>(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return y < x;
+}
+
+template <class T, class U>
+inline
+bool
+operator>=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return !(x < y);
+}
+
+template <class T, class U>
+inline
+typename std::iterator_traits<T>::difference_type
+operator-(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return x.base() - y.base();
+}
+
+#endif
diff --git a/libcxx/test/re/re.traits/length.pass.cpp b/libcxx/test/re/re.traits/length.pass.cpp
new file mode 100644
index 00000000000..7a30708cef0
--- /dev/null
+++ b/libcxx/test/re/re.traits/length.pass.cpp
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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> struct regex_traits;
+
+// static std::size_t length(const char_type* p);
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_traits<char>::length("") == 0);
+ assert(std::regex_traits<char>::length("1") == 1);
+ assert(std::regex_traits<char>::length("12") == 2);
+ assert(std::regex_traits<char>::length("123") == 3);
+
+ assert(std::regex_traits<wchar_t>::length(L"") == 0);
+ assert(std::regex_traits<wchar_t>::length(L"1") == 1);
+ assert(std::regex_traits<wchar_t>::length(L"12") == 2);
+ assert(std::regex_traits<wchar_t>::length(L"123") == 3);
+}
diff --git a/libcxx/test/re/re.traits/lookup_classname.pass.cpp b/libcxx/test/re/re.traits/lookup_classname.pass.cpp
new file mode 100644
index 00000000000..80df4ce0434
--- /dev/null
+++ b/libcxx/test/re/re.traits/lookup_classname.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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> struct regex_traits;
+
+// template <class ForwardIterator>
+// char_class_type
+// lookup_classname(ForwardIterator first, ForwardIterator last,
+// bool icase = false) const;
+
+#include <regex>
+
+int main()
+{
+#error lookup_classname not implemented
+}
diff --git a/libcxx/test/re/re.traits/lookup_collatename.pass.cpp b/libcxx/test/re/re.traits/lookup_collatename.pass.cpp
new file mode 100644
index 00000000000..e2ce3d5115d
--- /dev/null
+++ b/libcxx/test/re/re.traits/lookup_collatename.pass.cpp
@@ -0,0 +1,187 @@
+//===----------------------------------------------------------------------===//
+//
+// 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> struct regex_traits;
+
+// template <class ForwardIterator>
+// string_type
+// lookup_collatename(ForwardIterator first, ForwardIterator last) const;
+
+#include <iostream>
+
+#include <regex>
+#include <iterator>
+#include <cassert>
+#include "iterators.h"
+
+template <class char_type>
+void
+test(const char_type* A, const char_type* expected)
+{
+ std::regex_traits<char_type> t;
+ typedef forward_iterator<const char_type*> F;
+ assert(t.lookup_collatename(F(A), F(A + t.length(A))) == expected);
+}
+
+int main()
+{
+ test("NUL", "\x00");
+ test("alert", "\x07");
+ test("backspace", "\x08");
+ test("tab", "\x09");
+ test("carriage-return", "\x0D");
+ test("newline", "\x0A");
+ test("vertical-tab", "\x0B");
+ test("form-feed", "\x0C");
+ test("space", " ");
+ test("exclamation-mark", "!");
+ test("quotation-mark", "\"");
+ test("number-sign", "#");
+ test("dollar-sign", "$");
+ test("percent-sign", "%");
+ test("ampersand", "&");
+ test("apostrophe", "\'");
+ test("left-parenthesis", "(");
+ test("right-parenthesis", ")");
+ test("asterisk", "*");
+ test("plus-sign", "+");
+ test("comma", ",");
+ test("hyphen-minus", "-");
+ test("hyphen", "-");
+ test("full-stop", ".");
+ test("period", ".");
+ test("slash", "/");
+ test("solidus", "/");
+ test("zero", "0");
+ test("one", "1");
+ test("two", "2");
+ test("three", "3");
+ test("four", "4");
+ test("five", "5");
+ test("six", "6");
+ test("seven", "7");
+ test("eight", "8");
+ test("nine", "9");
+ test("colon", ":");
+ test("semicolon", ";");
+ test("less-than-sign", "<");
+ test("equals-sign", "=");
+ test("greater-than-sign", ">");
+ test("question-mark", "?");
+ test("commercial-at", "@");
+ for (char c = 'A'; c <= 'Z'; ++c)
+ {
+ const char a[2] = {c};
+ test(a, a);
+ }
+ test("left-square-bracket", "[");
+ test("backslash", "\\");
+ test("reverse-solidus", "\\");
+ test("right-square-bracket", "]");
+ test("circumflex-accent", "^");
+ test("circumflex", "^");
+ test("low-line", "_");
+ test("underscore", "_");
+ test("grave-accent", "`");
+ for (char c = 'a'; c <= 'z'; ++c)
+ {
+ const char a[2] = {c};
+ test(a, a);
+ }
+ test("left-brace", "{");
+ test("left-curly-bracket", "{");
+ test("vertical-line", "|");
+ test("right-brace", "}");
+ test("right-curly-bracket", "}");
+ test("tilde", "~");
+
+ test("tild", "");
+ test("ch", "");
+ std::locale::global(std::locale("cs_CZ.ISO8859-2"));
+ test("ch", "ch");
+ std::locale::global(std::locale("C"));
+
+ test(L"NUL", L"\x00");
+ test(L"alert", L"\x07");
+ test(L"backspace", L"\x08");
+ test(L"tab", L"\x09");
+ test(L"carriage-return", L"\x0D");
+ test(L"newline", L"\x0A");
+ test(L"vertical-tab", L"\x0B");
+ test(L"form-feed", L"\x0C");
+ test(L"space", L" ");
+ test(L"exclamation-mark", L"!");
+ test(L"quotation-mark", L"\"");
+ test(L"number-sign", L"#");
+ test(L"dollar-sign", L"$");
+ test(L"percent-sign", L"%");
+ test(L"ampersand", L"&");
+ test(L"apostrophe", L"\'");
+ test(L"left-parenthesis", L"(");
+ test(L"right-parenthesis", L")");
+ test(L"asterisk", L"*");
+ test(L"plus-sign", L"+");
+ test(L"comma", L",");
+ test(L"hyphen-minus", L"-");
+ test(L"hyphen", L"-");
+ test(L"full-stop", L".");
+ test(L"period", L".");
+ test(L"slash", L"/");
+ test(L"solidus", L"/");
+ test(L"zero", L"0");
+ test(L"one", L"1");
+ test(L"two", L"2");
+ test(L"three", L"3");
+ test(L"four", L"4");
+ test(L"five", L"5");
+ test(L"six", L"6");
+ test(L"seven", L"7");
+ test(L"eight", L"8");
+ test(L"nine", L"9");
+ test(L"colon", L":");
+ test(L"semicolon", L";");
+ test(L"less-than-sign", L"<");
+ test(L"equals-sign", L"=");
+ test(L"greater-than-sign", L">");
+ test(L"question-mark", L"?");
+ test(L"commercial-at", L"@");
+ for (wchar_t c = L'A'; c <= L'Z'; ++c)
+ {
+ const wchar_t a[2] = {c};
+ test(a, a);
+ }
+ test(L"left-square-bracket", L"[");
+ test(L"backslash", L"\\");
+ test(L"reverse-solidus", L"\\");
+ test(L"right-square-bracket", L"]");
+ test(L"circumflex-accent", L"^");
+ test(L"circumflex", L"^");
+ test(L"low-line", L"_");
+ test(L"underscore", L"_");
+ test(L"grave-accent", L"`");
+ for (wchar_t c = L'a'; c <= L'z'; ++c)
+ {
+ const wchar_t a[2] = {c};
+ test(a, a);
+ }
+ test(L"left-brace", L"{");
+ test(L"left-curly-bracket", L"{");
+ test(L"vertical-line", L"|");
+ test(L"right-brace", L"}");
+ test(L"right-curly-bracket", L"}");
+ test(L"tilde", L"~");
+
+ test(L"tild", L"");
+ test(L"ch", L"");
+ std::locale::global(std::locale("cs_CZ.ISO8859-2"));
+ test(L"ch", L"ch");
+ std::locale::global(std::locale("C"));
+}
diff --git a/libcxx/test/re/re.traits/transform.pass.cpp b/libcxx/test/re/re.traits/transform.pass.cpp
new file mode 100644
index 00000000000..25281129158
--- /dev/null
+++ b/libcxx/test/re/re.traits/transform.pass.cpp
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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> struct regex_traits;
+
+// template <class ForwardIterator>
+// string_type transform(ForwardIterator first, ForwardIterator last) const;
+
+#include <regex>
+#include <cassert>
+#include "iterators.h"
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ const char a[] = "a";
+ const char B[] = "B";
+ typedef forward_iterator<const char*> F;
+ assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ const wchar_t a[] = L"a";
+ const wchar_t B[] = L"B";
+ typedef forward_iterator<const wchar_t*> F;
+ assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
+ }
+}
diff --git a/libcxx/test/re/re.traits/transform_primary.pass.cpp b/libcxx/test/re/re.traits/transform_primary.pass.cpp
new file mode 100644
index 00000000000..d29c77857e7
--- /dev/null
+++ b/libcxx/test/re/re.traits/transform_primary.pass.cpp
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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> struct regex_traits;
+
+// template <class ForwardIterator>
+// string_type
+// transform_primary(ForwardIterator first, ForwardIterator last) const;
+
+#include <iostream>
+
+#include <regex>
+#include <cassert>
+#include "iterators.h"
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ const char A[] = "A";
+ const char Aacute[] = "\xC1";
+ typedef forward_iterator<const char*> F;
+ assert(t.transform_primary(F(A), F(A+1)) !=
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform_primary(F(A), F(A+1)) ==
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ const wchar_t A[] = L"A";
+ const wchar_t Aacute[] = L"\xC1";
+ typedef forward_iterator<const wchar_t*> F;
+ assert(t.transform_primary(F(A), F(A+1)) !=
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform_primary(F(A), F(A+1)) ==
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ }
+}
diff --git a/libcxx/test/re/re.traits/translate.pass.cpp b/libcxx/test/re/re.traits/translate.pass.cpp
new file mode 100644
index 00000000000..c584e1a777d
--- /dev/null
+++ b/libcxx/test/re/re.traits/translate.pass.cpp
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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> struct regex_traits;
+
+// charT translate(charT c) const;
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ assert(t.translate('a') == 'a');
+ assert(t.translate('B') == 'B');
+ assert(t.translate('c') == 'c');
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ assert(t.translate(L'a') == L'a');
+ assert(t.translate(L'B') == L'B');
+ assert(t.translate(L'c') == L'c');
+ }
+}
diff --git a/libcxx/test/re/re.traits/translate_nocase.pass.cpp b/libcxx/test/re/re.traits/translate_nocase.pass.cpp
new file mode 100644
index 00000000000..cc0079f64d7
--- /dev/null
+++ b/libcxx/test/re/re.traits/translate_nocase.pass.cpp
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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> struct regex_traits;
+
+// charT translate_nocase(charT c) const;
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ assert(t.translate_nocase(' ') == ' ');
+ assert(t.translate_nocase('A') == 'a');
+ assert(t.translate_nocase('\x07') == '\x07');
+ assert(t.translate_nocase('.') == '.');
+ assert(t.translate_nocase('a') == 'a');
+ assert(t.translate_nocase('1') == '1');
+ assert(t.translate_nocase('\xDA') == '\xDA');
+ assert(t.translate_nocase('\xFA') == '\xFA');
+ t.imbue(std::locale("en_US"));
+ assert(t.translate_nocase(' ') == ' ');
+ assert(t.translate_nocase('A') == 'a');
+ assert(t.translate_nocase('\x07') == '\x07');
+ assert(t.translate_nocase('.') == '.');
+ assert(t.translate_nocase('a') == 'a');
+ assert(t.translate_nocase('1') == '1');
+ assert(t.translate_nocase('\xDA') == '\xDA');
+ assert(t.translate_nocase('\xFA') == '\xFA');
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ assert(t.translate_nocase(L' ') == L' ');
+ assert(t.translate_nocase(L'A') == L'a');
+ assert(t.translate_nocase(L'\x07') == L'\x07');
+ assert(t.translate_nocase(L'.') == L'.');
+ assert(t.translate_nocase(L'a') == L'a');
+ assert(t.translate_nocase(L'1') == L'1');
+ assert(t.translate_nocase(L'\xDA') == L'\xDA');
+ assert(t.translate_nocase(L'\xFA') == L'\xFA');
+ t.imbue(std::locale("en_US"));
+ assert(t.translate_nocase(L' ') == L' ');
+ assert(t.translate_nocase(L'A') == L'a');
+ assert(t.translate_nocase(L'\x07') == L'\x07');
+ assert(t.translate_nocase(L'.') == L'.');
+ assert(t.translate_nocase(L'a') == L'a');
+ assert(t.translate_nocase(L'1') == L'1');
+ assert(t.translate_nocase(L'\xDA') == L'\xFA');
+ assert(t.translate_nocase(L'\xFA') == L'\xFA');
+ }
+}
diff --git a/libcxx/test/re/re.traits/types.pass.cpp b/libcxx/test/re/re.traits/types.pass.cpp
new file mode 100644
index 00000000000..c3972cd54d2
--- /dev/null
+++ b/libcxx/test/re/re.traits/types.pass.cpp
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// 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>
+// struct regex_traits
+// {
+// public:
+// typedef charT char_type;
+// typedef basic_string<char_type> string_type;
+// typedef locale locale_type;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::regex_traits<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::regex_traits<char>::string_type, std::string>::value), "");
+ static_assert((std::is_same<std::regex_traits<char>::locale_type, std::locale>::value), "");
+ static_assert((std::is_same<std::regex_traits<wchar_t>::char_type, wchar_t>::value), "");
+ static_assert((std::is_same<std::regex_traits<wchar_t>::string_type, std::wstring>::value), "");
+ static_assert((std::is_same<std::regex_traits<wchar_t>::locale_type, std::locale>::value), "");
+}
diff --git a/libcxx/test/re/re.traits/value.pass.cpp b/libcxx/test/re/re.traits/value.pass.cpp
new file mode 100644
index 00000000000..c2e8b0d6790
--- /dev/null
+++ b/libcxx/test/re/re.traits/value.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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> struct regex_traits;
+
+// int value(charT ch, int radix) const;
+
+#include <regex>
+
+int main()
+{
+#error value not implemented
+}
OpenPOWER on IntegriCloud