From 5827bcb8a6c5cf43be54f9a22a973230eeff3a78 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 23 Oct 2022 02:47:09 -0500 Subject: [PATCH] Test suite setup preparation Co-authored-by: sigonasr2 --- C++/scripts/build.sh | 14 +++++++++++--- C++/scripts/md5 | 2 +- C++ProjectTemplate | Bin 1666728 -> 1666728 bytes main.cpp | 3 +++ test/test.cpp | 30 ++++++++++++++++++++++++++++++ test/test.h | 1 + 6 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 test/test.cpp create mode 100644 test/test.h diff --git a/C++/scripts/build.sh b/C++/scripts/build.sh index 0656a8a..29e31cc 100755 --- a/C++/scripts/build.sh +++ b/C++/scripts/build.sh @@ -1,7 +1,15 @@ -#Compiles the entire program then runs it, producing an executable. +#Compiles the entire program then runs it, producing an executable. If the "test" argument is included, will try and run tests too (in the test folder) #C++ printf "Running program...\n\n\n" -if g++ $(find . -type f -name "*.cpp") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then - ./${PROJECT_NAME} "$@" +if [ "$1" = "test" ] +then + printf "Running tests...\n" + if g++ $(find . -type f -name "*.cpp") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then + ./${PROJECT_NAME} "$@" + fi +else + if g++ $(find . -type f -name "*.cpp" -not -path "./test/*") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then + ./${PROJECT_NAME} "$@" + fi fi printf "\n\n" diff --git a/C++/scripts/md5 b/C++/scripts/md5 index add9549..0dfebb2 100644 --- a/C++/scripts/md5 +++ b/C++/scripts/md5 @@ -1,4 +1,4 @@ -build.sh:530634457ea9041267c05d4ced95eee1 - +build.sh:ca58f10d4e30d807987ea0105930ae51 - commit.sh:d03a46e721060c22ccb146e19d27e70a - debug.sh:abbbb0c6d9f2409f3a90738ab3d9d44f - lines.sh:3b907786f7fc9204025993016c9080de - diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 4eb80bc271368a86659e2e4fda2b21eb7e691c95..78873d0492cbdec0d041798be2481b60b5f83ae4 100755 GIT binary patch delta 139 zcmZ2+H+99`)D0EPB64zVFP~RjIoQqme}$C1)#}2>?kvqc%WAQl5+ M@$G_T64QSG0Qa&k(f|Me delta 139 zcmZ2+H+99`)D0EPA_)q)E2dBWbXQ*~wCIM&yT6vM)km6pnA>}p8G)Dyh(T-?AZFd( z!_3xF#8}iWSjGm#>_E%`#GF9P1;pGy%mc){K+Ffk{6H)K#DYL91jNEXECR%$Kr9Bt M;@btwB&PoW06VoWcmMzZ diff --git a/main.cpp b/main.cpp index d81e1b8..f69404b 100644 --- a/main.cpp +++ b/main.cpp @@ -19,6 +19,7 @@ #include "particle.h" #include "effect.h" #include "battleproperty.h" +//#include "test/test.h" using namespace olc; @@ -4877,6 +4878,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } }; +#ifndef TEST_SUITE int main() { SeasonI demo; @@ -4885,3 +4887,4 @@ int main() return 0; } +#endif \ No newline at end of file diff --git a/test/test.cpp b/test/test.cpp new file mode 100644 index 0000000..8db097d --- /dev/null +++ b/test/test.cpp @@ -0,0 +1,30 @@ +#include "../entity.h" +#include "../item.h" +#include "../layers.h" +#include +#define OLC_PGE_APPLICATION +#include "../pixelGameEngine.h" +#define OLC_PGEX_SPLASHSCREEN +#include "../splash.h" +#define OLC_SOUNDWAVE +#include "../defines.h" +#include "../soundwaveEngine.h" +#include "../tiles.h" +#include "../references.h" +#include "../states.h" +#include "../flags.h" +#include +#include "../cutscene.h" +#include "../encounters.h" +#include "../particle.h" +#include "../effect.h" +#include "../battleproperty.h" +#include "test.h" + +int main() { + SeasonI demo; + if (demo.Construct(WIDTH, HEIGHT, 4, 4)) + demo.Start(); + + return 0; +} \ No newline at end of file diff --git a/test/test.h b/test/test.h new file mode 100644 index 0000000..5b0f898 --- /dev/null +++ b/test/test.h @@ -0,0 +1 @@ +#define TEST_SUITE \ No newline at end of file