From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../re.regiter/re.regiter.cnstr/cnstr.fail.cpp | 38 +++++++++ .../re.regiter/re.regiter.cnstr/cnstr.pass.cpp | 44 ++++++++++ .../re.regiter/re.regiter.cnstr/default.pass.cpp | 32 +++++++ .../re.regiter.comp/tested_elsewhere.pass.cpp | 19 +++++ .../re.regiter/re.regiter.deref/deref.pass.cpp | 42 ++++++++++ .../re.regiter/re.regiter.incr/post.pass.cpp | 97 ++++++++++++++++++++++ .../test/std/re/re.iter/re.regiter/types.pass.cpp | 45 ++++++++++ 7 files changed, 317 insertions(+) create mode 100644 libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp create mode 100644 libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp create mode 100644 libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp create mode 100644 libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp create mode 100644 libcxx/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp create mode 100644 libcxx/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp create mode 100644 libcxx/test/std/re/re.iter/re.regiter/types.pass.cpp (limited to 'libcxx/test/std/re/re.iter/re.regiter') diff --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp new file mode 100644 index 00000000000..9c17287cdb8 --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class regex_iterator + +// regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, +// const regex_type&& re, +// int submatch = 0, +// regex_constants::match_flag_type m = +// regex_constants::match_default) = delete; + +#include <__config> + +#if _LIBCPP_STD_VER <= 11 +#error +#else + +#include +#include + +int main() +{ + { + const char phone_book[] = "555-1234, 555-2345, 555-3456"; + std::cregex_iterator i( + std::begin(phone_book), std::end(phone_book), + std::regex("\\d{3}-\\d{4}")); + } +} +#endif diff --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp new file mode 100644 index 00000000000..c9fc7a3cd1c --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class regex_iterator + +// regex_iterator(BidirectionalIterator a, BidirectionalIterator b, +// const regex_type& re, +// regex_constants::match_flag_type m = regex_constants::match_default); + +#include +#include + +int main() +{ + { + std::regex phone_numbers("\\d{3}-\\d{4}"); + const char phone_book[] = "555-1234, 555-2345, 555-3456"; + std::cregex_iterator i(std::begin(phone_book), std::end(phone_book), phone_numbers); + assert(i != std::cregex_iterator()); + assert(i->size() == 1); + assert(i->position() == 0); + assert(i->str() == "555-1234"); + ++i; + assert(i != std::cregex_iterator()); + assert(i->size() == 1); + assert(i->position() == 10); + assert(i->str() == "555-2345"); + ++i; + assert(i != std::cregex_iterator()); + assert(i->size() == 1); + assert(i->position() == 20); + assert(i->str() == "555-3456"); + ++i; + assert(i == std::cregex_iterator()); + } +} diff --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp new file mode 100644 index 00000000000..9d4766dc876 --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class regex_iterator + +// regex_iterator(); + +#include +#include + +template +void +test() +{ + typedef std::regex_iterator I; + I i1; + assert(i1 == I()); +} + +int main() +{ + test(); + test(); +} diff --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp new file mode 100644 index 00000000000..16d1fa9904b --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp @@ -0,0 +1,19 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class regex_iterator + +// bool operator==(const regex_iterator& right) const; +// bool operator!=(const regex_iterator& right) const; + +int main() +{ +} diff --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp new file mode 100644 index 00000000000..e4933fe16f8 --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class regex_iterator + +// const value_type& operator*() const; + +#include +#include + +int main() +{ + { + std::regex phone_numbers("\\d{3}-\\d{4}"); + const char phone_book[] = "555-1234, 555-2345, 555-3456"; + std::cregex_iterator i(std::begin(phone_book), std::end(phone_book), phone_numbers); + assert(i != std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 0); + assert((*i).str() == "555-1234"); + ++i; + assert(i != std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 10); + assert((*i).str() == "555-2345"); + ++i; + assert(i != std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 20); + assert((*i).str() == "555-3456"); + ++i; + assert(i == std::cregex_iterator()); + } +} diff --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp new file mode 100644 index 00000000000..3ec0d6c0c3b --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp @@ -0,0 +1,97 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class regex_iterator + +// regex_iterator operator++(int); + +#include +#include + +int main() +{ + { + std::regex phone_numbers("\\d{3}-\\d{4}"); + const char phone_book[] = "555-1234, 555-2345, 555-3456"; + std::cregex_iterator i(std::begin(phone_book), std::end(phone_book), phone_numbers); + std::cregex_iterator i2 = i; + assert(i != std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 0); + assert((*i).str() == "555-1234"); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + i++; + assert(i != std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 10); + assert((*i).str() == "555-2345"); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + i++; + assert(i != std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 20); + assert((*i).str() == "555-3456"); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + i++; + assert(i == std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + } + { + std::regex phone_numbers("\\d{3}-\\d{4}"); + const char phone_book[] = "555-1234, 555-2345, 555-3456"; + std::cregex_iterator i(std::begin(phone_book), std::end(phone_book), phone_numbers); + std::cregex_iterator i2 = i; + assert(i != std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 0); + assert((*i).str() == "555-1234"); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + ++i; + assert(i != std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 10); + assert((*i).str() == "555-2345"); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + ++i; + assert(i != std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i).size() == 1); + assert((*i).position() == 20); + assert((*i).str() == "555-3456"); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + ++i; + assert(i == std::cregex_iterator()); + assert(i2!= std::cregex_iterator()); + assert((*i2).size() == 1); + assert((*i2).position() == 0); + assert((*i2).str() == "555-1234"); + } +} diff --git a/libcxx/test/std/re/re.iter/re.regiter/types.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/types.pass.cpp new file mode 100644 index 00000000000..db1d3eb958b --- /dev/null +++ b/libcxx/test/std/re/re.iter/re.regiter/types.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template ::value_type, +// class traits = regex_traits> +// class regex_iterator +// { +// public: +// typedef basic_regex regex_type; +// typedef match_results value_type; +// typedef ptrdiff_t difference_type; +// typedef const value_type* pointer; +// typedef const value_type& reference; +// typedef forward_iterator_tag iterator_category; + +#include +#include + +template +void +test() +{ + typedef std::regex_iterator I; + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same*>::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same::value), ""); +} + +int main() +{ + test(); + test(); +} -- cgit v1.2.3