diff options
Diffstat (limited to 'libcxx/test/algorithms/alg.nonmodifying/mismatch')
-rw-r--r-- | libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp | 53 | ||||
-rw-r--r-- | libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp | 71 |
2 files changed, 0 insertions, 124 deletions
diff --git a/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp deleted file mode 100644 index 0cf06bbfba7..00000000000 --- a/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// template<InputIterator Iter1, InputIterator Iter2> -// requires HasEqualTo<Iter1::value_type, Iter2::value_type> -// pair<Iter1, Iter2> -// mismatch(Iter1 first1, Iter1 last1, Iter2 first2); - -#include <algorithm> -#include <cassert> - -#include "test_iterators.h" - -#if _LIBCPP_STD_VER > 11 -#define HAS_FOUR_ITERATOR_VERSION -#endif - -int main() -{ - int ia[] = {0, 1, 2, 2, 0, 1, 2, 3}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - int ib[] = {0, 1, 2, 3, 0, 1, 2, 3}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - - typedef input_iterator<const int*> II; - typedef random_access_iterator<const int*> RAI; - - assert(std::mismatch(II(ia), II(ia + sa), II(ib)) - == (std::pair<II, II>(II(ia+3), II(ib+3)))); - - assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib)) - == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3)))); - -#ifdef HAS_FOUR_ITERATOR_VERSION - assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+sb)) - == (std::pair<II, II>(II(ia+3), II(ib+3)))); - - assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib+sb)) - == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3)))); - - - assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+2)) - == (std::pair<II, II>(II(ia+2), II(ib+2)))); -#endif -} diff --git a/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp deleted file mode 100644 index ce0326c660f..00000000000 --- a/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// template<InputIterator Iter1, InputIterator Iter2, -// Predicate<auto, Iter1::value_type, Iter2::value_type> Pred> -// requires CopyConstructible<Pred> -// pair<Iter1, Iter2> -// mismatch(Iter1 first1, Iter1 last1, Iter2 first2, Pred pred); - -#include <algorithm> -#include <functional> -#include <cassert> - -#include "test_iterators.h" -#include "counting_predicates.hpp" - -#if _LIBCPP_STD_VER > 11 -#define HAS_FOUR_ITERATOR_VERSION -#endif - -int main() -{ - int ia[] = {0, 1, 2, 2, 0, 1, 2, 3}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); - int ib[] = {0, 1, 2, 3, 0, 1, 2, 3}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); - - typedef input_iterator<const int*> II; - typedef random_access_iterator<const int*> RAI; - typedef std::equal_to<int> EQ; - - assert(std::mismatch(II(ia), II(ia + sa), II(ib), EQ()) - == (std::pair<II, II>(II(ia+3), II(ib+3)))); - assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), EQ()) - == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3)))); - - binary_counting_predicate<EQ, int> bcp((EQ())); - assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), std::ref(bcp)) - == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3)))); - assert(bcp.count() > 0 && bcp.count() < sa); - bcp.reset(); - -#ifdef HAS_FOUR_ITERATOR_VERSION - assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), EQ()) - == (std::pair<II, II>(II(ia+3), II(ib+3)))); - assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib + sb), EQ()) - == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3)))); - - assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), std::ref(bcp)) - == (std::pair<II, II>(II(ia+3), II(ib+3)))); - assert(bcp.count() > 0 && bcp.count() < std::min(sa, sb)); -#endif - - assert(std::mismatch(ia, ia + sa, ib, EQ()) == - (std::pair<int*,int*>(ia+3,ib+3))); - -#ifdef HAS_FOUR_ITERATOR_VERSION - assert(std::mismatch(ia, ia + sa, ib, ib + sb, EQ()) == - (std::pair<int*,int*>(ia+3,ib+3))); - assert(std::mismatch(ia, ia + sa, ib, ib + 2, EQ()) == - (std::pair<int*,int*>(ia+2,ib+2))); -#endif -} |