Our great sponsors
-
Catch
A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
First of all, use a testing library, it makes life a lot easier. I mostly use https://github.com/catchorg/Catch2 You can pass cli args to specify which tests to run, and it makes things a whole lot simpler.
Some nice examples of basic CMake usage including how to set it up for unit tests: https://github.com/ttroy50/cmake-examples
For unit test library, besides Catch2, another big one is Google Test. No matter which you pick, be sure to read their documentation, tutorials, examples etc. They are not hard to figure out and get started with.
Related posts
- VCMI 1.2.0 released - Free & open-source engine for Heroes of Might and Magic 3
- How do you use the Catch testing library?
- Trying to add tests for my cmake for catch2 with ctest.
- Anyone else get frustrated when a block of time you wanted to spend to learning code instead goes into why some software isn’t working right on your computer?
- CPM.cmake to make CMake's FetchContent easier