Updated source and test code to run the SuperLoop tests

This commit is contained in:
jakeg00dwin 2024-09-01 09:31:02 -07:00
parent 9447b32d5a
commit 2567e752fc
9 changed files with 95 additions and 0 deletions

View File

@ -4,6 +4,7 @@ add_executable(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
RegEdit
SuperLoop
timer
LedController
)
@ -53,3 +54,4 @@ add_subdirectory(RegEdit)
add_subdirectory(usart)
add_subdirectory(timer)
add_subdirectory(LedController)
add_subdirectory(SuperLoop)

View File

@ -0,0 +1,7 @@
add_library(SuperLoop STATIC
SuperLoop.c
)
target_include_directories(SuperLoop PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)

15
src/SuperLoop/SuperLoop.c Normal file
View File

@ -0,0 +1,15 @@
/*
* Author: username
* Date: 2024
* filename: SuperLoop.c
* description: module_purpose
*/
#include "SuperLoop.h"
// dumb test function
int add_two(int a) {
int b = a;
b += 2;
return b;
}

19
src/SuperLoop/SuperLoop.h Normal file
View File

@ -0,0 +1,19 @@
/**
* @brief PUT_TEXT_HERE
* @details This file is...
* @author username
* @date todays_date
* @copyright None
* @file SUPERLOOP.h
*/
#ifndef SUPERLOOP
#define SUPERLOOP
/**
* A function that adds two to a number
* @param a The first argument
*/
int add_two(int a);
#endif // SUPERLOOP

View File

@ -17,6 +17,7 @@
#include "LedController.h"
#include "RegEdit.h"
#include "SuperLoop.h"
#include "config.h"
#include "timer.h"
#include <avr/cpufunc.h> /* Required header file */

View File

@ -3,6 +3,7 @@
//ImportTestGroups
IMPORT_TEST_GROUP(simple_test);
IMPORT_TEST_GROUP(test_SuperLoop);
IMPORT_TEST_GROUP(test_RegEdit);
IMPORT_TEST_GROUP(test_LedController);

View File

@ -1,6 +1,7 @@
project(Tests)
# TEST_DIRS
add_subdirectory(SuperLoop)
#add_subdirectory(timer)
#add_subdirectory(usart)
add_subdirectory(MockRegEdit)
@ -21,6 +22,7 @@ target_link_libraries(AllTests
${CPPUTEST_LIBRARIES}/libCppUTest.a
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
# TEST_LINKS
test_SuperLoop
test_LedController
#test_timer
test_RegEdit

View File

@ -0,0 +1,10 @@
# TEST_RUNNER
add_library(test_SuperLoop
test_SuperLoop.cpp
)
target_link_libraries(test_SuperLoop
${CPPUTEST_LIBRARIES}/libCppUTest.a
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
SuperLoop
)

View File

@ -0,0 +1,38 @@
/*
* Author: Jake G
* Date: 2024-09-01
* filename: test_SuperLoop.c
* description: module_purpose
*/
#include "CppUTest/CommandLineTestRunner.h"
extern "C"
{
#include "SuperLoop.h"
}
TEST_GROUP(test_SuperLoop)
{
void setup()
{
}
void teardown()
{
}
};
TEST(test_SuperLoop, FirstTest)
{
FAIL("Fail me!");
}
TEST(test_SuperLoop, SecondTest)
{
STRCMP_EQUAL("hello", "world");
LONGS_EQUAL(1, 2);
CHECK(false);
}