In this exercise, you extend and automate the unit tests of the SideMade code, on which we worked during the lecture.
Deadline: Thursday, February 9th, 2023, 09:00
- Import the testing boost exercise repository in your own account/namespace on GitHub and name it
testing-boost-exercise
again. Note: We cannot work with forks here because GitHub Actions may not work in pull requests without explicit approval of the owner of the target repository - Create a new branch
extend-tests
frommain
and work in this branch. - To submit, open a PR from
extend-tests
tomain
in your own repository. Then paste a link to this PR in a new issue in the original repository. Use[GITLAB-USERNAME] Boost test exercise
as title of the issue.
- Following similar style and structure as in the lecture, implement a simple unit test for the function
matrixIO::openData
.
- Similar to last week, add a GitHub Action workflow with three jobs:
- Style: Check whether all
cpp
andhpp
files (insrc
andtests
are formatted correctly usingclang-format
(seeREADME.md
). - Build: Check whether the code builds successfully.
- Test: Check whether all tests run successfully.
- Style: Check whether all
- Add a corresponding GitHub workflow status badge to the
README.md
.
- Extend the automation with a build matrix. Test whether your code builds in Debug and in Release mode, and with the gcc and the clang compiler. Make use of CMake variables to modify these parameters.
- When importing a project on GitHub, it could be that by default actions are disabled. You can enable them via
Settings -> Actions -> General -> Allow all actions
. - Be careful: the style job should not format the code, but rather report whether the code was formatted correctly or not. There are different ways how to do this. You could use the option
--dry-run
, but then you still need to interpret warnings as errors with-Werror
. Or you could format inplace (-i
) and usegit diff
. - Try to use the build from the build job for the tests in the test job by uploading and downloading the build as an artifact. Problem is that this way file permissions are not preserved. You can work around this problem, by archiving. See the official workaround.