You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project includes automated tests written using a main program rather than using a unit testing framework. Here's how to build and run these tests.
Clean before you start
Run make clean when switching to make the project and make the tests otherwise the make will fail either because there are multiple main functions available to the linker, or none.
make clean && make test to make the tests
make clean && make to make the program after making the tests
** More info**
A compilation flag of NO_MAIN is defined when the tests are compiled. When the project is clean the program's main is excluded and a separate one used for testing is included during the make process. If the make target changes between test and not building the tests then there is no dependency that causes the program's main to be recompiled with the current value of the compilation flag/without the compilation flag. Running the clean removes the object files for any main and means the next make command performs as intended.
Running the tests
Currently when make test runs it actually runs the tests silently and deletes the test program it created. If you'd like to see the tests run and/or capture a log of the test run, one way is to edit the Makefile along the following lines:
# Create a temporary folder for the output
mkdir tests/logs
# Edit the test target in the main Makefile to redirect the output of running the main generated to run the tests
cd tests/ && $(MAKE) && ./main > ./logs/tests.log && $(MAKE) clean
Note: the main program is still deleted as the final step in this make process, remove the final && $(MAKE) clean if you'd like to run the tests again afterwards.
The text was updated successfully, but these errors were encountered:
Context
This project includes automated tests written using a
main
program rather than using a unit testing framework. Here's how to build and run these tests.Clean before you start
Run
make clean
when switching to make the project and make the tests otherwise the make will fail either because there are multiplemain
functions available to the linker, or none.make clean && make test
to make the testsmake clean && make
to make the program after making the tests** More info**
A compilation flag of
NO_MAIN
is defined when the tests are compiled. When the project is clean the program's main is excluded and a separate one used for testing is included during the make process. If the make target changes betweentest
and not building the tests then there is no dependency that causes the program's main to be recompiled with the current value of the compilation flag/without the compilation flag. Running theclean
removes the object files for anymain
and means the next make command performs as intended.Running the tests
Currently when
make test
runs it actually runs the tests silently and deletes the test program it created. If you'd like to see the tests run and/or capture a log of the test run, one way is to edit theMakefile
along the following lines:Note: the
main
program is still deleted as the final step in this make process, remove the final&& $(MAKE) clean
if you'd like to run the tests again afterwards.The text was updated successfully, but these errors were encountered: