55
66TEST (MotionErrorTest, ParseNoMotionError)
77{
8- ASSERT_EQ (march::error::parseMotionError ( 0 ), " " );
8+ ASSERT_EQ (march::error::parseError ( 0 , march::error::ErrorRegisters::MOTION_ERROR ), " " );
99}
1010
1111TEST (MotionErrorTest, ParseCorrectMotionError)
1212{
1313 const uint16_t error = 1 ;
14- ASSERT_EQ (march::error::parseMotionError (error), march::error::MOTION_ERRORS[0 ]);
14+ ASSERT_EQ (march::error::parseError (error, march::error::ErrorRegisters::MOTION_ERROR),
15+ march::error::MOTION_ERRORS[0 ]);
1516}
1617
1718TEST (MotionErrorTest, ParseMultipleErrors)
@@ -21,18 +22,19 @@ TEST(MotionErrorTest, ParseMultipleErrors)
2122 expected += march::error::MOTION_ERRORS[2 ];
2223 expected += march::error::MOTION_ERRORS[3 ];
2324 expected += march::error::MOTION_ERRORS[15 ];
24- ASSERT_EQ (march::error::parseMotionError (error), expected);
25+ ASSERT_EQ (march::error::parseError (error, march::error::ErrorRegisters::MOTION_ERROR ), expected);
2526}
2627
2728TEST (TestDetailedMotionError, ParseNoDetailedMotionError)
2829{
29- ASSERT_EQ (march::error::parseDetailedError ( 0 ), " " );
30+ ASSERT_EQ (march::error::parseError ( 0 , march::error::ErrorRegisters::DETAILED_ERROR ), " " );
3031}
3132
3233TEST (TestDetailedMotionError, ParseCorrectDetailedMotionError)
3334{
3435 const uint16_t error = 1 ;
35- ASSERT_EQ (march::error::parseDetailedError (error), march::error::DETAILED_MOTION_ERRORS[0 ]);
36+ ASSERT_EQ (march::error::parseError (error, march::error::ErrorRegisters::DETAILED_ERROR),
37+ march::error::DETAILED_MOTION_ERRORS[0 ]);
3638}
3739
3840TEST (TestDetailedMotionError, ParseMultipleDetailedErrors)
@@ -42,5 +44,26 @@ TEST(TestDetailedMotionError, ParseMultipleDetailedErrors)
4244 expected += march::error::DETAILED_MOTION_ERRORS[2 ];
4345 expected += march::error::DETAILED_MOTION_ERRORS[3 ];
4446 expected += march::error::DETAILED_MOTION_ERRORS[8 ];
45- ASSERT_EQ (march::error::parseDetailedError (error), expected);
47+ ASSERT_EQ (march::error::parseError (error, march::error::ErrorRegisters::DETAILED_ERROR ), expected);
4648}
49+
50+ TEST (TestSecondDetailedMotionError, ParseNoSecondDetailedMotionError)
51+ {
52+ ASSERT_EQ (march::error::parseError (0 , march::error::ErrorRegisters::SECOND_DETAILED_ERROR), " " );
53+ }
54+
55+ TEST (TestSecondDetailedMotionError, ParseCorrectSecondDetailedMotionError)
56+ {
57+ const uint16_t error = 1 ;
58+ ASSERT_EQ (march::error::parseError (error, march::error::ErrorRegisters::SECOND_DETAILED_ERROR),
59+ march::error::SECOND_DETAILED_MOTION_ERRORS[0 ]);
60+ }
61+
62+ TEST (TestSecondDetailedMotionError, ParseMultipleSecondDetailedErrors)
63+ {
64+ const uint16_t error = 0b0001100 ;
65+ std::string expected;
66+ expected += march::error::SECOND_DETAILED_MOTION_ERRORS[2 ];
67+ expected += march::error::SECOND_DETAILED_MOTION_ERRORS[3 ];
68+ ASSERT_EQ (march::error::parseError (error, march::error::ErrorRegisters::SECOND_DETAILED_ERROR), expected);
69+ }
0 commit comments