From 2e7a4ffa38f96ed664d8796456a79055ce6ff97a Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sun, 1 Sep 2024 12:28:26 -0700 Subject: [PATCH] Added in new module for Relays --- src/CMakeLists.txt | 1 + src/Relays/CMakeLists.txt | 7 +++++++ src/Relays/Relays.c | 16 +++++++++++++++ src/Relays/Relays.h | 20 +++++++++++++++++++ tests/AllTests.cpp | 2 +- tests/CMakeLists.txt | 2 ++ tests/Relays/CMakeLists.txt | 10 ++++++++++ tests/Relays/test_Relays.cpp | 38 ++++++++++++++++++++++++++++++++++++ 8 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/Relays/CMakeLists.txt create mode 100644 src/Relays/Relays.c create mode 100644 src/Relays/Relays.h create mode 100644 tests/Relays/CMakeLists.txt create mode 100644 tests/Relays/test_Relays.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b9989c8..a924980 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,3 +55,4 @@ add_subdirectory(usart) add_subdirectory(timer) add_subdirectory(SuperLoop) +add_subdirectory(Relays) diff --git a/src/Relays/CMakeLists.txt b/src/Relays/CMakeLists.txt new file mode 100644 index 0000000..75618c0 --- /dev/null +++ b/src/Relays/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(Relays STATIC + Relays.c +) + +target_include_directories(Relays PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) diff --git a/src/Relays/Relays.c b/src/Relays/Relays.c new file mode 100644 index 0000000..f432f9b --- /dev/null +++ b/src/Relays/Relays.c @@ -0,0 +1,16 @@ +/* + * Author: username + * Date: 2024 + * filename: Relays.c + * description: module_purpose + */ + +#include "Relays.h" + +// dumb test function +int add_two(int a) +{ + int b = a; + b += 2; + return b; +} diff --git a/src/Relays/Relays.h b/src/Relays/Relays.h new file mode 100644 index 0000000..3208bad --- /dev/null +++ b/src/Relays/Relays.h @@ -0,0 +1,20 @@ +/** + * @brief PUT_TEXT_HERE + * @details This file is... + * @author username + * @date todays_date + * @copyright None + * @file RELAYS.h + */ + +#ifndef RELAYS +#define RELAYS + + +/** + * A function that adds two to a number + * @param a The first argument + */ +int add_two(int a); + +#endif //RELAYS diff --git a/tests/AllTests.cpp b/tests/AllTests.cpp index 01b7c9e..ebfd952 100644 --- a/tests/AllTests.cpp +++ b/tests/AllTests.cpp @@ -4,8 +4,8 @@ //ImportTestGroups IMPORT_TEST_GROUP(simple_test); IMPORT_TEST_GROUP(test_SuperLoop); +IMPORT_TEST_GROUP(test_Relays); IMPORT_TEST_GROUP(test_RegEdit); -IMPORT_TEST_GROUP(test_LedController); //START: main diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3dd73e5..9a138fb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,7 @@ project(Tests) # TEST_DIRS +add_subdirectory(Relays) add_subdirectory(SuperLoop) #add_subdirectory(timer) #add_subdirectory(usart) @@ -22,6 +23,7 @@ target_link_libraries(AllTests ${CPPUTEST_LIBRARIES}/libCppUTest.a ${CPPUTEST_LIBRARIES}/libCppUTestExt.a # TEST_LINKS + test_Relays test_SuperLoop #test_timer diff --git a/tests/Relays/CMakeLists.txt b/tests/Relays/CMakeLists.txt new file mode 100644 index 0000000..fa28306 --- /dev/null +++ b/tests/Relays/CMakeLists.txt @@ -0,0 +1,10 @@ +# TEST_RUNNER +add_library(test_Relays + test_Relays.cpp +) + +target_link_libraries(test_Relays + ${CPPUTEST_LIBRARIES}/libCppUTest.a + ${CPPUTEST_LIBRARIES}/libCppUTestExt.a + Relays +) diff --git a/tests/Relays/test_Relays.cpp b/tests/Relays/test_Relays.cpp new file mode 100644 index 0000000..1d31000 --- /dev/null +++ b/tests/Relays/test_Relays.cpp @@ -0,0 +1,38 @@ +/* + * Author: username + * Date: todays_date + * filename: test_Relays.c + * description: module_purpose + */ + +#include "CppUTest/CommandLineTestRunner.h" + +extern "C" +{ +#include "Relays.h" +} + +TEST_GROUP(test_Relays) +{ + void setup() + { + + } + void teardown() + { + + } +}; + +TEST(test_Relays, FirstTest) +{ + FAIL("Fail me!"); +} + +TEST(test_Relays, SecondTest) +{ + STRCMP_EQUAL("hello", "world"); + LONGS_EQUAL(1, 2); + CHECK(false); +} +