diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -59,6 +59,9 @@ - C++2b: ``bit``, ``type_traits`` +- The headers ```` and ```` have been removed, since all the contents + have been implemented in namespace ``std`` for at least two releases. + Upcoming Deprecations and Removals ---------------------------------- @@ -66,6 +69,12 @@ Please see the updated documentation about the safe libc++ mode and in particular the ``_LIBCPP_VERBOSE_ABORT`` macro for details. +- The headers ````, ````, ````, + ````, ````, ````, ````, + ````, ````, ````, + and ```` will be removed in LLVM 18, as all their contents will have been implemented in + namespace ``std`` for at least two releases. + API Changes ----------- diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -789,10 +789,8 @@ expected experimental/__config experimental/__memory - experimental/algorithm experimental/deque experimental/forward_list - experimental/functional experimental/iterator experimental/list experimental/map diff --git a/libcxx/include/experimental/algorithm b/libcxx/include/experimental/algorithm deleted file mode 100644 --- a/libcxx/include/experimental/algorithm +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_ALGORITHM -#define _LIBCPP_EXPERIMENTAL_ALGORITHM - -/* - experimental/algorithm synopsis - -#include - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - -template -ForwardIterator search(ForwardIterator first, ForwardIterator last, - const Searcher &searcher); - -// sample removed because it's now part of C++17 - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -*/ - -#include <__assert> // all public C++ headers provide the assertion handler -#include <__debug> -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -template -_LIBCPP_INLINE_VISIBILITY -_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s) -{ return __s(__f, __l).first; } - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */ diff --git a/libcxx/include/experimental/functional b/libcxx/include/experimental/functional deleted file mode 100644 --- a/libcxx/include/experimental/functional +++ /dev/null @@ -1,436 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_FUNCTIONAL -#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL - -/* - experimental/functional synopsis - -#include - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - // 4.3, Searchers - template> - class default_searcher; - - template::value_type>, - class BinaryPredicate = equal_to<>> - class boyer_moore_searcher; - - template::value_type>, - class BinaryPredicate = equal_to<>> - class boyer_moore_horspool_searcher; - - template> - default_searcher - make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last, - BinaryPredicate pred = BinaryPredicate()); - - template::value_type>, - class BinaryPredicate = equal_to<>> - boyer_moore_searcher - make_boyer_moore_searcher( - RandomAccessIterator pat_first, RandomAccessIterator pat_last, - Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); - - template::value_type>, - class BinaryPredicate = equal_to<>> - boyer_moore_horspool_searcher - make_boyer_moore_horspool_searcher( - RandomAccessIterator pat_first, RandomAccessIterator pat_last, - Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); - - } // namespace fundamentals_v1 - } // namespace experimental - -} // namespace std - -*/ - -#include <__assert> // all public C++ headers provide the assertion handler -#include <__debug> -#include <__functional/identity.h> -#include <__memory/uses_allocator.h> -#include -#include -#include -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -#ifdef _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS -# define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER -# define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER -# define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER -#else -# define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::default_searcher will be removed in LLVM 17. Use std::default_searcher instead") -# define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_searcher will be removed in LLVM 17. Use std::boyer_moore_searcher instead") -# define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_horspool_searcher will be removed in LLVM 17. Use std::boyer_moore_horspool_searcher instead") -#endif - -#if _LIBCPP_STD_VER >= 14 -// default searcher -template> -class _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_TEMPLATE_VIS default_searcher { -public: - _LIBCPP_INLINE_VISIBILITY - default_searcher(_ForwardIterator __f, _ForwardIterator __l, - _BinaryPredicate __p = _BinaryPredicate()) - : __first_(__f), __last_(__l), __pred_(__p) {} - - template - _LIBCPP_INLINE_VISIBILITY - pair<_ForwardIterator2, _ForwardIterator2> - operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const - { - auto __proj = __identity(); - return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj); - } - -private: - _ForwardIterator __first_; - _ForwardIterator __last_; - _BinaryPredicate __pred_; - }; - -template> -_LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_INLINE_VISIBILITY -default_searcher<_ForwardIterator, _BinaryPredicate> -make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ()) -{ - return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p); -} - -template class _BMSkipTable; - -// General case for BM data searching; use a map -template -class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> { - typedef _Value value_type; - typedef _Key key_type; - - const _Value __default_value_; - std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_; - -public: - _LIBCPP_INLINE_VISIBILITY - _BMSkipTable(size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred) - : __default_value_(__default), __table_(__sz, __hf, __pred) {} - - _LIBCPP_INLINE_VISIBILITY - void insert(const key_type &__key, value_type __val) - { - __table_ [__key] = __val; // Would skip_.insert (val) be better here? - } - - _LIBCPP_INLINE_VISIBILITY - value_type operator [](const key_type & __key) const - { - auto __it = __table_.find (__key); - return __it == __table_.end() ? __default_value_ : __it->second; - } -}; - - -// Special case small numeric values; use an array -template -class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> { -private: - typedef _Value value_type; - typedef _Key key_type; - - typedef __make_unsigned_t unsigned_key_type; - typedef std::array skip_map; - skip_map __table_; - -public: - _LIBCPP_INLINE_VISIBILITY - _BMSkipTable(size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/) - { - std::fill_n(__table_.begin(), __table_.size(), __default); - } - - _LIBCPP_INLINE_VISIBILITY - void insert(key_type __key, value_type __val) - { - __table_[static_cast(__key)] = __val; - } - - _LIBCPP_INLINE_VISIBILITY - value_type operator [](key_type __key) const - { - return __table_[static_cast(__key)]; - } -}; - - -template ::value_type>, - class _BinaryPredicate = equal_to<>> -class _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_TEMPLATE_VIS boyer_moore_searcher { -private: - typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type; - typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type; - typedef _BMSkipTable::value && // what about enums? - sizeof(value_type) == 1 && - is_same<_Hash, hash>::value && - is_same<_BinaryPredicate, equal_to<>>::value - > skip_table_type; - -public: - boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, - _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) - : __first_(__f), __last_(__l), __pred_(__pred), - __pattern_length_(_VSTD::distance(__first_, __last_)), - __skip_{std::make_shared(__pattern_length_, -1, __hf, __pred_)}, - __suffix_{std::make_shared>(__pattern_length_ + 1)} - { - // build the skip table - for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) - __skip_->insert(*__f, __i); - - this->__build_suffix_table ( __first_, __last_, __pred_ ); - } - - template - pair<_RandomAccessIterator2, _RandomAccessIterator2> - operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const - { - static_assert(__is_same_uncvref::value_type, - typename iterator_traits<_RandomAccessIterator2>::value_type>::value, - "Corpus and Pattern iterators must point to the same type"); - - if (__f == __l ) return std::make_pair(__l, __l); // empty corpus - if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern - - // If the pattern is larger than the corpus, we can't find it! - if ( __pattern_length_ > _VSTD::distance(__f, __l)) - return std::make_pair(__l, __l); - - // Do the search - return this->__search(__f, __l); - } - -private: - _RandomAccessIterator1 __first_; - _RandomAccessIterator1 __last_; - _BinaryPredicate __pred_; - difference_type __pattern_length_; - shared_ptr __skip_; - shared_ptr> __suffix_; - - template - pair<_RandomAccessIterator2, _RandomAccessIterator2> - __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const - { - _RandomAccessIterator2 __cur = __f; - const _RandomAccessIterator2 __last = __l - __pattern_length_; - const skip_table_type & __skip = *__skip_.get(); - const vector & __suffix = *__suffix_.get(); - - while (__cur <= __last) - { - - // Do we match right where we are? - difference_type __j = __pattern_length_; - while (__pred_(__first_ [__j-1], __cur [__j-1])) { - __j--; - // We matched - we're done! - if ( __j == 0 ) - return std::make_pair(__cur, __cur + __pattern_length_); - } - - // Since we didn't match, figure out how far to skip forward - difference_type __k = __skip[__cur [ __j - 1 ]]; - difference_type __m = __j - __k - 1; - if (__k < __j && __m > __suffix[ __j ]) - __cur += __m; - else - __cur += __suffix[ __j ]; - } - - return std::make_pair(__l, __l); // We didn't find anything - } - - - template - void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix ) - { - const size_t __count = _VSTD::distance(__f, __l); - - __prefix[0] = 0; - size_t __k = 0; - for ( size_t __i = 1; __i < __count; ++__i ) - { - while ( __k > 0 && !__pred ( __f[__k], __f[__i] )) - __k = __prefix [ __k - 1 ]; - - if ( __pred ( __f[__k], __f[__i] )) - __k++; - __prefix [ __i ] = __k; - } - } - - void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, - _BinaryPredicate __pred) - { - const size_t __count = _VSTD::distance(__f, __l); - vector & __suffix = *__suffix_.get(); - if (__count > 0) - { - vector __scratch(__count); - - __compute_bm_prefix(__f, __l, __pred, __scratch); - for ( size_t __i = 0; __i <= __count; __i++ ) - __suffix[__i] = __count - __scratch[__count-1]; - - typedef reverse_iterator<_RandomAccessIterator1> _RevIter; - __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch); - - for ( size_t __i = 0; __i < __count; __i++ ) - { - const size_t __j = __count - __scratch[__i]; - const difference_type __k = __i - __scratch[__i] + 1; - - if (__suffix[__j] > __k) - __suffix[__j] = __k; - } - } - } - -}; - -template::value_type>, - class _BinaryPredicate = equal_to<>> -_LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_INLINE_VISIBILITY -boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate> -make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, - _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ()) -{ - return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p); -} - -// boyer-moore-horspool -template ::value_type>, - class _BinaryPredicate = equal_to<>> -class _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher { -private: - typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type; - typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type; - typedef _BMSkipTable::value && // what about enums? - sizeof(value_type) == 1 && - is_same<_Hash, hash>::value && - is_same<_BinaryPredicate, equal_to<>>::value - > skip_table_type; - -public: - boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, - _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) - : __first_(__f), __last_(__l), __pred_(__pred), - __pattern_length_(_VSTD::distance(__first_, __last_)), - __skip_{_VSTD::make_shared(__pattern_length_, __pattern_length_, __hf, __pred_)} - { - // build the skip table - if ( __f != __l ) - { - __l = __l - 1; - for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) - __skip_->insert(*__f, __pattern_length_ - 1 - __i); - } - } - - template - pair<_RandomAccessIterator2, _RandomAccessIterator2> - operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const - { - static_assert(__is_same_uncvref::value_type, - typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value, - "Corpus and Pattern iterators must point to the same type"); - - if (__f == __l ) return std::make_pair(__l, __l); // empty corpus - if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern - - // If the pattern is larger than the corpus, we can't find it! - if ( __pattern_length_ > _VSTD::distance(__f, __l)) - return std::make_pair(__l, __l); - - // Do the search - return this->__search(__f, __l); - } - -private: - _RandomAccessIterator1 __first_; - _RandomAccessIterator1 __last_; - _BinaryPredicate __pred_; - difference_type __pattern_length_; - shared_ptr __skip_; - - template - pair<_RandomAccessIterator2, _RandomAccessIterator2> - __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const { - _RandomAccessIterator2 __cur = __f; - const _RandomAccessIterator2 __last = __l - __pattern_length_; - const skip_table_type & __skip = *__skip_.get(); - - while (__cur <= __last) - { - // Do we match right where we are? - difference_type __j = __pattern_length_; - while (__pred_(__first_[__j-1], __cur[__j-1])) - { - __j--; - // We matched - we're done! - if ( __j == 0 ) - return std::make_pair(__cur, __cur + __pattern_length_); - } - __cur += __skip[__cur[__pattern_length_-1]]; - } - - return std::make_pair(__l, __l); - } -}; - -template::value_type>, - class _BinaryPredicate = equal_to<>> -_LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_INLINE_VISIBILITY -boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate> -make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, - _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ()) -{ - return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p); -} - -#endif // _LIBCPP_STD_VER >= 14 - -_LIBCPP_END_NAMESPACE_LFTS - -_LIBCPP_POP_MACROS - -#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */ diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -1678,10 +1678,6 @@ module experimental { requires cplusplus11 - module algorithm { - header "experimental/algorithm" - export * - } module deque { header "experimental/deque" export * @@ -1690,10 +1686,6 @@ header "experimental/forward_list" export * } - module functional { - header "experimental/functional" - export * - } module iterator { header "experimental/iterator" export * diff --git a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp --- a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp +++ b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp @@ -658,120 +658,108 @@ // RUN: %{build} -DTEST_122 #if defined(TEST_122) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_123 #if defined(TEST_123) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_124 #if defined(TEST_124) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_125 #if defined(TEST_125) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_126 #if defined(TEST_126) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_127 #if defined(TEST_127) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_128 #if defined(TEST_128) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_129 -#if defined(TEST_129) && __cplusplus >= 201103L -# include +#if defined(TEST_129) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_130 #if defined(TEST_130) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_131 -#if defined(TEST_131) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L -# include +#if defined(TEST_131) && __cplusplus >= 201103L +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_132 #if defined(TEST_132) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_133 #if defined(TEST_133) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_134 #if defined(TEST_134) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_135 #if defined(TEST_135) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_136 #if defined(TEST_136) && __cplusplus >= 201103L -# include +# include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_137 #if defined(TEST_137) && __cplusplus >= 201103L -# include - using HandlerType = decltype(std::__libcpp_verbose_abort); -#endif - -// RUN: %{build} -DTEST_138 -#if defined(TEST_138) && __cplusplus >= 201103L -# include - using HandlerType = decltype(std::__libcpp_verbose_abort); -#endif - -// RUN: %{build} -DTEST_139 -#if defined(TEST_139) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif -// RUN: %{build} -DTEST_140 -#if defined(TEST_140) +// RUN: %{build} -DTEST_138 +#if defined(TEST_138) # include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif -// RUN: %{build} -DTEST_141 -#if defined(TEST_141) +// RUN: %{build} -DTEST_139 +#if defined(TEST_139) # include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp --- a/libcxx/test/libcxx/clang_tidy.sh.cpp +++ b/libcxx/test/libcxx/clang_tidy.sh.cpp @@ -215,18 +215,12 @@ # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp --- a/libcxx/test/libcxx/double_include.sh.cpp +++ b/libcxx/test/libcxx/double_include.sh.cpp @@ -216,18 +216,12 @@ # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L diff --git a/libcxx/test/libcxx/experimental/algorithms/header.algorithm.synop/includes.pass.cpp b/libcxx/test/libcxx/experimental/algorithms/header.algorithm.synop/includes.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/experimental/algorithms/header.algorithm.synop/includes.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -#include - -#include "test_macros.h" - -#ifndef _LIBCPP_ALGORITHM -# error " must include " -#endif - -int main(int, char**) -{ - - return 0; -} diff --git a/libcxx/test/libcxx/experimental/algorithms/version.pass.cpp b/libcxx/test/libcxx/experimental/algorithms/version.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/experimental/algorithms/version.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -#include - -#include "test_macros.h" - -#ifndef _LIBCPP_VERSION -# error _LIBCPP_VERSION not defined -#endif - -int main(int, char**) -{ - - return 0; -} diff --git a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp --- a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp @@ -338,10 +338,6 @@ TEST_MACROS(); #endif #if __cplusplus >= 201103L -# include -TEST_MACROS(); -#endif -#if __cplusplus >= 201103L # include TEST_MACROS(); #endif @@ -350,10 +346,6 @@ TEST_MACROS(); #endif #if __cplusplus >= 201103L -# include -TEST_MACROS(); -#endif -#if __cplusplus >= 201103L # include TEST_MACROS(); #endif diff --git a/libcxx/test/libcxx/modules_include.sh.cpp b/libcxx/test/libcxx/modules_include.sh.cpp --- a/libcxx/test/libcxx/modules_include.sh.cpp +++ b/libcxx/test/libcxx/modules_include.sh.cpp @@ -541,82 +541,74 @@ #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_122 #if defined(TEST_122) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_123 #if defined(TEST_123) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_124 #if defined(TEST_124) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_125 #if defined(TEST_125) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_126 #if defined(TEST_126) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_127 #if defined(TEST_127) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_128 #if defined(TEST_128) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_129 -#if defined(TEST_129) && __cplusplus >= 201103L -#include +#if defined(TEST_129) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_130 #if defined(TEST_130) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_131 -#if defined(TEST_131) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L -#include +#if defined(TEST_131) && __cplusplus >= 201103L +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_132 #if defined(TEST_132) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_133 #if defined(TEST_133) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_134 #if defined(TEST_134) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_135 #if defined(TEST_135) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_136 #if defined(TEST_136) && __cplusplus >= 201103L -#include +#include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_137 #if defined(TEST_137) && __cplusplus >= 201103L -#include -#endif -// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_138 -#if defined(TEST_138) && __cplusplus >= 201103L -#include -#endif -// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_139 -#if defined(TEST_139) && __cplusplus >= 201103L #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_140 -#if defined(TEST_140) +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_138 +#if defined(TEST_138) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_141 -#if defined(TEST_141) +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_139 +#if defined(TEST_139) #include #endif // GENERATED-MARKER diff --git a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp --- a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp @@ -340,18 +340,12 @@ # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L diff --git a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp --- a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp +++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp @@ -213,18 +213,12 @@ # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L -# include -#endif -#if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L diff --git a/libcxx/test/libcxx/transitive_includes.sh.cpp b/libcxx/test/libcxx/transitive_includes.sh.cpp --- a/libcxx/test/libcxx/transitive_includes.sh.cpp +++ b/libcxx/test/libcxx/transitive_includes.sh.cpp @@ -481,84 +481,76 @@ #if defined(TEST_119) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_122 2> %t/header.experimental_algorithm +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_122 2> %t/header.experimental_deque #if defined(TEST_122) -#include -#endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_123 2> %t/header.experimental_deque -#if defined(TEST_123) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_124 2> %t/header.experimental_forward_list -#if defined(TEST_124) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_123 2> %t/header.experimental_forward_list +#if defined(TEST_123) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_125 2> %t/header.experimental_functional -#if defined(TEST_125) -#include -#endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_126 2> %t/header.experimental_iterator -#if defined(TEST_126) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_124 2> %t/header.experimental_iterator +#if defined(TEST_124) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_127 2> %t/header.experimental_list -#if defined(TEST_127) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_125 2> %t/header.experimental_list +#if defined(TEST_125) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_128 2> %t/header.experimental_map -#if defined(TEST_128) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_126 2> %t/header.experimental_map +#if defined(TEST_126) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_129 2> %t/header.experimental_memory_resource -#if defined(TEST_129) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_127 2> %t/header.experimental_memory_resource +#if defined(TEST_127) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_130 2> %t/header.experimental_propagate_const -#if defined(TEST_130) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_128 2> %t/header.experimental_propagate_const +#if defined(TEST_128) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_131 2> %t/header.experimental_regex -#if defined(TEST_131) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_129 2> %t/header.experimental_regex +#if defined(TEST_129) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_132 2> %t/header.experimental_set -#if defined(TEST_132) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_130 2> %t/header.experimental_set +#if defined(TEST_130) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_133 2> %t/header.experimental_simd -#if defined(TEST_133) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_131 2> %t/header.experimental_simd +#if defined(TEST_131) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_134 2> %t/header.experimental_string -#if defined(TEST_134) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_132 2> %t/header.experimental_string +#if defined(TEST_132) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_135 2> %t/header.experimental_type_traits -#if defined(TEST_135) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_133 2> %t/header.experimental_type_traits +#if defined(TEST_133) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_136 2> %t/header.experimental_unordered_map -#if defined(TEST_136) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_134 2> %t/header.experimental_unordered_map +#if defined(TEST_134) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_137 2> %t/header.experimental_unordered_set -#if defined(TEST_137) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_135 2> %t/header.experimental_unordered_set +#if defined(TEST_135) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_138 2> %t/header.experimental_utility -#if defined(TEST_138) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_136 2> %t/header.experimental_utility +#if defined(TEST_136) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_139 2> %t/header.experimental_vector -#if defined(TEST_139) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_137 2> %t/header.experimental_vector +#if defined(TEST_137) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_140 2> %t/header.ext_hash_map -#if defined(TEST_140) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_138 2> %t/header.ext_hash_map +#if defined(TEST_138) #include #endif -// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_141 2> %t/header.ext_hash_set -#if defined(TEST_141) +// RUN: %{cxx} %s %{flags} %{compile_flags} --trace-includes -fshow-skipped-includes -fsyntax-only -DTEST_139 2> %t/header.ext_hash_set +#if defined(TEST_139) #include #endif // RUN: %{python} %S/transitive_includes_to_csv.py %t > %t/transitive_includes.csv diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv --- a/libcxx/test/libcxx/transitive_includes/cxx03.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv @@ -214,19 +214,10 @@ expected initializer_list expected new expected version -experimental/algorithm algorithm -experimental/algorithm cstddef -experimental/algorithm type_traits experimental/deque deque experimental/deque experimental/memory_resource experimental/forward_list experimental/memory_resource experimental/forward_list forward_list -experimental/functional array -experimental/functional cstddef -experimental/functional functional -experimental/functional type_traits -experimental/functional unordered_map -experimental/functional vector experimental/iterator cstddef experimental/iterator iosfwd experimental/iterator iterator diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv --- a/libcxx/test/libcxx/transitive_includes/cxx11.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv @@ -214,19 +214,10 @@ expected initializer_list expected new expected version -experimental/algorithm algorithm -experimental/algorithm cstddef -experimental/algorithm type_traits experimental/deque deque experimental/deque experimental/memory_resource experimental/forward_list experimental/memory_resource experimental/forward_list forward_list -experimental/functional array -experimental/functional cstddef -experimental/functional functional -experimental/functional type_traits -experimental/functional unordered_map -experimental/functional vector experimental/iterator cstddef experimental/iterator iosfwd experimental/iterator iterator diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv --- a/libcxx/test/libcxx/transitive_includes/cxx14.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv @@ -214,19 +214,10 @@ expected initializer_list expected new expected version -experimental/algorithm algorithm -experimental/algorithm cstddef -experimental/algorithm type_traits experimental/deque deque experimental/deque experimental/memory_resource experimental/forward_list experimental/memory_resource experimental/forward_list forward_list -experimental/functional array -experimental/functional cstddef -experimental/functional functional -experimental/functional type_traits -experimental/functional unordered_map -experimental/functional vector experimental/iterator cstddef experimental/iterator iosfwd experimental/iterator iterator diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv --- a/libcxx/test/libcxx/transitive_includes/cxx17.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv @@ -214,19 +214,10 @@ expected initializer_list expected new expected version -experimental/algorithm algorithm -experimental/algorithm cstddef -experimental/algorithm type_traits experimental/deque deque experimental/deque experimental/memory_resource experimental/forward_list experimental/memory_resource experimental/forward_list forward_list -experimental/functional array -experimental/functional cstddef -experimental/functional functional -experimental/functional type_traits -experimental/functional unordered_map -experimental/functional vector experimental/iterator cstddef experimental/iterator iosfwd experimental/iterator iterator diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv --- a/libcxx/test/libcxx/transitive_includes/cxx20.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv @@ -222,19 +222,10 @@ expected initializer_list expected new expected version -experimental/algorithm algorithm -experimental/algorithm cstddef -experimental/algorithm type_traits experimental/deque deque experimental/deque experimental/memory_resource experimental/forward_list experimental/memory_resource experimental/forward_list forward_list -experimental/functional array -experimental/functional cstddef -experimental/functional functional -experimental/functional type_traits -experimental/functional unordered_map -experimental/functional vector experimental/iterator cstddef experimental/iterator iosfwd experimental/iterator iterator diff --git a/libcxx/test/libcxx/transitive_includes/cxx2b.csv b/libcxx/test/libcxx/transitive_includes/cxx2b.csv --- a/libcxx/test/libcxx/transitive_includes/cxx2b.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx2b.csv @@ -164,19 +164,10 @@ expected initializer_list expected new expected version -experimental/algorithm algorithm -experimental/algorithm cstddef -experimental/algorithm type_traits experimental/deque deque experimental/deque experimental/memory_resource experimental/forward_list experimental/memory_resource experimental/forward_list forward_list -experimental/functional array -experimental/functional cstddef -experimental/functional functional -experimental/functional type_traits -experimental/functional unordered_map -experimental/functional vector experimental/iterator cstddef experimental/iterator iosfwd experimental/iterator iterator diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp +++ /dev/null @@ -1,155 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_searcher { -// public: -// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - - -#include -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) { - std::experimental::boyer_moore_searcher s{b2, e2}; - assert(result == std::experimental::search(b1, e1, s)); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1)); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1)); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1)); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4)); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8)); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3)); - int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sj = sizeof(ij)/sizeof(ij[0]); - int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sk = sizeof(ik)/sizeof(ik[0]); - do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6)); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1)); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1)); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1)); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4)); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8)); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3)); - char ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sj = sizeof(ij)/sizeof(ij[0]); - char ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sk = sizeof(ik)/sizeof(ik[0]); - do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6)); -} - -template -void test_large_str() { - std::vector data(257, 'a'); - data[254] = 'b'; - data[255] = 'b'; - data[256] = 'b'; - const signed char find[] = {'b', 'b', 'b'}; - do_search(Iter1(data.data()), Iter1(data.data() + data.size()), - Iter2(find), Iter2(find + 3), - Iter1(data.data() + 254)); -} - -void test_custom_pred() { - std::string long_string(1024, '0'); - auto searcher = std::experimental::make_boyer_moore_searcher(std::begin(long_string), std::end(long_string)); - const char str[] = "1234"; - auto ret = searcher(std::begin(str), std::end(str)); - assert(ret.first == std::end(str)); - assert(ret.second == std::end(str)); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - test_large_str, random_access_iterator>(); - test_custom_pred(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_searcher { -// public: -// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template struct MyHash { - size_t operator () (T t) const { return static_cast(t); } -}; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) { - std::experimental::boyer_moore_searcher::value_type>::type>> - s{b2, e2}; - assert(result == std::experimental::search(b1, e1, s)); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_searcher { -// public: -// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template struct MyHash { - size_t operator () (T t) const { return static_cast(t); } -}; - -struct count_equal -{ - static unsigned count; - template - bool operator()(const T& x, const T& y) const - {++count; return x == y;} -}; - -unsigned count_equal::count = 0; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) { - std::experimental::boyer_moore_searcher::value_type>::type>, - count_equal> - s{b2, e2}; - count_equal::count = 0; - assert(result == std::experimental::search(b1, e1, s)); - assert(count_equal::count <= max_count); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); - -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_searcher { -// public: -// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -struct count_equal -{ - static unsigned count; - template - bool operator()(const T& x, const T& y) const - {++count; return x == y;} -}; - -unsigned count_equal::count = 0; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) { - std::experimental::boyer_moore_searcher::value_type>::type>, count_equal> s{b2, e2}; - count_equal::count = 0; - assert(result == std::experimental::search(b1, e1, s)); - assert(count_equal::count <= max_count); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp +++ /dev/null @@ -1,131 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore_horspool searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_horspool_searcher { -// public: -// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) { - std::experimental::boyer_moore_horspool_searcher s{b2, e2}; - assert(result == std::experimental::search(b1, e1, s)); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1)); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1)); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1)); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4)); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8)); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3)); - int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sj = sizeof(ij)/sizeof(ij[0]); - int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sk = sizeof(ik)/sizeof(ik[0]); - do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6)); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1)); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1)); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1)); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4)); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8)); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3)); - char ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sj = sizeof(ij)/sizeof(ij[0]); - char ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sk = sizeof(ik)/sizeof(ik[0]); - do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6)); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore_horspool searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_horspool_searcher { -// public: -// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template struct MyHash { - size_t operator () (T t) const { return static_cast(t); } -}; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) { - std::experimental::boyer_moore_horspool_searcher::value_type>::type>> - s{b2, e2}; - assert(result == std::experimental::search(b1, e1, s)); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp +++ /dev/null @@ -1,139 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore_horspool searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_horspool_searcher { -// public: -// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template struct MyHash { - size_t operator () (T t) const { return static_cast(t); } -}; - -struct count_equal -{ - static unsigned count; - template - bool operator()(const T& x, const T& y) const - {++count; return x == y;} -}; - -unsigned count_equal::count = 0; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) { - std::experimental::boyer_moore_horspool_searcher::value_type>::type>, - count_equal> - s{b2, e2}; - count_equal::count = 0; - assert(result == std::experimental::search(b1, e1, s)); - assert(count_equal::count <= max_count); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp +++ /dev/null @@ -1,133 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// boyer_moore_horspool searcher -// template::value_type>, -// class BinaryPredicate = equal_to<>> -// class boyer_moore_horspool_searcher { -// public: -// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last, -// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); -// -// template -// pair -// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const; -// -// private: -// RandomAccessIterator1 pat_first_; // exposition only -// RandomAccessIterator1 pat_last_; // exposition only -// Hash hash_; // exposition only -// BinaryPredicate pred_; // exposition only -// }; - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -struct count_equal -{ - static unsigned count; - template - bool operator()(const T& x, const T& y) const - {++count; return x == y;} -}; - -unsigned count_equal::count = 0; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) { - std::experimental::boyer_moore_horspool_searcher::value_type>::type>, count_equal> s{b2, e2}; - count_equal::count = 0; - assert(result == std::experimental::search(b1, e1, s)); - assert(count_equal::count <= max_count); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -template -void -test2() -{ - char ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - char ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - char id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - char ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - char ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - char ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, random_access_iterator >(); - test2, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// default searcher -// template> -// class default_searcher { -// public: -// default_searcher(_ForwardIterator __f, _ForwardIterator __l, -// _BinaryPredicate __p = _BinaryPredicate()) -// : __first_(__f), __last_(__l), __pred_(__p) {} -// -// template -// pair<_ForwardIterator2, _ForwardIterator2> -// operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const { -// return std::search(__f, __l, __first_, __last_, __pred_); -// } -// -// private: -// _ForwardIterator __first_; -// _ForwardIterator __last_; -// _BinaryPredicate __pred_; -// }; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) { - std::experimental::default_searcher s{b2, e2}; - assert(result == std::experimental::search(b1, e1, s)); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1)); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1)); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1)); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4)); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8)); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3)); - int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sj = sizeof(ij)/sizeof(ij[0]); - int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sk = sizeof(ik)/sizeof(ik[0]); - do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6)); -} - -int main(int, char**) { - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp +++ /dev/null @@ -1,106 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// default searcher -// template> -// class default_searcher { -// public: -// default_searcher(_ForwardIterator __f, _ForwardIterator __l, -// _BinaryPredicate __p = _BinaryPredicate()) -// : __first_(__f), __last_(__l), __pred_(__p) {} -// -// template -// pair<_ForwardIterator2, _ForwardIterator2> -// operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const { -// return std::search(__f, __l, __first_, __last_, __pred_); -// } -// -// private: -// _ForwardIterator __first_; -// _ForwardIterator __last_; -// _BinaryPredicate __pred_; -// }; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -struct count_equal -{ - static unsigned count; - template - bool operator()(const T& x, const T& y) const - {++count; return x == y;} -}; - -unsigned count_equal::count = 0; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) { - std::experimental::default_searcher s{b2, e2}; - count_equal::count = 0; - assert(result == std::experimental::search(b1, e1, s)); - assert(count_equal::count <= max_count); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// template> -// default_searcher -// make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last, -// BinaryPredicate pred = BinaryPredicate()); - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) { - assert(result == std::experimental::search(b1, e1, - std::experimental::make_default_searcher(b2, e2))); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2)); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3)); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia)); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1)); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1)); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1)); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1)); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4)); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8)); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3)); - int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sj = sizeof(ij)/sizeof(ij[0]); - int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0}; - const unsigned sk = sizeof(ik)/sizeof(ik[0]); - do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6)); -} - -int main(int, char**) { - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp b/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp +++ /dev/null @@ -1,91 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS - -// - -// template> -// default_searcher -// make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last, -// BinaryPredicate pred = BinaryPredicate()); - - -#include -#include -#include - -#include "test_macros.h" -#include "test_iterators.h" - -struct count_equal -{ - static unsigned count; - template - bool operator()(const T& x, const T& y) - {++count; return x == y;} -}; - -unsigned count_equal::count = 0; - -template -void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) { - count_equal::count = 0; - assert(result == std::experimental::search(b1, e1, - std::experimental::make_default_searcher(b2, e2))); - assert(count_equal::count <= max_count); -} - -template -void -test() -{ - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa); - do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa); - do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa); - do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa); - do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa); - int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - int ic[] = {1}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb); - int id[] = {1, 2}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2); - int ie[] = {1, 2, 3}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3); - int ig[] = {1, 2, 3, 4}; - do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4); - int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4}; - const unsigned sh = sizeof(ih)/sizeof(ih[0]); - int ii[] = {1, 1, 2}; - do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3); -} - -int main(int, char**) { - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - test, forward_iterator >(); - test, bidirectional_iterator >(); - test, random_access_iterator >(); - - return 0; -} diff --git a/libcxx/test/std/experimental/func/header.functional.synop/includes.pass.cpp b/libcxx/test/std/experimental/func/header.functional.synop/includes.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/experimental/func/header.functional.synop/includes.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -// -// -// has to include - -#include - -#include "test_macros.h" - -int main(int, char**) -{ - std::function x; - - return 0; -} diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -323,9 +323,7 @@ libcxx/include/execution libcxx/include/expected libcxx/include/__expected/expected.h -libcxx/include/experimental/algorithm libcxx/include/experimental/__config -libcxx/include/experimental/functional libcxx/include/experimental/iterator libcxx/include/experimental/map libcxx/include/experimental/__memory