Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion orc-rt/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ add_orc_rt_unittest(CoreTests
AllocActionTest.cpp
BitmaskEnumTest.cpp
CallableTraitsHelperTest.cpp
CommonTestUtils.cpp
ErrorTest.cpp
ExecutorAddressTest.cpp
IntervalMapTest.cpp
Expand Down
20 changes: 0 additions & 20 deletions orc-rt/unittests/CommonTestUtils.cpp

This file was deleted.

9 changes: 8 additions & 1 deletion orc-rt/unittests/CommonTestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <cstddef>

class OpCounter {
template <size_t Idx = 0> class OpCounter {
public:
OpCounter() { ++DefaultConstructions; }
OpCounter(const OpCounter &Other) { ++CopyConstructions; }
Expand Down Expand Up @@ -57,4 +57,11 @@ class OpCounter {
static size_t Destructions;
};

template <size_t Idx> size_t OpCounter<Idx>::DefaultConstructions = 0;
template <size_t Idx> size_t OpCounter<Idx>::CopyConstructions = 0;
template <size_t Idx> size_t OpCounter<Idx>::CopyAssignments = 0;
template <size_t Idx> size_t OpCounter<Idx>::MoveConstructions = 0;
template <size_t Idx> size_t OpCounter<Idx>::MoveAssignments = 0;
template <size_t Idx> size_t OpCounter<Idx>::Destructions = 0;

#endif // ORC_RT_UNITTEST_COMMONTESTUTILS_H
26 changes: 13 additions & 13 deletions orc-rt/unittests/bind-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@ TEST(BindTest, LambdaCapture) {
}

TEST(BindTest, MinimalMoves) {
OpCounter::reset();
OpCounter<>::reset();
{
auto B = bind_front([](OpCounter &O, int) {}, OpCounter());
auto B = bind_front([](OpCounter<> &O, int) {}, OpCounter<>());
B(0);
}
EXPECT_EQ(OpCounter::defaultConstructions(), 1U);
EXPECT_EQ(OpCounter::copies(), 0U);
EXPECT_EQ(OpCounter::moves(), 1U);
EXPECT_EQ(OpCounter::destructions(), 2U);
EXPECT_EQ(OpCounter<>::defaultConstructions(), 1U);
EXPECT_EQ(OpCounter<>::copies(), 0U);
EXPECT_EQ(OpCounter<>::moves(), 1U);
EXPECT_EQ(OpCounter<>::destructions(), 2U);
}

TEST(BindTest, MinimalCopies) {
OpCounter::reset();
OpCounter<>::reset();
{
OpCounter O;
auto B = bind_front([](OpCounter &O, int) {}, O);
OpCounter<> O;
auto B = bind_front([](OpCounter<> &O, int) {}, O);
B(0);
}
EXPECT_EQ(OpCounter::defaultConstructions(), 1U);
EXPECT_EQ(OpCounter::copies(), 1U);
EXPECT_EQ(OpCounter::moves(), 0U);
EXPECT_EQ(OpCounter::destructions(), 2U);
EXPECT_EQ(OpCounter<>::defaultConstructions(), 1U);
EXPECT_EQ(OpCounter<>::copies(), 1U);
EXPECT_EQ(OpCounter<>::moves(), 0U);
EXPECT_EQ(OpCounter<>::destructions(), 2U);
}

TEST(BindTest, ForwardUnboundArgs) {
Expand Down
Loading