There are several unit test frameworks for C/C++ but we will take a look at Google Test.
First you will need to download and build it. It’s available here.
Follow the instructions how to build it for your platform (for Windows I used Visual Studio to build it. The solution is located at googletest-master\googletest\msvc\2010 folder).
Now download small project I created to give it a try – GoogleTestTest.
It has windows oriented makefile, so follow my instructions how to build it here.
I put GoogleTest in C:\Projects folder, so either follow me, or you will need to edit makefile and change include and lib folders location.
To build test project run
nmake
To run test project run (but it would produce no output)
main.exe
To run unit test run
main_test.exe
Here is what you should get: