From 8db6ee54bc3ba451ae3fa98b6948d4c1cc6816b4 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Thu, 22 May 2025 16:37:31 -0700 Subject: [PATCH 1/7] removed old define reference. --- otto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otto.sh b/otto.sh index 7bb26c3..1f9f8f4 100755 --- a/otto.sh +++ b/otto.sh @@ -177,7 +177,7 @@ cross_compile () { build_release() { clear_cmake_cache - cmake -DCAM_HANDLER_LIB=ON -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../ + cmake -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../ make } From b3d33c2db92a1a238a09f01707052ff24cf86217 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sat, 21 Jun 2025 12:39:11 -0700 Subject: [PATCH 2/7] removed the problamatic directory from issue #17 --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1b9750..60549b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ if (UNIT_TESTING) include_directories( ${CPPUTEST_INCLUDE_DIRS} - /usr/include/c++/11/ ./inc ./mocks ) From f047a886290a40303ea58688d2f058583591e234 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sat, 21 Jun 2025 12:52:30 -0700 Subject: [PATCH 3/7] Added lanuage selection menu and functions for the `add new module` option in the main menu. --- otto.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/otto.sh b/otto.sh index 1f9f8f4..8b23294 100755 --- a/otto.sh +++ b/otto.sh @@ -117,6 +117,7 @@ git_remove_module () { add_new_module () { + read -p "Enter the name of the module:" modname result=$(does_module_exist "$modname") @@ -137,7 +138,35 @@ add_new_module () { #copy the template files. echo "copying & customizing template files..." - + + echo "Select an option:" + echo "1.) Add a C module" + echo "2.) Add a C++ module" + + read -P "choice:" lanuage_selection + + case $lanuage_selection in + 1) + echo "You selected Option 1" + add_c_mdoule + ;; + 2) + echo "You selected Option 2" + add_cpp_module + ;; + *) + echo "Invalid Choice!\nExiting..." + ;; + esac + + # Now we add the new files to the git tracked files + git_add_module "${modname}" + + +} + +add_c_mdoule () { + sed "s/module_name/${modname}/" $MODULE_DIR/module_name.c > $modsrc_dir/${modname}.c sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.c @@ -155,13 +184,30 @@ add_new_module () { echo "Resulting files/dirs:" tree -L 2 $modsrc_dir tree -L 2 $modtest_dir - - # Now we add the new files to the git tracked files - git_add_module "${modname}" - } +add_cpp_module () { + + sed "s/module_name/${modname}/" $MODULE_DIR/module_name.cpp > $modsrc_dir/${modname}.cpp + sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.cpp + + sed "s/module_name/${modname_cap}/" $MODULE_DIR/module_name.h > $modsrc_dir/${modname}.h + sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.h + + sed "s/module_name/${modname}/" $MODULE_DIR/CMakeLists.txt > $modsrc_dir/CMakeLists.txt + + sed "s/module_name/${modname}/" $MODULE_DIR/test_module_name.cpp > $modtest_dir/test_${modname}.cpp + sed "s/module_name/${modname}/" $MODULE_DIR/TestCMakeLists.txt > $modtest_dir/CMakeLists.txt + + # Add the module to the cmake lists files. + add_module_to_cmakes "${modname}" + + echo "Resulting files/dirs:" + tree -L 2 $modsrc_dir + tree -L 2 $modtest_dir + +} del_module () { read -p "Enter the name of the module:" modname From 593edd59f14932162f5c4451c95238fb7e5186bc Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sat, 21 Jun 2025 14:18:04 -0700 Subject: [PATCH 4/7] Added CPP template file --- .template_files/modules/module_name.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .template_files/modules/module_name.cpp diff --git a/.template_files/modules/module_name.cpp b/.template_files/modules/module_name.cpp new file mode 100644 index 0000000..16fcd81 --- /dev/null +++ b/.template_files/modules/module_name.cpp @@ -0,0 +1,16 @@ +/* + * 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; +} From 487040e99b4c8d22923e1e6cadf6acb8238b6e70 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sat, 21 Jun 2025 14:18:15 -0700 Subject: [PATCH 5/7] changed to automatically allow regex of test group name. --- .template_files/modules/test_module_name.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.template_files/modules/test_module_name.cpp b/.template_files/modules/test_module_name.cpp index d06f275..82c2303 100644 --- a/.template_files/modules/test_module_name.cpp +++ b/.template_files/modules/test_module_name.cpp @@ -12,7 +12,7 @@ extern "C" #include "module_name.h" } -TEST_GROUP(FirstTestGroup) +TEST_GROUP(test_module_name) { void setup() { @@ -24,12 +24,12 @@ TEST_GROUP(FirstTestGroup) } }; -TEST(FirstTestGroup, FirstTest) +TEST(test_module_name, FirstTest) { FAIL("Fail me!"); } -TEST(FirstTestGroup, SecondTest) +TEST(test_module_name, SecondTest) { STRCMP_EQUAL("hello", "world"); LONGS_EQUAL(1, 2); From a7665dab798131da3bfd6355b3322a7ed4f4ee12 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Wed, 25 Jun 2025 16:09:35 -0700 Subject: [PATCH 6/7] Added compile definition for usage in source files and headers. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60549b1..32b3181 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,9 @@ set(CMAKE_CXX_FLAGS "-Wall -Werror -Wpedantic") if (UNIT_TESTING) - + + #Allows usage of preprossor stuff in your files. + add_compile_definitions(UNIT_TESTING=1) if(DEFINED ENV{CPPUTEST_HOME}) message(STATUS "Using CppUTest home: $ENV{CPPUTEST_HOME}") set(CPPUTEST_INCLUDE_DIRS $ENV{CPPUTEST_HOME}/include) From bca04c8ca03117fc6a971b4e7d83d600e9fc16ee Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Thu, 26 Jun 2025 20:42:11 -0700 Subject: [PATCH 7/7] Added verbose tests and color for test output. --- otto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otto.sh b/otto.sh index 8b23294..acf7fef 100755 --- a/otto.sh +++ b/otto.sh @@ -238,7 +238,7 @@ run_c_tests () { format_source_code clear_cmake_cache cmake -DUNIT_TESTING=ON -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../ - make AllTests && ./tests/AllTests + make AllTests && ./tests/AllTests -v -c } print_menu () {