Skip to content

Commit

Permalink
Address warnings reported by Codacy checks
Browse files Browse the repository at this point in the history
- flyby: moving tests into correct solution folder
  • Loading branch information
hkaiser committed Aug 15, 2019
1 parent c294878 commit 76cb8a5
Show file tree
Hide file tree
Showing 61 changed files with 717 additions and 656 deletions.
1 change: 1 addition & 0 deletions cmake/tests/cxx11_std_atomic_128bit.cpp
Expand Up @@ -14,6 +14,7 @@ void test_atomic()
std::atomic<T> a;
a.store(T{});
T i = a.load();
(void)i;
}

struct uint128_type
Expand Down
Expand Up @@ -172,9 +172,8 @@ namespace hpx

public:
explicit coarray(hpx::lcos::spmd_block const& block,
std::string name,
hpx::detail::coarray_sizes<N>
cosizes,
std::string const& name,
hpx::detail::coarray_sizes<N> cosizes,
std::size_t segment_size)
: base_type(block)
, vector_()
Expand Down Expand Up @@ -205,7 +204,9 @@ namespace hpx
vector_.register_as(hpx::launch::sync, name + "_hpx_coarray");
}
else
{
vector_.connect_to(hpx::launch::sync, name + "_hpx_coarray");
}

view = update_view(cosizes, num_images, indices(), block,
vector_.begin(), vector_.end());
Expand Down
Expand Up @@ -120,7 +120,7 @@ namespace hpx
{
basis[0] = 1;

std::size_t tmp = 1;
std::size_t tmp = 1;
auto in = sizes.begin();

(void)std::initializer_list<int>{
Expand Down
Expand Up @@ -171,15 +171,18 @@ namespace hpx {
using const_element_type = hpx::detail::const_view_element<T,Data>;

explicit const_partitioned_vector_view_iterator(
hpx::lcos::spmd_block const & block
, const_segment_iterator const & begin
, const_segment_iterator const & end
, std::array<std::size_t, N+1> const & sw_basis
, std::array<std::size_t, N+1> const & hw_basis
, std::size_t count
)
: block_(block), t_(begin), begin_(begin), end_(end), count_(count)
, sw_basis_(sw_basis), hw_basis_(hw_basis)
hpx::lcos::spmd_block const& block,
const_segment_iterator const& begin,
const_segment_iterator const& end,
std::array<std::size_t, N + 1> const& sw_basis,
std::array<std::size_t, N + 1> const& hw_basis, std::size_t count)
: block_(block)
, t_(begin)
, begin_(begin)
, end_(end)
, count_(count)
, sw_basis_(sw_basis)
, hw_basis_(hw_basis)
{}

const_partitioned_vector_view_iterator(
Expand All @@ -188,10 +191,15 @@ namespace hpx {
const_partitioned_vector_view_iterator(
const_partitioned_vector_view_iterator &&) = default;

const_partitioned_vector_view_iterator(
partitioned_vector_view_iterator<T,N,Data> const & o)
: block_(o.block_), t_(o.t_), begin_(o.begin_), end_(o.end_),
count_(o.count_), sw_basis_(o.sw_basis_), hw_basis_(o.hw_basis_)
explicit const_partitioned_vector_view_iterator(
partitioned_vector_view_iterator<T, N, Data> const& o)
: block_(o.block_)
, t_(o.t_)
, begin_(o.begin_)
, end_(o.end_)
, count_(o.count_)
, sw_basis_(o.sw_basis_)
, hw_basis_(o.hw_basis_)
{}

// Note : partitioned_vector_view_iterator is not assignable
Expand Down
Expand Up @@ -21,7 +21,7 @@ foreach(test ${tests})
${${test}_FLAGS}
EXCLUDE_FROM_ALL
HPX_PREFIX ${HPX_BUILD_PREFIX}
FOLDER "Tests/Regressions/Components")
FOLDER "Tests/Regressions/Components/Containers")

add_hpx_regression_test("components.partitioned_vector" ${test} ${${test}_PARAMETERS})
endforeach()
Expand Down
Expand Up @@ -37,7 +37,7 @@ foreach(test ${tests})

source_group("Source Files" FILES ${sources})

set(folder_name "Tests/Unit/Components")
set(folder_name "Tests/Unit/Components/Containers")

# add example executable
add_hpx_executable(${test}_test
Expand Down
Expand Up @@ -44,29 +44,28 @@ void bulk_test( hpx::lcos::spmd_block block,
view_type my_view(block,
my_vector.begin(), my_vector.end(), {size_x,size_y,size_z});

int idx = 0;

// Ensure that only one image is putting data into the different
// partitions
if(block.this_image() == 0)
{
// Traverse all the co-indexed elements
int idx = 0;
for(auto i = my_view.begin(); i != my_view.end(); i++)
{
// It's a Put operation
*i = std::vector<double>(elt_size,idx++);
*i = std::vector<double>(elt_size, idx++);
}

auto left_it = my_view.begin();
auto right_it = my_view.cbegin();

// Note: Useless computation, since we assign segments to themselves
for(; left_it != my_view.end(); left_it++, right_it++)
for (; left_it != my_view.end(); ++left_it, ++right_it)
{
// Check that dereferencing iterator and const_iterator does not
// retrieve the same type
HPX_TEST((
!std::is_same<decltype(*left_it),decltype(*right_it)>::value));
!std::is_same<decltype(*left_it), decltype(*right_it)>::value));

// It's a Put operation
*left_it = *right_it;
Expand All @@ -79,15 +78,15 @@ void bulk_test( hpx::lcos::spmd_block block,
{
int idx = 0;

for (std::size_t k = 0; k<size_z; k++)
for (std::size_t j = 0; j<size_y; j++)
for (std::size_t i = 0; i<size_x; i++)
for (std::size_t k = 0; k < size_z; k++)
for (std::size_t j = 0; j < size_y; j++)
for (std::size_t i = 0; i < size_x; i++)
{
std::vector<double> result(elt_size,idx);
std::vector<double> result(elt_size, idx);

// It's a Get operation
std::vector<double> value =
(std::vector<double>)my_view(i,j,k);
(std::vector<double>) my_view(i, j, k);

const_iterator it1 = result.begin(), it2 = value.begin();
const_iterator end1 = result.end();
Expand All @@ -105,7 +104,7 @@ void bulk_test( hpx::lcos::spmd_block block,
// Re-check by traversing all the co-indexed elements
for(auto i = my_view.cbegin(); i != my_view.cend(); i++)
{
std::vector<double> result(elt_size,idx);
std::vector<double> result(elt_size, idx);

// It's a Get operation
std::vector<double> value = (std::vector<double>)(*i);
Expand Down
Expand Up @@ -139,7 +139,7 @@ namespace hpx
{
unordered_hasher() : hasher_() {}

unordered_hasher(Hash const& hasher)
explicit unordered_hasher(Hash const& hasher)
: hasher_(hasher)
{}

Expand All @@ -155,8 +155,9 @@ namespace hpx
template <typename Hash>
struct unordered_hasher<Hash, std::true_type>
{
unordered_hasher() {}
unordered_hasher(Hash const&) {}
unordered_hasher() = default;

explicit unordered_hasher(Hash const&) {}

template <typename Key>
std::size_t operator()(Key const& key) const
Expand All @@ -170,7 +171,8 @@ namespace hpx
struct unordered_comparator
{
unordered_comparator() : equal_() {}
unordered_comparator(KeyEqual const& equal)

explicit unordered_comparator(KeyEqual const& equal)
: equal_(equal)
{}

Expand All @@ -186,8 +188,9 @@ namespace hpx
template <typename KeyEqual>
struct unordered_comparator<KeyEqual, std::true_type>
{
unordered_comparator() {}
unordered_comparator(KeyEqual const&) {}
unordered_comparator() = default;

explicit unordered_comparator(KeyEqual const&) {}

template <typename Key>
bool operator()(Key const& lhs, Key const& rhs) const
Expand Down Expand Up @@ -566,8 +569,10 @@ namespace hpx
{
if (this != &rhs)
{
this->base_type::operator=(std::move(rhs));
this->hash_base_type::operator=(std::move(rhs));
this->base_type::operator=(
std::move(static_cast<base_type&&>(rhs)));
this->hash_base_type::operator=(
std::move(static_cast<hash_base_type&&>(rhs)));

partitions_ = std::move(rhs.partitions_);
}
Expand Down
2 changes: 1 addition & 1 deletion components/containers/unordered/tests/unit/CMakeLists.txt
Expand Up @@ -20,7 +20,7 @@ foreach(test ${tests})

source_group("Source Files" FILES ${sources})

set(folder_name "Tests/Unit/Components")
set(folder_name "Tests/Unit/Components/Containers")

# add example executable
add_hpx_executable(${test}_test
Expand Down
Expand Up @@ -60,7 +60,7 @@ namespace hpx { namespace iostreams { namespace server
: write_f(make_std_ostream_write_function(os))
{}

output_stream(std::reference_wrapper<std::ostream> os)
output_stream(std::reference_wrapper<std::ostream> const& os)
: write_f(make_std_ostream_write_function(os.get()))
{}

Expand Down
2 changes: 1 addition & 1 deletion components/iostreams/tests/regressions/CMakeLists.txt
Expand Up @@ -25,7 +25,7 @@ foreach(test ${tests})
${${test}_FLAGS}
EXCLUDE_FROM_ALL
HPX_PREFIX ${HPX_BUILD_PREFIX}
FOLDER "Tests/Regressions/Components")
FOLDER "Tests/Regressions/Components/IO")

add_hpx_regression_test("components.iostreams" ${test} ${${test}_PARAMETERS})
endforeach()
Expand Down

0 comments on commit 76cb8a5

Please sign in to comment.