Motion: add initial test infrastructure and stubs

pull/47/head
Yuri D'Elia 2021-07-13 16:16:56 +02:00
parent 18ced44341
commit 4fd22f0656
4 changed files with 33 additions and 0 deletions

View File

@ -3,3 +3,4 @@ add_subdirectory(leds)
add_subdirectory(protocol)
add_subdirectory(speed_table)
add_subdirectory(pulse_gen)
add_subdirectory(motion)

View File

@ -0,0 +1,19 @@
# define the test executable
add_executable(
motion_tests
${CMAKE_SOURCE_DIR}/src/modules/motion.cpp
${CMAKE_SOURCE_DIR}/src/modules/speed_table.cpp
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
${MODULES_STUBS_DIR}/stub_gpio.cpp
${MODULES_STUBS_DIR}/stub_shr16.cpp
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
test_motion.cpp
)
# define required search paths
target_include_directories(
motion_tests PUBLIC ${CMAKE_SOURCE_DIR}/src/modules ${CMAKE_SOURCE_DIR}/src/hal
)
# tell build system about the test case
add_catch_test(motion_tests)

View File

@ -0,0 +1,8 @@
#include "catch2/catch.hpp"
#include "motion.h"
using modules::motion::motion;
TEST_CASE("motion::basic", "[motion]") {
// TODO
}

View File

@ -6,6 +6,11 @@ namespace tmc2130 {
TMC2130::TMC2130(const MotorParams &params,
const MotorCurrents &currents,
MotorMode mode) {
// TODO
}
void TMC2130::SetMode(MotorMode mode) {
// TODO
}
} // namespace tmc2130