From e8c38690933758f3b514218d35caf6118e15c6be Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 23 Oct 2022 02:37:57 -0500 Subject: [PATCH] Include support for a test suite Co-authored-by: sigonasr2 --- C++/scripts/build.sh | 14 +++++++++++--- C++/scripts/md5 | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) 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 -