Unit testing C++ applications

Previously, we saw the .NET-based Unit testing .NET applications recipe in Chapter 4, .NET Framework Development, but C++ developers have not been forgotten, and VS2015 includes built-in support for unit testing with CppUnit.

C++ developers can choose from several types of unit test projects, including the Native Unit Test Project, the Managed Unit Test Project, and the Unit Test App (Universal Windows) project. The first applies exclusively to desktop C++ development, the second applies exclusively to managed (C++/CX) code, and the third is for UWP-based apps.

In this recipe, we'll create a simple piece of code, and add some unit tests to it, which take advantage of the Native Unit Test Project.

Getting ready

Simply ...

Get Visual Studio 2015 Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.