Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Commit 6d47a77

Browse files
author
Olav de Haas
committed
Fix naming march_hardware tests
1 parent ae1d8a6 commit 6d47a77

27 files changed

+114
-128
lines changed

march_hardware/CMakeLists.txt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -113,32 +113,32 @@ install(DIRECTORY launch
113113
## Add gtest based cpp test target and link libraries
114114
if(CATKIN_ENABLE_TESTING)
115115
catkin_add_gmock(${PROJECT_NAME}_test
116-
test/TestBootShutdownOffsets.cpp
117-
test/TestHighVoltage.cpp
118-
test/TestIMotionCube.cpp
119-
test/TestJoint.cpp
120-
test/TestLowVoltage.cpp
121-
test/TestNetDriverOffsets.cpp
122-
test/TestNetMonitorOffsets.cpp
123-
test/TestPDOmap.cpp
124-
test/TestPowerDistributionBoard.cpp
125-
test/TestRunner.cpp
126-
test/TestSlave.cpp
127-
test/TestTemperatureGES.cpp
128-
test/encoder/TestAbsoluteEncoder.cpp
129-
test/encoder/TestIncrementalEncoder.cpp
130-
test/encoder/TestEncoder.cpp
131-
test/error/test_hardware_exception.cpp
132-
test/error/test_motion_error.cpp
133-
test/mocks/MockAbsoluteEncoder.h
134-
test/mocks/MockEncoder.h
135-
test/mocks/MockIMotionCube.h
136-
test/mocks/MockIncrementalEncoder.h
137-
test/mocks/MockJoint.h
138-
test/mocks/MockPdoInterface.h
139-
test/mocks/MockSdoInterface.h
140-
test/mocks/MockSlave.h
141-
test/mocks/MockTemperatureGES.h
116+
test/encoder/absolute_encoder_test.cpp
117+
test/encoder/encoder_test.cpp
118+
test/encoder/incremental_encoder_test.cpp
119+
test/error/hardware_exception_test.cpp
120+
test/error/motion_error_test.cpp
121+
test/ethercat/pdo_map_test.cpp
122+
test/ethercat/slave_test.cpp
123+
test/imotioncube/imotioncube_test.cpp
124+
test/joint_test.cpp
125+
test/mocks/mock_absolute_encoder.h
126+
test/mocks/mock_encoder.h
127+
test/mocks/mock_imotioncube.h
128+
test/mocks/mock_incremental_encoder.h
129+
test/mocks/mock_joint.h
130+
test/mocks/mock_pdo_interface.h
131+
test/mocks/mock_sdo_interface.h
132+
test/mocks/mock_slave.h
133+
test/mocks/mock_temperature_ges.h
134+
test/power/boot_shutdown_offsets_test.cpp
135+
test/power/high_voltage_test.cpp
136+
test/power/low_voltage_test.cpp
137+
test/power/net_driver_offsets_test.cpp
138+
test/power/net_monitor_offsets_test.cpp
139+
test/power/power_distribution_board_test.cpp
140+
test/temperature/temperature_ges_test.cpp
141+
test/test_runner.cpp
142142
)
143143
target_link_libraries(${PROJECT_NAME}_test ${catkin_LIBRARIES} ${PROJECT_NAME})
144144

march_hardware/test/encoder/TestAbsoluteEncoder.cpp renamed to march_hardware/test/encoder/absolute_encoder_test.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <gtest/gtest.h>
99

10-
class TestAbsoluteEncoder : public testing::Test
10+
class AbsoluteEncoderTest : public testing::Test
1111
{
1212
protected:
1313
const size_t resolution = 17;
@@ -27,80 +27,80 @@ class TestAbsoluteEncoder : public testing::Test
2727
upper_limit_rad, lower_soft_limit_rad, upper_soft_limit_rad);
2828
};
2929

30-
class TestEncoderParameterizedLimits : public TestAbsoluteEncoder,
30+
class TestEncoderParameterizedLimits : public AbsoluteEncoderTest,
3131
public testing::WithParamInterface<std::tuple<int32_t, bool>>
3232
{
3333
};
3434

