Skip to content

Commit

Permalink
Fix test errors with _GLIBCXX_DEBUG defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Simberg authored and msimberg committed Dec 6, 2021
1 parent 448feeb commit 9657d5b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Expand Up @@ -482,7 +482,7 @@ void test_inplace_merge_etc(IteratorTag, DataType, int rand_base)
typedef typename std::vector<DataType>::iterator base_iterator;

std::size_t const left_size = 300007, right_size = 123456;
std::vector<DataType> res(left_size + right_size), sol, org;
std::vector<DataType> res(left_size + right_size), sol;

base_iterator res_first = std::begin(res);
base_iterator res_middle = res_first + left_size;
Expand All @@ -493,7 +493,7 @@ void test_inplace_merge_etc(IteratorTag, DataType, int rand_base)
std::sort(res_first, res_middle);
std::sort(res_middle, res_last);

org = sol = res;
sol = res;
base_iterator sol_first = std::begin(sol);
base_iterator sol_middle = sol_first + left_size;
base_iterator sol_last = std::end(sol);
Expand All @@ -502,8 +502,6 @@ void test_inplace_merge_etc(IteratorTag, DataType, int rand_base)
{
typedef test::test_iterator<base_iterator, IteratorTag> iterator;

sol = res = org;

hpx::inplace_merge(
iterator(res_first), iterator(res_middle), iterator(res_last));
std::inplace_merge(sol_first, sol_middle, sol_last);
Expand All @@ -524,7 +522,7 @@ void test_inplace_merge_etc(
typedef typename std::vector<DataType>::iterator base_iterator;

std::size_t const left_size = 300007, right_size = 123456;
std::vector<DataType> res(left_size + right_size), sol, org;
std::vector<DataType> res(left_size + right_size), sol;

base_iterator res_first = std::begin(res);
base_iterator res_middle = res_first + left_size;
Expand All @@ -535,7 +533,7 @@ void test_inplace_merge_etc(
std::sort(res_first, res_middle);
std::sort(res_middle, res_last);

org = sol = res;
sol = res;
base_iterator sol_first = std::begin(sol);
base_iterator sol_middle = sol_first + left_size;
base_iterator sol_last = std::end(sol);
Expand All @@ -544,8 +542,6 @@ void test_inplace_merge_etc(
{
typedef test::test_iterator<base_iterator, IteratorTag> iterator;

sol = res = org;

hpx::inplace_merge(policy, iterator(res_first), iterator(res_middle),
iterator(res_last));
std::inplace_merge(sol_first, sol_middle, sol_last);
Expand Down
6 changes: 3 additions & 3 deletions libs/core/algorithms/tests/unit/algorithms/is_heap_tests.hpp
Expand Up @@ -520,9 +520,9 @@ void test_is_heap(bool test_for_is_heap = true)
test_is_heap_with_pred(
seq, IteratorTag(), int(), std::greater<int>(), test_for_is_heap);
test_is_heap_with_pred(
par, IteratorTag(), int(), std::less<int>(), test_for_is_heap);
test_is_heap_with_pred(par_unseq, IteratorTag(), int(),
std::greater_equal<int>(), test_for_is_heap);
par, IteratorTag(), int(), std::greater<int>(), test_for_is_heap);
test_is_heap_with_pred(
par_unseq, IteratorTag(), int(), std::greater<int>(), test_for_is_heap);

test_is_heap_async(seq(task), IteratorTag(), int(), test_for_is_heap);
test_is_heap_async(par(task), IteratorTag(), int(), test_for_is_heap);
Expand Down
Expand Up @@ -546,13 +546,21 @@ namespace hpx { namespace traits {
} // namespace detail

template <typename Iter,
bool not_vector = !detail::is_vector_iterator<Iter>::value>
bool not_vector =
// When _GLIBCXX_DEBUG is defined vectors are contiguous, but the iterators
// are not plain pointers.
#if defined(_GLIBCXX_DEBUG)
false
#else
detail::is_vector_iterator<Iter>::value
#endif
>
struct is_contiguous_iterator : std::is_pointer<Iter>::type
{
};

template <typename Iter>
struct is_contiguous_iterator<Iter, false> : std::true_type
struct is_contiguous_iterator<Iter, true> : std::true_type
{
};

Expand Down

0 comments on commit 9657d5b

Please sign in to comment.