• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #867

15 Jan 2023 08:00PM UTC coverage: 86.487% (+0.5%) from 85.951%
#867

push

StellarBot
Merge #6135

6135: Fixing warnings reported by MSVC analysis r=hkaiser a=hkaiser

- adding MSVC specific #pragma's to suppress the benign warnings


Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

120 of 120 new or added lines in 33 files covered. (100.0%)

174599 of 201880 relevant lines covered (86.49%)

1945607.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/libs/full/segmented_algorithms/tests/unit/partitioned_vector_adjacent_difference2.cpp
1
//  Copyright (c) 2017 Ajai V George
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8
#if !defined(HPX_COMPUTE_DEVICE_CODE)
9
#include <hpx/hpx_main.hpp>
10
#include <hpx/include/parallel_adjacent_difference.hpp>
11
#include <hpx/include/parallel_count.hpp>
12
#include <hpx/include/parallel_scan.hpp>
13
#include <hpx/include/partitioned_vector_predef.hpp>
14
#include <hpx/include/runtime.hpp>
15
#include <hpx/modules/testing.hpp>
16

17
#include <cstddef>
18
#include <vector>
19

20
///////////////////////////////////////////////////////////////////////////////
21
template <typename ExPolicy, typename T>
22
void verify_values(
×
23
    ExPolicy&&, hpx::partitioned_vector<T> const& v, T const& val)
24
{
25
    typedef typename hpx::partitioned_vector<T>::const_iterator const_iterator;
26

27
    std::size_t size = 0;
×
28

29
    const_iterator end = v.end();
×
30
    for (const_iterator it = v.begin(); it != end; ++it, ++size)
×
31
    {
32
        HPX_TEST_EQ(*it, val);
×
33
    }
×
34

35
    HPX_TEST_EQ(size, v.size());
×
36
}
×
37

38
template <typename ExPolicy, typename T>
39
void verify_values(ExPolicy&&, hpx::partitioned_vector<T> const& v)
×
40
{
41
    typedef typename hpx::partitioned_vector<T>::const_iterator const_iterator;
42
    std::size_t size = 0;
×
43
    T val = 1;
×
44
    const_iterator end = v.end();
×
45
    for (const_iterator it = v.begin(); it != end; ++it, ++size)
×
46
    {
47
        HPX_TEST_EQ(*it, val++);
×
48
    }
×
49
    HPX_TEST_EQ(size, v.size());
×
50
}
×
51

52
template <typename ExPolicy, typename T>
53
void test_adjacent_difference(ExPolicy&& policy, hpx::partitioned_vector<T>& v,
×
54
    hpx::partitioned_vector<T>& w, T val)
55
{
56
    hpx::adjacent_difference(policy, v.begin(), v.end(), w.begin());
×
57

58
    verify_values(policy, w, val);
×
59
    verify_values(policy, v);
×
60
}
×
61

62
template <typename ExPolicy, typename T>
63
void test_adjacent_difference_async(ExPolicy&& policy,
×
64
    hpx::partitioned_vector<T>& v, hpx::partitioned_vector<T>& w, T val)
65
{
66
    hpx::adjacent_difference(policy, v.begin(), v.end(), w.begin()).get();
×
67

68
    verify_values(policy, w, val);
×
69
    verify_values(policy, v);
×
70
}
×
71

72
///////////////////////////////////////////////////////////////////////////////
73
template <typename T>
74
void adjacent_difference_tests(std::vector<hpx::id_type>& localities)
×
75
{
76
    std::size_t const length = 12;
×
77

78
    hpx::partitioned_vector<T> v(
×
79
        length, T(1), hpx::container_layout(localities));
×
80
    hpx::inclusive_scan(hpx::execution::seq, v.begin(), v.end(), v.begin());
×
81
    hpx::partitioned_vector<T> w(length, hpx::container_layout(localities));
×
82
    test_adjacent_difference(hpx::execution::seq, v, w, T(1));
×
83
    test_adjacent_difference(hpx::execution::par, v, w, T(1));
×
84
    test_adjacent_difference_async(
×
85
        hpx::execution::seq(hpx::execution::task), v, w, T(1));
×
86
    test_adjacent_difference_async(
×
87
        hpx::execution::par(hpx::execution::task), v, w, T(1));
×
88
}
×
89

90
///////////////////////////////////////////////////////////////////////////////
91
int main()
×
92
{
93
    std::vector<hpx::id_type> localities = hpx::find_all_localities();
×
94
    adjacent_difference_tests<double>(localities);
×
95
    return hpx::util::report_errors();
×
96
}
×
97
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc