mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 21:33:33 +08:00
unittests: add setup code to call param_init()
This commit is contained in:
@@ -105,7 +105,7 @@ endfunction()
|
|||||||
# add_gtest(example_test)
|
# add_gtest(example_test)
|
||||||
|
|
||||||
# param_test
|
# param_test
|
||||||
add_executable(param_test param_test.cpp uorb_stub.cpp
|
add_executable(param_test setup.cpp param_test.cpp uorb_stub.cpp
|
||||||
${PX4_SRC}/modules/systemlib/bson/tinybson.c
|
${PX4_SRC}/modules/systemlib/bson/tinybson.c
|
||||||
${PX4_SRC}/modules/systemlib/param/param.c)
|
${PX4_SRC}/modules/systemlib/param/param.c)
|
||||||
target_link_libraries(param_test ${PX4_PLATFORM})
|
target_link_libraries(param_test ${PX4_PLATFORM})
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
|
||||||
|
class TestEnvironment: public ::testing::Environment {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Testing setup: this is called before the actual tests are executed.
|
||||||
|
*/
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
param_init();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
// gtest takes ownership of the TestEnvironment ptr - we don't delete it.
|
||||||
|
::testing::AddGlobalTestEnvironment(new TestEnvironment);
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user