Chapter 23Unit Test

DOI: 10.1201/9781003257981-23

Testing is an essential part of software development. Testing can be classified into unit test and integration test. A unit test may test a function, a structure, or a file. An integration test, as the name suggests, tests when multiple units are put together. This chapter explains how to develop unit tests using the GoogleTest framework. The examples use rational numbers.

23.1 Google Test Framework

Before we explain how to use the Google Test framework, please ensure that you have the tools installed using this command on Linux:

Google Test is designed for C++, not C. The program's extension is .cpp for C++, not .c for C. This chapter writes unit tests ...

Get Intermediate C Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.