Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iox-#2041 Rename 'CTorAndAssignmentOperatorTestClass' to 'LifetimeAndAssignmentTracker' #2058

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
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "iox/fixed_position_container.hpp"

#include "iceoryx_hoofs/error_handling/error_handling.hpp"
#include "iceoryx_hoofs/testing/ctor_and_assignment_operator_test_class.hpp"
#include "iceoryx_hoofs/testing/fatal_failure.hpp"
#include "iceoryx_hoofs/testing/lifetime_and_assignment_tracker.hpp"

#include "test.hpp"

Expand All @@ -35,7 +35,7 @@ struct FixedPositionContainer_test : public Test

using Sut = FixedPositionContainer<DataType, CAPACITY>;

using ComplexType = CTorAndAssignmentOperatorTestClass<DataType, 0>;
using ComplexType = LifetimeAndAssignmentTracker<DataType, 0>;
using SutComplex = FixedPositionContainer<ComplexType, CAPACITY>;

void SetUp() override
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_dust/test/moduletests/test_cxx_forward_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

#include "iceoryx_dust/cxx/forward_list.hpp"
#include "iceoryx_hoofs/error_handling/error_handling.hpp"
#include "iceoryx_hoofs/testing/ctor_and_assignment_operator_test_class.hpp"
#include "iceoryx_hoofs/testing/fatal_failure.hpp"
#include "iceoryx_hoofs/testing/lifetime_and_assignment_tracker.hpp"
#include "iox/attributes.hpp"
#include "test.hpp"

Expand All @@ -33,7 +33,7 @@ constexpr int64_t TEST_LIST_ELEMENT_DEFAULT_VALUE{-99L};
class forward_list_test : public Test
{
public:
using TestListElement = CTorAndAssignmentOperatorTestClass<int64_t, TEST_LIST_ELEMENT_DEFAULT_VALUE>;
using TestListElement = LifetimeAndAssignmentTracker<int64_t, TEST_LIST_ELEMENT_DEFAULT_VALUE>;

void SetUp() override
{
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_hoofs/test/moduletests/test_container_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// SPDX-License-Identifier: Apache-2.0

#include "iceoryx_hoofs/error_handling/error_handling.hpp"
#include "iceoryx_hoofs/testing/ctor_and_assignment_operator_test_class.hpp"
#include "iceoryx_hoofs/testing/fatal_failure.hpp"
#include "iceoryx_hoofs/testing/lifetime_and_assignment_tracker.hpp"
#include "iox/vector.hpp"
#include "test.hpp"

Expand All @@ -32,7 +32,7 @@ using namespace iox::testing;
class vector_test : public Test
{
public:
using CTorTest = CTorAndAssignmentOperatorTestClass<>;
using CTorTest = LifetimeAndAssignmentTracker<>;

void SetUp() override
{
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_hoofs/test/moduletests/test_cxx_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// SPDX-License-Identifier: Apache-2.0

#include "iceoryx_hoofs/error_handling/error_handling.hpp"
#include "iceoryx_hoofs/testing/ctor_and_assignment_operator_test_class.hpp"
#include "iceoryx_hoofs/testing/fatal_failure.hpp"
#include "iceoryx_hoofs/testing/lifetime_and_assignment_tracker.hpp"
#include "iox/attributes.hpp"
#include "iox/list.hpp"
#include "iox/logging.hpp"
Expand All @@ -36,7 +36,7 @@ constexpr int64_t TEST_LIST_ELEMENT_DEFAULT_VALUE{-99L};
class list_test : public Test
{
public:
using TestListElement = CTorAndAssignmentOperatorTestClass<int64_t, TEST_LIST_ELEMENT_DEFAULT_VALUE>;
using TestListElement = LifetimeAndAssignmentTracker<int64_t, TEST_LIST_ELEMENT_DEFAULT_VALUE>;

void SetUp() override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_HOOFS_TESTING_CTOR_AND_ASSIGNMENT_OPERATOR_TEST_CLASS_HPP
#define IOX_HOOFS_TESTING_CTOR_AND_ASSIGNMENT_OPERATOR_TEST_CLASS_HPP
#ifndef IOX_HOOFS_TESTING_LIFETIME_AND_ASSIGNMENT_TRACKER_HPP
#define IOX_HOOFS_TESTING_LIFETIME_AND_ASSIGNMENT_TRACKER_HPP

#include <cstdint>
#include <vector>
Expand All @@ -27,38 +27,38 @@ namespace iox
namespace testing
{
template <typename T = uint64_t, T DEFAULT_VALUE = 0>
class CTorAndAssignmentOperatorTestClass
class LifetimeAndAssignmentTracker
{
public:
CTorAndAssignmentOperatorTestClass()
LifetimeAndAssignmentTracker()
{
stats.cTor++;
stats.classValue = value;
}

// NOLINTNEXTLINE(hicpp-explicit-conversions) we want to use this class in tests transparently to a 'T'
CTorAndAssignmentOperatorTestClass(const T value)
LifetimeAndAssignmentTracker(const T value)
: value(value)
{
stats.customCTor++;
stats.classValue = value;
}

CTorAndAssignmentOperatorTestClass(const CTorAndAssignmentOperatorTestClass& rhs)
LifetimeAndAssignmentTracker(const LifetimeAndAssignmentTracker& rhs)
: value(rhs.value)
{
stats.copyCTor++;
stats.classValue = value;
}

CTorAndAssignmentOperatorTestClass(CTorAndAssignmentOperatorTestClass&& rhs) noexcept
LifetimeAndAssignmentTracker(LifetimeAndAssignmentTracker&& rhs) noexcept
: value(rhs.value)
{
stats.moveCTor++;
stats.classValue = value;
}

CTorAndAssignmentOperatorTestClass& operator=(const CTorAndAssignmentOperatorTestClass& rhs)
LifetimeAndAssignmentTracker& operator=(const LifetimeAndAssignmentTracker& rhs)
{
if (this != &rhs)
{
Expand All @@ -69,7 +69,7 @@ class CTorAndAssignmentOperatorTestClass
return *this;
}

CTorAndAssignmentOperatorTestClass& operator=(CTorAndAssignmentOperatorTestClass&& rhs) noexcept
LifetimeAndAssignmentTracker& operator=(LifetimeAndAssignmentTracker&& rhs) noexcept
{
if (this != &rhs)
{
Expand All @@ -80,12 +80,12 @@ class CTorAndAssignmentOperatorTestClass
return *this;
}

bool operator==(const CTorAndAssignmentOperatorTestClass& rhs) const
bool operator==(const LifetimeAndAssignmentTracker& rhs) const
{
return value == rhs.value;
}

~CTorAndAssignmentOperatorTestClass()
~LifetimeAndAssignmentTracker()
{
stats.dTor++;
stats.classValue = value;
Expand Down Expand Up @@ -136,9 +136,9 @@ class CTorAndAssignmentOperatorTestClass
};

template <typename T, T DEFAULT_VALUE>
typename CTorAndAssignmentOperatorTestClass<T, DEFAULT_VALUE>::Statistics
CTorAndAssignmentOperatorTestClass<T, DEFAULT_VALUE>::stats{};
typename LifetimeAndAssignmentTracker<T, DEFAULT_VALUE>::Statistics
LifetimeAndAssignmentTracker<T, DEFAULT_VALUE>::stats{};
} // namespace testing
} // namespace iox

#endif // IOX_HOOFS_TESTING_CTOR_AND_ASSIGNMENT_OPERATOR_TEST_CLASS_HPP
#endif // IOX_HOOFS_TESTING_LIFETIME_AND_ASSIGNMENT_TRACKER_HPP