Creating the Most Basic Unit Test for CTest

Let's learn how to add a simple test.

We'll cover the following

Writing unit tests is technically possible without any kind of framework. All we have to do is create an instance of the class we want to test, execute one of its methods, and check if the new state or value returned meets our expectations. Then, we report the result and delete the object under test.


Let's try it out. We'll use the following structure:

Get hands-on with 1200+ tech skills courses.