Using Code Coverage to Find Untested Code

During the code coverage review, you surely noticed a fair amount of untested code. For this tutorial, you will focus on one particular section.

To select a particular section of code:

  1. First, select the menu item File->Save Project

  2. If necessary, select the Code Coverage tab.

  3. In the Report Window on the left-hand side of the screen, open the UmtsCode.c node and then left-click the code_int() function

This function contains two partially covered while statements - focus on the second while statement (you may need to scroll down a bit):

 while (x!=0)

A left-click on the while statement shows you that of the three possible types of coverage, only one type was achieved - 2 or more loops. You should really create one or more tests to appropriately cover this while statement - but first, perhaps you should spend a little more time understanding what the code_int function does.