updated root template dir files.
This commit is contained in:
parent
491b35c00d
commit
e34b4f47bd
5 changed files with 66 additions and 29 deletions
|
|
@ -1,7 +1,42 @@
|
||||||
|
# File: src/module_name/CMakeLists.txt
|
||||||
add_library(module_name STATIC
|
add_library(module_name STATIC
|
||||||
module_name.c
|
module_name.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Current list dir: The directory where the cmake config file is.
|
||||||
|
# Source Dir: The dir where the root/main cmake config file is.
|
||||||
|
|
||||||
|
if(NOT UNIT_TESTING)
|
||||||
target_include_directories(module_name PUBLIC
|
target_include_directories(module_name PUBLIC
|
||||||
${CMAKE_CURRENT_LIST_DIR}
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/inc/
|
||||||
)
|
)
|
||||||
|
target_link_libraries(module_name
|
||||||
|
RegEdit
|
||||||
|
)
|
||||||
|
|
||||||
|
#These get defined in the toolchain files.
|
||||||
|
target_compile_options(module_name PUBLIC
|
||||||
|
${OBJECT_GEN_FLAGS}
|
||||||
|
${C_FLAGS_ARCH}
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
target_include_directories(module_name PUBLIC
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
#First we include any module specific test dependencies.
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/module_name/mocks/
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/module_name/fakes/
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/module_name/stubs/
|
||||||
|
#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/
|
||||||
|
#Finally we include the local stuff, which has likely been overridden.
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
#Place Mocked/Regular dependencies here for unit testing.
|
||||||
|
target_link_libraries(module_name
|
||||||
|
MockRegEdit
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "module_name.h"
|
#include "module_name.h"
|
||||||
|
#include "RegEdit.h"
|
||||||
|
|
||||||
// dumb test function
|
// dumb test function
|
||||||
int add_two(int a)
|
int add_two(int a)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
* Author: username
|
|
||||||
* Date: todays_date
|
|
||||||
* filename: module_name.cpp
|
|
||||||
* description: module_purpose
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "module_name.h"
|
|
||||||
|
|
||||||
// dumb test function
|
|
||||||
int add_two(int a)
|
|
||||||
{
|
|
||||||
int b = a;
|
|
||||||
b += 2;
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +1,31 @@
|
||||||
/*
|
/**
|
||||||
|
* @brief Module description
|
||||||
|
* @details This file is an <Purpose here>
|
||||||
|
* @author Jake G
|
||||||
|
* @date todays_date
|
||||||
|
* @copyright None
|
||||||
* @file module_name.h
|
* @file module_name.h
|
||||||
* @Author Jake Goodwin
|
|
||||||
* @Date todays_date
|
|
||||||
* @brief module_purpose
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef module_name
|
//#pragma once
|
||||||
#define module_name
|
#ifndef module_name_H
|
||||||
|
#define module_name_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
int add_two(int a);
|
int add_two(int a);
|
||||||
|
|
||||||
#endif //module_name
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif //module_name_H
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ extern "C"
|
||||||
#include "module_name.h"
|
#include "module_name.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_GROUP(test_module_name)
|
TEST_GROUP(FirstTestGroup)
|
||||||
{
|
{
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
|
@ -24,12 +24,12 @@ TEST_GROUP(test_module_name)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(test_module_name, FirstTest)
|
TEST(FirstTestGroup, FirstTest)
|
||||||
{
|
{
|
||||||
FAIL("Fail me!");
|
FAIL("Fail me!");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_module_name, SecondTest)
|
TEST(FirstTestGroup, SecondTest)
|
||||||
{
|
{
|
||||||
STRCMP_EQUAL("hello", "world");
|
STRCMP_EQUAL("hello", "world");
|
||||||
LONGS_EQUAL(1, 2);
|
LONGS_EQUAL(1, 2);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue