Skip to content

Commit 8688af4

Browse files
committed
ADD-TEMP: temporary documentation for testing
1 parent efb10e0 commit 8688af4

File tree

1 file changed

+5
-37
lines changed

1 file changed

+5
-37
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -320,43 +320,11 @@ dfVisualizerPtr->Run();
320320

321321

322322
### CTesting (TO BE UPDATED)
323-
When necessary, c++ testing is done by using CTest. Important/critical features (e.g., correcting functioning of graphics with OpenGL and Glfw) needs testing to be written (this is usefull for e.g., GitHub Actions). Such tests can be extracted from the main source code and integrated in a seperate section: cmake testing.
323+
Tests in df are all `.cc` files added to the `tests` source files, all the data needs to be contained in `tests/test_data`. Finally add your `.cc` files in the cmake:
324324

325-
To add a new test do as follow.
325+
https://github.com/diffCheckOrg/diffCheck/blob/efb10e0b5685a1ef1537d0309388f642075d3244/CMakeLists.txt#L170-L173
326326

327-
First create a new sub-folder in the folder `./test` as `./test/exampletest`.
328-
Here add a console cpp file called `tester.cpp` which returns 0 or 1 and add a new `CMakeLists.txt` as such:
329-
```cmake
330-
add_executable(example_test tester.cpp)
331-
332-
/* <--
333-
Insert here linking necessary for the executable
334-
Note that if you already found packages in the head CMakeLists file
335-
you can simply use the macros here.
336-
--> */
337-
338-
add_test(NAME "ExampleTest" COMMAND "example_test" <argv-here> WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
339-
```
340-
In the `./test`'s `CMakeLists.txt` add the created sub-directory:
341-
```cmake
342-
if (TEST_EXAMPLE)
343-
add_subdirectory(exampletest)
344-
endif()
345-
```
346-
Finally add an option in the main `CMakeLists.txt` describing the test:
347-
```cmake
348-
include(CTest)
349-
# ...
350-
option(TEST_EXAMPLE "Test to test something important." ON)
351-
# ...
352-
if(TEST_EXAMPLE)
353-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/exampletest)
354-
endif()
355-
```
356-
357-
Next, `./configure.sh -c` and `./build.sh` and:
358-
```bash
359-
cd ./build
360-
ctest -N # <--- to see how many tests there are
361-
ctest -V # <--- run the tests
327+
To run the tests from terminal
362328
```
329+
ctest --test-dir .\build\ -C Release -V
330+
```

0 commit comments

Comments
 (0)