35-
class TestEncoderParameterizedSoftLimits : public TestAbsoluteEncoder,
35+
class TestEncoderParameterizedSoftLimits : public AbsoluteEncoderTest,
3636
public testing::WithParamInterface<std::tuple<int32_t, bool>>
3737
{
3838
};
3939

40-
class TestEncoderParameterizedValidTarget : public TestAbsoluteEncoder,
40+
class TestEncoderParameterizedValidTarget : public AbsoluteEncoderTest,
4141
public testing::WithParamInterface<std::tuple<int32_t, int32_t, bool>>
4242
{
4343
};
4444

45-
TEST_F(TestAbsoluteEncoder, CorrectLowerHardLimits)
45+
TEST_F(AbsoluteEncoderTest, CorrectLowerHardLimits)
4646
{
4747
ASSERT_EQ(this->encoder.getLowerHardLimitIU(), this->lower_limit);
4848
}
4949

50-
TEST_F(TestAbsoluteEncoder, CorrectUpperHardLimit)
50+
TEST_F(AbsoluteEncoderTest, CorrectUpperHardLimit)
5151
{
5252
ASSERT_EQ(this->encoder.getUpperHardLimitIU(), this->upper_limit);
5353
}
5454

55-
TEST_F(TestAbsoluteEncoder, CorrectLowerSoftLimits)
55+
TEST_F(AbsoluteEncoderTest, CorrectLowerSoftLimits)
5656
{
5757
ASSERT_EQ(this->encoder.getLowerSoftLimitIU(), this->lower_soft_limit);
5858
}
5959

60-
TEST_F(TestAbsoluteEncoder, CorrectUpperSoftLimits)
60+
TEST_F(AbsoluteEncoderTest, CorrectUpperSoftLimits)
6161
{
6262
ASSERT_EQ(this->encoder.getUpperSoftLimitIU(), this->upper_soft_limit);
6363
}
6464

65-
TEST_F(TestAbsoluteEncoder, LowerSoftLimitAboveUpperSoftLimit)
65+
TEST_F(AbsoluteEncoderTest, LowerSoftLimitAboveUpperSoftLimit)
6666
{
6767
ASSERT_THROW(march::AbsoluteEncoder(this->resolution, this->lower_limit, this->upper_limit, this->lower_limit_rad,
6868
this->upper_limit_rad, this->upper_soft_limit_rad, this->lower_soft_limit_rad),
6969
march::error::HardwareException);
7070
}
7171

72-
TEST_F(TestAbsoluteEncoder, LowerSoftLimitLowerThanLowerHardLimit)
72+
TEST_F(AbsoluteEncoderTest, LowerSoftLimitLowerThanLowerHardLimit)
7373
{
7474
ASSERT_THROW(march::AbsoluteEncoder(this->resolution, this->lower_limit, this->upper_limit, this->lower_limit_rad,
7575
this->upper_limit_rad, -0.4, this->upper_soft_limit_rad),
7676
march::error::HardwareException);
7777
}
7878

79-
TEST_F(TestAbsoluteEncoder, UpperSoftLimitHigherThanUpperHardLimit)
79+
TEST_F(AbsoluteEncoderTest, UpperSoftLimitHigherThanUpperHardLimit)
8080
{
8181
ASSERT_THROW(march::AbsoluteEncoder(this->resolution, this->lower_limit, this->upper_limit, this->lower_limit_rad,
8282
this->upper_limit_rad, this->lower_soft_limit_rad, 2.0),
8383
march::error::HardwareException);
8484
}
8585

86-
TEST_F(TestAbsoluteEncoder, ZeroPositionRadToZeroPosition)
86+
TEST_F(AbsoluteEncoderTest, ZeroPositionRadToZeroPosition)
8787
{
8888
ASSERT_EQ(this->encoder.fromRad(0.0), this->zero_position);
8989
}
9090

91-
TEST_F(TestAbsoluteEncoder, CorrectFromRad)
91+
TEST_F(AbsoluteEncoderTest, CorrectFromRad)
9292
{
9393
const double radians = 1.0;
9494
const int32_t expected = (radians * this->total_positions / (2 * M_PI)) + this->zero_position;
9595
ASSERT_EQ(this->encoder.fromRad(radians), expected);
9696
}
9797

