CoverageStartRecordingData Example

Visual C++

#include <windows.h>

#include <stdio.h>

#include "pure.h"

 

void main()

{

   int x;

   CoverageStopRecordingData();

 

   //The preceding line causes PureCoverage to stop recording
   //coverage data.

 

   printf("'0' indicates PureCoverage has stopped recording all \

   coverage data: %d\n", x=CoverageIsRecordingData());

 

   //The preceding line causes a "0" to be printed, verifying
   //that PureCoverage has changed the recording state and,
   //in this case, is no longer recording data.

 

   InputFunctionA();

   printf("'1' indicates PureCoverage is again recording all coverage \

   data: %d\n", x=CoverageStartRecordingData());

 

   //The preceding line starts the recording of coverage data
   //and also prints out the value the function returns, as
   //verification that the recording state has changed.

 

   ComputationFunctionB();

   ComputationFunctionC();

   OutputFunctionD();

 

}

Visual Basic

Dim status As Integer

...

 

Private Sub Form_Load()

 

   If CoverageIsRunning() = 1 Then

      status = CoverageStartRecordingData()

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

      If CoverageIsRecordingData() = 1 Then

         MsgBox "PureCoverage started recording"

      End If

 

      status = CoverageStopRecordingData()

      If status = 1 Then

         MsgBox "PureCoverage stopped recording data"

      End If

   End If

 

End Sub

(C) Copyright IBM Corporation 1993, 2010.