Visual C++
#include <windows.h>
#include <stdio.h>
#include "pure.h"
void main()
{
CoverageAddAnnotation ("This set of coverage data was collected"
"from the PureCov API enabled test build on 11/10/98. No coverage data"
"was collected for the entire initialization sequence.");
}
Visual Basic
Dim Annotation As String
Dim status As Integer
...
Text1.Text = Text1.Text & "CoverageAddAnnotation = " & status & vbCrLf
If CoverageIsRunning() = 1 Then
Do
Annotation = "Coverage data from 11/10/98 PureCov API enabled test build."
status = CoverageAddAnnotation(ByVal Annotation)
If (status <> 1) Then
status = 0
Exit Do
End If
Exit Do
Loop
End If
Java
import java.util.*;
import com.Rational.Coverage;
public class example {
public static void main(String argv[]) {
Date hCurrentTime = new Date();
String lpszMessage = "Custom PureCov annotation";
String lpszAnnotation = lpszMessage + ": " + hCurrentTime;
int iAnnotated = Coverage.addAnnotation(lpszAnnotation);
if (iAnnotated == 1)
System.out.println(lpszMessage + " added @ " + hCurrentTime);
else
System.out.println(lpszMessage + " not added @ " + hCurrentTime);
}
}
(C) Copyright IBM Corporation 1993, 2010.