98-
TEST_F(TestAbsoluteEncoder, ZeroPositionToZeroRadians)
98+
TEST_F(AbsoluteEncoderTest, ZeroPositionToZeroRadians)
9999
{
100100
ASSERT_DOUBLE_EQ(this->encoder.toRad(this->zero_position), 0.0);
101101
}
102102

103-
TEST_F(TestAbsoluteEncoder, CorrectToRad)
103+
TEST_F(AbsoluteEncoderTest, CorrectToRad)
104104
{
105105
const int32_t iu = 1.0;
106106
const double expected = (iu - this->zero_position) * 2 * M_PI / this->total_positions;

march_hardware/test/encoder/TestEncoder.cpp renamed to march_hardware/test/encoder/encoder_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2020 Project March.
2-
#include "../mocks/MockEncoder.h"
3-
#include "../mocks/MockPdoInterface.h"
2+
#include "../mocks/mock_encoder.h"
3+
#include "../mocks/mock_pdo_interface.h"
44
#include "march_hardware/error/hardware_exception.h"
55

66
#include <cmath>
@@ -17,24 +17,24 @@ using testing::Return;
1717
* instantiate a pure abstract class. So as long as the non virtual
1818
* methods are tested all is ok.
1919
*/
20-
class TestEncoder : public testing::Test
20+
class EncoderTest : public testing::Test
2121
{
2222
protected:
2323
const uint16_t slave_index = 1;
2424
const size_t resolution = 12;
2525
};
2626

27-
TEST_F(TestEncoder, ResolutionBelowRange)
27+
TEST_F(EncoderTest, ResolutionBelowRange)
2828
{
2929
ASSERT_THROW(MockEncoder(0), march::error::HardwareException);
3030
}
3131

32-
TEST_F(TestEncoder, ResolutionAboveRange)
32+
TEST_F(EncoderTest, ResolutionAboveRange)
3333
{
3434
ASSERT_THROW(MockEncoder(50), march::error::HardwareException);
3535
}
3636

37-
TEST_F(TestEncoder, GetAngleIU)
37+
TEST_F(EncoderTest, GetAngleIU)
3838
{
3939
MockEncoder encoder(this->resolution);
4040
const int32_t expected = 101;
@@ -49,7 +49,7 @@ TEST_F(TestEncoder, GetAngleIU)
4949
ASSERT_EQ(expected, encoder.getAngleIU(pdo, expected_offset));
5050
}
5151

52-
TEST_F(TestEncoder, CorrectTotalPositions)
52+
TEST_F(EncoderTest, CorrectTotalPositions)
5353
{
5454
MockEncoder encoder(this->resolution);
5555
ASSERT_EQ(std::pow(2, this->resolution), encoder.getTotalPositions());

march_hardware/test/encoder/TestIncrementalEncoder.cpp renamed to march_hardware/test/encoder/incremental_encoder_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
#include <gtest/gtest.h>
77

8-
class TestIncrementalEncoder : public testing::Test
8+
class IncrementalEncoderTest : public testing::Test
99
{
1010
protected:
1111
const size_t resolution = 12;
1212
const double transmission = 100;
1313
march::IncrementalEncoder encoder = march::IncrementalEncoder(this->resolution, this->transmission);
1414
};
1515

16-
TEST_F(TestIncrementalEncoder, ZeroIUToRad)
16+
TEST_F(IncrementalEncoderTest, ZeroIUToRad)
1717
{
1818
ASSERT_EQ(0.0, this->encoder.toRad(0));
1919
}
2020

21-
TEST_F(TestIncrementalEncoder, CorrectToRad)
21+
TEST_F(IncrementalEncoderTest, CorrectToRad)
2222
{
2323
const int32_t iu = 1000;
2424
const double expected = iu * 2.0 * M_PI / (std::pow(2, this->resolution) * this->transmission);

march_hardware/test/error/test_hardware_exception.cpp renamed to march_hardware/test/error/hardware_exception_test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
using march::error::ErrorType;
77
using march::error::HardwareException;
88

9-
TEST(TestHardwareException, TestErrorType)
9+
TEST(HardwareExceptionTest, TestErrorType)
1010
{
1111
ErrorType expected = ErrorType::UNKNOWN;
1212
HardwareException exception(expected);
1313

1414
ASSERT_EQ(exception.type(), expected);
1515
}
1616

17-
TEST(TestHardwareException, TestNoMessage)
17+
TEST(HardwareExceptionTest, TestNoMessage)
1818
{
1919
ErrorType expected = ErrorType::UNKNOWN;
2020
HardwareException exception(expected);
@@ -28,7 +28,7 @@ TEST(TestHardwareException, TestNoMessage)
2828
ASSERT_EQ(ss.str(), expected_ss.str());
2929
}
3030

31-
TEST(TestHardwareException, TestWhat)
31+
TEST(HardwareExceptionTest, TestWhat)
3232
{
3333
ErrorType expected = ErrorType::UNKNOWN;
3434
const std::string message = "test";
@@ -40,7 +40,7 @@ TEST(TestHardwareException, TestWhat)
4040
ASSERT_EQ(expected_ss.str(), std::string(exception.what()));
4141
}
4242

43-
TEST(TestHardwareException, TestMessage)
43+
TEST(HardwareExceptionTest, TestMessage)
4444
{
4545
ErrorType expected = ErrorType::UNKNOWN;
4646
std::string message = "message";
@@ -55,7 +55,7 @@ TEST(TestHardwareException, TestMessage)
5555
ASSERT_EQ(ss.str(), expected_ss.str());
5656
}
5757

58-
TEST(TestHardwareException, TestFormat)
58+
TEST(HardwareExceptionTest, TestFormat)
5959
{
6060
ErrorType expected = ErrorType::UNKNOWN;
6161
std::string string = "string";

march_hardware/test/error/test_motion_error.cpp renamed to march_hardware/test/error/motion_error_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
#include <gtest/gtest.h>
55

6-
TEST(TestMotionError, ParseNoMotionError)
6+
TEST(MotionErrorTest, ParseNoMotionError)
77
{
88
ASSERT_EQ(march::error::parseMotionError(0), "");
99
}
1010

11-
TEST(TestMotionError, ParseCorrectMotionError)
11+
TEST(MotionErrorTest, ParseCorrectMotionError)
1212
{
1313
const uint16_t error = 1;
1414
ASSERT_EQ(march::error::parseMotionError(error), march::error::MOTION_ERRORS[0]);
1515
}
1616

17-
TEST(TestMotionError, ParseMultipleErrors)
17+
TEST(MotionErrorTest, ParseMultipleErrors)
1818
{
1919
const uint16_t error = 0b1000000000001100;
2020
std::string expected;

march_hardware/test/TestPDOmap.cpp renamed to march_hardware/test/ethercat/pdo_map_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2018 Project March.
2-
#include "mocks/MockSdoInterface.h"
2+
#include "../mocks/mock_sdo_interface.h"
33
#include "march_hardware/ethercat/pdo_map.h"
44

55
#include <gtest/gtest.h>

march_hardware/test/TestSlave.cpp renamed to march_hardware/test/ethercat/slave_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2020 Project March.
2-
#include "mocks/MockPdoInterface.h"
3-
#include "mocks/MockSdoInterface.h"
2+
#include "../mocks/mock_pdo_interface.h"
3+
#include "../mocks/mock_sdo_interface.h"
44
#include "march_hardware/ethercat/slave.h"
55
#include "march_hardware/error/hardware_exception.h"
66

march_hardware/test/TestIMotionCube.cpp renamed to march_hardware/test/imotioncube/imotioncube_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2018 Project March.
2-
#include "mocks/MockAbsoluteEncoder.h"
3-
#include "mocks/MockIncrementalEncoder.h"
4-
#include "mocks/MockSlave.h"
2+
#include "../mocks/mock_absolute_encoder.h"
3+
#include "../mocks/mock_incremental_encoder.h"
4+
#include "../mocks/mock_slave.h"
55

66
#include <march_hardware/imotioncube/imotioncube.h>
77
#include <march_hardware/error/hardware_exception.h>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2018 Project March.
2-
#include "mocks/MockTemperatureGES.h"
3-
#include "mocks/MockIMotionCube.h"
2+
#include "mocks/mock_temperature_ges.h"
3+
#include "mocks/mock_imotioncube.h"
44
#include "march_hardware/error/hardware_exception.h"
55
#include "march_hardware/joint.h"
66

0 commit comments

Comments
 (0)