Skip to content

Commit ab9b2cc

Browse files
authored
move direction outside template (#626)
* move direction outside template * run indentation * add .md * it was in archive, my bad * fucked tests * fucking fucking indentation
1 parent 54f7ab9 commit ab9b2cc

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
release: minor
2+
summary: move a struct outside template class

Inc/ST-LIB_LOW/Sensors/EncoderSensor/NewEncoderSensor.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
#include "C++Utilities/CppUtils.hpp"
1010

1111
namespace ST_LIB {
12-
12+
enum Direction : uint8_t { FORWARD = 0, BACKWARDS = 1 };
1313
template <typename EncoderType, size_t SAMPLES> struct EncoderSensor {
14-
enum Direction : uint8_t { FORWARD = 0, BACKWARDS = 1 };
1514

1615
private:
1716
constexpr static size_t WINDOW_SIZE{(SAMPLES / 2) * 2};

Tests/Time/encoder_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TEST(EncoderSensorTest, ReadTreatsEncoderInitialCounterAsZeroPosition) {
103103
double position = -1.0;
104104
double speed = -1.0;
105105
double acceleration = -1.0;
106-
MockSensor::Direction direction = MockSensor::BACKWARDS;
106+
ST_LIB::Direction direction = ST_LIB::Direction::BACKWARDS;
107107

108108
MockSensor sensor(encoder, 0.5, 0.1, &direction, &position, &speed, &acceleration);
109109

@@ -112,7 +112,7 @@ TEST(EncoderSensorTest, ReadTreatsEncoderInitialCounterAsZeroPosition) {
112112
EXPECT_DOUBLE_EQ(position, 0.0);
113113
EXPECT_DOUBLE_EQ(speed, 0.0);
114114
EXPECT_DOUBLE_EQ(acceleration, 0.0);
115-
EXPECT_EQ(direction, MockSensor::FORWARD);
115+
EXPECT_EQ(direction, ST_LIB::Direction::FORWARD);
116116
}
117117

118118
TEST(EncoderSensorTest, ResetForwardsToEncoderAndClearsHistory) {
@@ -122,7 +122,7 @@ TEST(EncoderSensorTest, ResetForwardsToEncoderAndClearsHistory) {
122122
double position = 0.0;
123123
double speed = 0.0;
124124
double acceleration = 0.0;
125-
MockSensor::Direction direction = MockSensor::BACKWARDS;
125+
ST_LIB::Direction direction = ST_LIB::Direction::BACKWARDS;
126126

127127
MockSensor sensor(encoder, 1.0, 1.0, &direction, &position, &speed, &acceleration);
128128

0 commit comments

Comments
 (0)