Skip to content

Commit

Permalink
tidying up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorostsa committed Dec 14, 2023
1 parent 4fa59fd commit 323904c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using hpx::experimental::uninitialized_relocate;
std::mutex m;

template <typename F>
void lazy_mutex_op(F&& f)
void simple_mutex_operation(F&& f)
{
std::lock_guard<std::mutex> lk(m);
f();
Expand All @@ -53,7 +53,7 @@ struct counted_struct
: data(data)
{
// Check that we are not constructing an object on top of another
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
HPX_TEST(!made.count(this));
made.insert(this);
});
Expand All @@ -76,7 +76,7 @@ struct counted_struct
}

// Check that we are not constructing an object on top of another
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
// Unless we are testing overlapping relocation
// we should not be move-constructing an object on top of another
if constexpr (!overlapping_test)
Expand All @@ -93,7 +93,7 @@ struct counted_struct

// Check that the object was constructed
// and not already destroyed
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
HPX_TEST(made.count(this));
made.erase(this);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <set>
#include <utility>

constexpr int N = 50; // number of objects to construct
constexpr int M = 20; // number of objects to relocate
constexpr int K = 10; // number of objects to relocate before throwing
constexpr int N = 500; // number of objects to construct
constexpr int M = 200; // number of objects to relocate
constexpr int K = 100; // number of objects to relocate before throwing

static_assert(N > M);
static_assert(M > K);
Expand All @@ -27,7 +27,7 @@ using hpx::experimental::uninitialized_relocate_backward;
std::mutex m;

template <typename F>
void lazy_mutex_op(F&& f)
void simple_mutex_operation(F&& f)
{
std::lock_guard<std::mutex> lk(m);
f();
Expand All @@ -53,7 +53,7 @@ struct counted_struct
: data(data)
{
// Check that we are not constructing an object on top of another
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
HPX_TEST(!made.count(this));
made.insert(this);
});
Expand All @@ -76,7 +76,7 @@ struct counted_struct
}

// Check that we are not constructing an object on top of another
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
// Unless we are testing overlapping relocation
// we should not be move-constructing an object on top of another
if constexpr (!overlapping_test)
Expand All @@ -93,7 +93,7 @@ struct counted_struct

// Check that the object was constructed
// and not already destroyed
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
HPX_TEST(made.count(this));
made.erase(this);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using hpx::experimental::uninitialized_relocate_n;
std::mutex m;

template <typename F>
void lazy_mutex_op(F&& f)
void simple_mutex_operation(F&& f)
{
std::lock_guard<std::mutex> lk(m);
f();
Expand All @@ -53,7 +53,7 @@ struct counted_struct
: data(data)
{
// Check that we are not constructing an object on top of another
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
HPX_TEST(!made.count(this));
made.insert(this);
});
Expand All @@ -76,7 +76,7 @@ struct counted_struct
}

// Check that we are not constructing an object on top of another
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
// Unless we are testing overlapping relocation
// we should not be move-constructing an object on top of another
if constexpr (!overlapping_test)
Expand All @@ -93,7 +93,7 @@ struct counted_struct

// Check that the object was constructed
// and not already destroyed
lazy_mutex_op([&]() {
simple_mutex_operation([&]() {
HPX_TEST(made.count(this));
made.erase(this);
});
Expand Down

0 comments on commit 323904c

Please sign in to comment.