diff options
Diffstat (limited to 'libcxx/test')
25 files changed, 429 insertions, 18 deletions
diff --git a/libcxx/test/re/re.alg/re.alg.search/ecma.pass.cpp b/libcxx/test/re/re.alg/re.alg.search/ecma.pass.cpp index 927c37afde0..44b40fcb04b 100644 --- a/libcxx/test/re/re.alg/re.alg.search/ecma.pass.cpp +++ b/libcxx/test/re/re.alg/re.alg.search/ecma.pass.cpp @@ -16,8 +16,6 @@ // const basic_regex<charT, traits>& e, // regex_constants::match_flag_type flags = regex_constants::match_default); -#include <iostream> - #include <regex> #include <cassert> diff --git a/libcxx/test/re/re.alg/re.alg.search/egrep.pass.cpp b/libcxx/test/re/re.alg/re.alg.search/egrep.pass.cpp index 1fd2be06ab9..3eaadce9a2e 100644 --- a/libcxx/test/re/re.alg/re.alg.search/egrep.pass.cpp +++ b/libcxx/test/re/re.alg/re.alg.search/egrep.pass.cpp @@ -16,8 +16,6 @@ // const basic_regex<charT, traits>& e, // regex_constants::match_flag_type flags = regex_constants::match_default); -#include <iostream> - #include <regex> #include <cassert> diff --git a/libcxx/test/re/re.alg/re.alg.search/grep.pass.cpp b/libcxx/test/re/re.alg/re.alg.search/grep.pass.cpp index cfd08fee6d1..47dca45bb4b 100644 --- a/libcxx/test/re/re.alg/re.alg.search/grep.pass.cpp +++ b/libcxx/test/re/re.alg/re.alg.search/grep.pass.cpp @@ -16,8 +16,6 @@ // const basic_regex<charT, traits>& e, // regex_constants::match_flag_type flags = regex_constants::match_default); -#include <iostream> - #include <regex> #include <cassert> diff --git a/libcxx/test/re/re.regex/re.regex.assign/assign.il.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/assign.il.pass.cpp new file mode 100644 index 00000000000..c97a6fae175 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/assign.il.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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& +// assign(initializer_list<charT> il, +// flag_type f = regex_constants::ECMAScript); + +#include <regex> +#include <cassert> + +int main() +{ +#ifdef _LIBCPP_MOVE + std::regex r2; + r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); + + r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex::extended); + assert(r2.flags() == std::regex::extended); + assert(r2.mark_count() == 2); +#endif +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/assign.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/assign.pass.cpp new file mode 100644 index 00000000000..9c3194e55d0 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/assign.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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& assign(const basic_regex& that); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r1("(a([bc]))"); + std::regex r2; + r2.assign(r1); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp new file mode 100644 index 00000000000..b3c476fd470 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// 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; + +// template <class InputIterator> +// basic_regex& +// assign(InputIterator first, InputIterator last, +// flag_type f = regex_constants::ECMAScript); + +#include <regex> +#include <cassert> + +#include "../../iterators.h" + +int main() +{ + typedef input_iterator<std::string::const_iterator> I; + typedef forward_iterator<std::string::const_iterator> F; + std::string s4("(a([bc]))"); + std::regex r2; + + r2.assign(I(s4.begin()), I(s4.end())); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); + + r2.assign(I(s4.begin()), I(s4.end()), std::regex::extended); + assert(r2.flags() == std::regex::extended); + assert(r2.mark_count() == 2); + + r2.assign(F(s4.begin()), F(s4.end())); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); + + r2.assign(F(s4.begin()), F(s4.end()), std::regex::extended); + assert(r2.flags() == std::regex::extended); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp new file mode 100644 index 00000000000..0668202dd95 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r2; + r2.assign("(a([bc]))"); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); + + r2.assign("(a([bc]))", std::regex::extended); + assert(r2.flags() == std::regex::extended); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp new file mode 100644 index 00000000000..2f49460f3b9 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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& assign(const charT* ptr, size_t len, flag_type f); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r2; + r2.assign("(a([bc]))", 9, std::regex::extended); + assert(r2.flags() == std::regex::extended); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp new file mode 100644 index 00000000000..98925e5f472 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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; + +// template <class string_traits, class A> +// basic_regex& assign(const basic_string<charT, string_traits, A>& s, +// flag_type f = regex_constants::ECMAScript); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r2; + r2.assign(std::string("(a([bc]))")); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); + + r2.assign(std::string("(a([bc]))"), std::regex::extended); + assert(r2.flags() == std::regex::extended); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/copy.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/copy.pass.cpp new file mode 100644 index 00000000000..ca865e4657e --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/copy.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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& operator=(const basic_regex& e); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r1("(a([bc]))"); + std::regex r2; + r2 = r1; + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/il.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/il.pass.cpp new file mode 100644 index 00000000000..5a9dc0c6e64 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/il.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// 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& operator=(initializer_list<charT> il); + +#include <regex> +#include <cassert> + +int main() +{ +#ifdef _LIBCPP_MOVE + std::regex r2; + r2 = {'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}; + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +#endif +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/ptr.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/ptr.pass.cpp new file mode 100644 index 00000000000..56413e4fb9c --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/ptr.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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& operator=(const charT* ptr); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r2; + r2 = "(a([bc]))"; + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.assign/string.pass.cpp b/libcxx/test/re/re.regex/re.regex.assign/string.pass.cpp new file mode 100644 index 00000000000..1e320d4aa1a --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.assign/string.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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; + +// template <class ST, class SA> +// basic_regex& operator=(const basic_string<charT, ST, SA>& p); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r2; + r2 = std::string("(a([bc]))"); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.construct/copy.pass.cpp b/libcxx/test/re/re.regex/re.regex.construct/copy.pass.cpp new file mode 100644 index 00000000000..d2fa4740665 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.construct/copy.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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(const basic_regex& e); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r1("(a([bc]))"); + std::regex r2 = r1; + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.construct/ptr.pass.cpp b/libcxx/test/re/re.regex/re.regex.construct/ptr.pass.cpp index 23b3d17568e..9e16dfce577 100644 --- a/libcxx/test/re/re.regex/re.regex.construct/ptr.pass.cpp +++ b/libcxx/test/re/re.regex/re.regex.construct/ptr.pass.cpp @@ -13,8 +13,6 @@ // basic_regex(const charT* p); -#include <iostream> - #include <regex> #include <cassert> diff --git a/libcxx/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp b/libcxx/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp index 31f9da9e4df..88d1ae25529 100644 --- a/libcxx/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp +++ b/libcxx/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp @@ -13,8 +13,6 @@ // basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); -#include <iostream> - #include <regex> #include <cassert> diff --git a/libcxx/test/re/re.regex/re.regex.construct/string_flg.pass.cpp b/libcxx/test/re/re.regex/re.regex.construct/string_flg.pass.cpp index 56ba2af7c79..0d1ecf2665f 100644 --- a/libcxx/test/re/re.regex/re.regex.construct/string_flg.pass.cpp +++ b/libcxx/test/re/re.regex/re.regex.construct/string_flg.pass.cpp @@ -15,8 +15,6 @@ // basic_regex(const basic_string<charT, ST, SA>& s, // flag_type f = regex_constants::ECMAScript); -#include <iostream> - #include <regex> #include <cassert> diff --git a/libcxx/test/re/re.regex/re.regex.locale/imbue.pass.cpp b/libcxx/test/re/re.regex/re.regex.locale/imbue.pass.cpp new file mode 100644 index 00000000000..8677c2b2752 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.locale/imbue.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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; + +// locale_type imbue(locale_type loc); + +#include <regex> +#include <locale> +#include <cassert> + +int main() +{ + std::regex r; + std::locale loc = r.imbue(std::locale("en_US")); + assert(loc.name() == "C"); + assert(r.getloc().name() == "en_US"); + loc = r.imbue(std::locale("C")); + assert(loc.name() == "en_US"); + assert(r.getloc().name() == "C"); +} diff --git a/libcxx/test/re/re.regex/re.regex.nonmemb/nothing_to_do.pass.cpp b/libcxx/test/re/re.regex/re.regex.nonmemb/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..b89f168e9c4 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.nonmemb/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// 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.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp b/libcxx/test/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp new file mode 100644 index 00000000000..5b264c78e2a --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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; + +// template <class charT, class traits> +// void swap(basic_regex<charT, traits>& lhs, basic_regex<charT, traits>& rhs); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r1("(a([bc]))"); + std::regex r2; + swap(r2, r1); + assert(r1.flags() == std::regex::ECMAScript); + assert(r1.mark_count() == 0); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.regex/re.regex.operations/tested_elsewhere.pass.cpp b/libcxx/test/re/re.regex/re.regex.operations/tested_elsewhere.pass.cpp new file mode 100644 index 00000000000..b89f168e9c4 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.operations/tested_elsewhere.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// 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.regex/re.regex.swap/swap.pass.cpp b/libcxx/test/re/re.regex/re.regex.swap/swap.pass.cpp new file mode 100644 index 00000000000..311706a7fd6 --- /dev/null +++ b/libcxx/test/re/re.regex/re.regex.swap/swap.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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; + +// void swap(basic_regex& e); + +#include <regex> +#include <cassert> + +int main() +{ + std::regex r1("(a([bc]))"); + std::regex r2; + r2.swap(r1); + assert(r1.flags() == std::regex::ECMAScript); + assert(r1.mark_count() == 0); + assert(r2.flags() == std::regex::ECMAScript); + assert(r2.mark_count() == 2); +} diff --git a/libcxx/test/re/re.traits/lookup_collatename.pass.cpp b/libcxx/test/re/re.traits/lookup_collatename.pass.cpp index e2ce3d5115d..28fb4426210 100644 --- a/libcxx/test/re/re.traits/lookup_collatename.pass.cpp +++ b/libcxx/test/re/re.traits/lookup_collatename.pass.cpp @@ -15,8 +15,6 @@ // string_type // lookup_collatename(ForwardIterator first, ForwardIterator last) const; -#include <iostream> - #include <regex> #include <iterator> #include <cassert> diff --git a/libcxx/test/re/re.traits/transform_primary.pass.cpp b/libcxx/test/re/re.traits/transform_primary.pass.cpp index d29c77857e7..06fe5e7527d 100644 --- a/libcxx/test/re/re.traits/transform_primary.pass.cpp +++ b/libcxx/test/re/re.traits/transform_primary.pass.cpp @@ -16,8 +16,6 @@ // string_type // transform_primary(ForwardIterator first, ForwardIterator last) const; -#include <iostream> - #include <regex> #include <cassert> #include "iterators.h" diff --git a/libcxx/test/re/re.traits/value.pass.cpp b/libcxx/test/re/re.traits/value.pass.cpp index 4cbf924d833..e5cdb173dc2 100644 --- a/libcxx/test/re/re.traits/value.pass.cpp +++ b/libcxx/test/re/re.traits/value.pass.cpp @@ -13,8 +13,6 @@ // int value(charT ch, int radix) const; -#include <iostream> - #include <regex> #include <cassert> |