When contributing to Alya, you'll have to add tests to ensure that the features you added or modified do not impact negatively the code behavior and to avoid regressions. For specific functionalities unity tests are an appropriate option. By running the command make tes
all the unity tests will be executed. Note that unity tests should not be expensive in terms of computing or memory resources.
Alya unity tests structure
Tests are located in alya/unitt
directory. You will find several subdirectories containing different unity tests.
Create the new test
Create a new directory for your test. We will name this folder unitt_test_name
mkdir unitt_test_name
Add the file with the unity test code. You will take care of keeping the same name for the test directory and the files contained within (see existing examples).
In this folder add also the file "CMakeLists.txt" that you can find within the other unity tests folder, without changing any thing from this file.
In the root folder that contains all the tests, edit the file "CMakeLists.txt" add your subdirectory:
add_subdirectory(unitt_test_name)
Add and commit the files
Add and commit the files that are required to run your test. Do not commit any file that is generated during the execution nor any file that is not necessary to run the test.
Run the unity test
In your build directory, run the command:
make test