CoverageSaveData Example

Visual C++

#include <windows.h>

#include <stdio.h>

#include "pure.h"

 

void main()

{

   

   int x;

   InputFunctionA();

   CoverageClearData();

   ComputationFunctionB();

   CoverageSaveData();

 

   //The preceding function takes a snapshot of the coverage data
   //collected for ComputationFunctionB. The data collected for
   //the startup phase of the program was discarded before
   //ComputationFunctionB was called.

 

   CoverageClearData();

   ComputationFunctionC();

   CoverageSaveData();

 

   //The preceding function takes a snapshot of the coverage data
   //collected for ComputationFunctionC.

 

   CoverageDisableRecordingData();

 

   //The preceding function disables recording of
   //coverage data for the rest of the run.

 

   OutputFunctionD(int);

 

}

Visual Basic

Dim status As Integer

...

 

Private Sub Form_Load()

 

   If CoverageIsRunning() = 1 Then

 

      status = CoverageSaveData()

      Text1.Text = Text1.Text & "CoverageSaveData = " & retCode & vbCrLf

      If status = 1 Then

         MsgBox "PureCoverage saved the data"

      End If

      Call msgroutine

      status = CoverageClearData()

      If status = 1 Then

         MsgBox "PureCoverage cleared recorded data"

      End If

      status = CoverageDisableRecordingData()

      If status = 1 Then

         MsgBox " Recording is disabled"

      End If

 

   End If

 

End Sub

(C) Copyright IBM Corporation 1993, 2010.