Added template test module
This commit is contained in:
parent
4e6be91ac3
commit
1ebd68346e
5 changed files with 61 additions and 0 deletions
23
.template_files/test_module/CMakeLists.txt
Normal file
23
.template_files/test_module/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# File: tests/module_name/CMakeLists.txt
|
||||||
|
|
||||||
|
add_subdirectory(mocks)
|
||||||
|
add_subdirectory(fakes)
|
||||||
|
add_subdirectory(stubs)
|
||||||
|
|
||||||
|
# TEST_RUNNER
|
||||||
|
add_library(test_module_name
|
||||||
|
test_module_name.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(test_module_name
|
||||||
|
${CPPUTEST_LIBRARIES}
|
||||||
|
module_name
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(test_module_name PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
#Next comes the shared and non-module specific test depencencies.
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/shared/mocks/
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/shared/fakes/
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/shared/stubs/
|
||||||
|
)
|
||||||
0
.template_files/test_module/fakes/CMakeLists.txt
Normal file
0
.template_files/test_module/fakes/CMakeLists.txt
Normal file
0
.template_files/test_module/mocks/CMakeLists.txt
Normal file
0
.template_files/test_module/mocks/CMakeLists.txt
Normal file
0
.template_files/test_module/stubs/CMakeLists.txt
Normal file
0
.template_files/test_module/stubs/CMakeLists.txt
Normal file
38
.template_files/test_module/test_module_name.cpp
Normal file
38
.template_files/test_module/test_module_name.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Author: username
|
||||||
|
* Date: todays_date
|
||||||
|
* filename: test_module_name.c
|
||||||
|
* description: module_purpose
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "module_name.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_GROUP(FirstTestGroup)
|
||||||
|
{
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(FirstTestGroup, FirstTest)
|
||||||
|
{
|
||||||
|
FAIL("Fail me!");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(FirstTestGroup, SecondTest)
|
||||||
|
{
|
||||||
|
STRCMP_EQUAL("hello", "world");
|
||||||
|
LONGS_EQUAL(1, 2);
|
||||||
|
CHECK(false);
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue