Unit tests with PR #2267

Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unit tests with PR #2267

dxli
Hi,

With https://github.com/LibreCAD/LibreCAD/pull/2267 , adding new unit tests is easier:

1. identify a cpp file for testing;
for example, librecad/src/lib/math/rs_math.cpp
2. create a folder named "tests" at the cpp location;
For example, librecad/src/lib/math/tests/
3. Add your tests in a file named with the suffix "_tests.cpp" in the tests folder;
For example, librecad/src/lib/math/tests/rs_math_tests.cpp
4. Add your tests following Catch2 styles;
5. Add your new _tests.cpp file to CMakeLists.txt in the project file folder;
6. Add the new file(s) and the CMakeLists.txt by "git add" and commit your changes.

Please note steps 1-3 are just a convention to follow, and feel free to use a convention better, if you feel have to.

Please note, AI can generate tests fast.