xCover - Code Coverage for C and C++ STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... Synesis Software

xcover/xcover.h File Reference


Detailed Description

[C, C++] A C/C++ code coverage library.

#include <stlsoft/stlsoft.h>
#include <stdexcept>
#include <stdio.h>
#include <xcover/internal/reporter.h>

Go to the source code of this file.

Classes

struct  xcover_coverItem_t
 Structure used by reporters to indicate an uncovered mark. More...
class  xcover_initialiser
 Schwarz Counter class used to automatically initialise the library. More...

Defines

#define XCOVER_VER_MAJOR   0
 The Major version number of the xCover library.
#define XCOVER_VER_MINOR   2
 Minor version number of the xCover library.
#define XCOVER_VER_REVISION   1
 The revision number of the xCover library.
#define XCOVER_VER   0x000201ff
 The composite version of the xCover library.
#define XCOVER_MARK_FILE_START()   XCOVER_NS_QUAL(::xcover, xcover_markFileStart)(__FILE__, __LINE__, __FUNCTION__, __COUNTER__)
 Used to define the start of a file.
#define XCOVER_MARK_FILE_END()   XCOVER_NS_QUAL(::xcover, xcover_markFileEnd)(__FILE__, __LINE__, __FUNCTION__, __COUNTER__)
 Used to define the end of a file.
#define XCOVER_MARK_LINE()   XCOVER_NS_QUAL(::xcover, xcover_markLine)(__FILE__, __LINE__, __FUNCTION__, __COUNTER__)
 Used to mark a line.
#define XCOVER_CREATE_FILE_ALIAS(aliasName)   XCOVER_NS_QUAL(::xcover, xcover_createFileAlias)(__FILE__, __LINE__, aliasName)
 Creates a well-known alias for the file.
#define XCOVER_ASSOCIATE_FILE_WITH_GROUP(groupName)   XCOVER_NS_QUAL(::xcover, xcover_associateFileWithGroup)(__FILE__, __LINE__, groupName)
 Associates a file with a group.
#define XCOVER_START_GROUP_COVERAGE(groupName)   XCOVER_NS_QUAL(::xcover, xcover_startGroupCoverage)(__FILE__, __LINE__, groupName)
 Used to define the start of a group.
#define XCOVER_END_GROUP_COVERAGE(groupName)   XCOVER_NS_QUAL(::xcover, xcover_endGroupCoverage)(__FILE__, __LINE__, groupName)
 Used to define the end of a group.
#define XCOVER_REPORT_GROUP_COVERAGE(groupName, reporter)   XCOVER_NS_QUAL(::xcover, xcover_reportGroupCoverage)(__FILE__, __LINE__, groupName, reporter)
 Reports coverage for a group.
#define XCOVER_REPORT_FILE_COVERAGE(fileName, reporter)   XCOVER_NS_QUAL(::xcover, xcover_reportFileCoverage)(fileName, reporter)
 Reports coverage of a file.
#define XCOVER_REPORT_THIS_FILE_COVERAGE(reporter)   XCOVER_NS_QUAL(::xcover, xcover_reportFileCoverage)(__FILE__, reporter)
 Reports coverage of the current file.
#define XCOVER_REPORT_ALIAS_COVERAGE(aliasName, reporter)   XCOVER_NS_QUAL(::xcover, xcover_reportAliasCoverage)(aliasName, reporter)
 Reports coverage for an alias.

Enumerations

enum  xcover_rc_t {
  XCOVER_RC_SUCCESS = 0,
  XCOVER_RC_EXCEPTION = -1001,
  XCOVER_RC_OUT_OF_MEMORY,
  XCOVER_RC_UNEXPECTED,
  XCOVER_RC_GROUP_NOT_FOUND,
  XCOVER_RC_FILE_NOT_FOUND,
  XCOVER_RC_ALIAS_NOT_FOUND,
  XCOVER_RC_ALIAS_ALREADY_USED
}
 API function error code. More...

Functions

xcover_rc_t xcover_init (void)
 Initialises the xCover API.
void xcover_uninit (void)
 Uninitialises the xCover API.
xcover_rc_t xcover_createFileAlias (char const *fileName, int line, char const *aliasName)
 Create file alias.
xcover_rc_t xcover_associateFileWithGroup (char const *fileName, int line, char const *groupName)
 Associates the file with a group.
xcover_rc_t xcover_markFileStart (char const *fileName, int line, char const *function, int counter)
 Marks the start of a file.
xcover_rc_t xcover_markFileEnd (char const *fileName, int line, char const *function, int counter)
 Marks the end of a file.
xcover_rc_t xcover_markLine (char const *fileName, int line, char const *function, int counter)
 Marks a line for coverage.
xcover_rc_t xcover_startGroupCoverage (char const *fileName, int line, char const *groupName)
xcover_rc_t xcover_endGroupCoverage (char const *fileName, int line, char const *groupName)
xcover_rc_t xcover_reportGroupCoverage (char const *fileName, int line, char const *groupName, xcover_reporter_t *reporter)
 Reports coverage for all files in the group.
xcover_rc_t xcover_reportFileCoverage (char const *fileName, xcover_reporter_t *reporter)
 Reports coverage for a files.
xcover_rc_t xcover_reportAliasCoverage (char const *aliasName, xcover_reporter_t *reporter)
 Reports coverage for all files matching the alias.


Define Documentation

#define XCOVER_ASSOCIATE_FILE_WITH_GROUP ( groupName   )     XCOVER_NS_QUAL(::xcover, xcover_associateFileWithGroup)(__FILE__, __LINE__, groupName)

Associates a file with a group.

Parameters:
groupName The name of the group to which the file will be associated
Note:
This line must be executed at least once for file to be associated with the given group

#define XCOVER_CREATE_FILE_ALIAS ( aliasName   )     XCOVER_NS_QUAL(::xcover, xcover_createFileAlias)(__FILE__, __LINE__, aliasName)

Creates a well-known alias for the file.

Parameters:
aliasName The name for the alias
Note:
This line must be executed at least once for alias to be created

#define XCOVER_END_GROUP_COVERAGE ( groupName   )     XCOVER_NS_QUAL(::xcover, xcover_endGroupCoverage)(__FILE__, __LINE__, groupName)

Used to define the end of a group.

Any line marks after this point will not be reported

Note:
This line must be executed at least once for the end of the group to be marked

 
#define XCOVER_MARK_FILE_END (  )     XCOVER_NS_QUAL(::xcover, xcover_markFileEnd)(__FILE__, __LINE__, __FUNCTION__, __COUNTER__)

Used to define the end of a file.

Any line marks after this point will not be reported

Note:
This line must be executed at least once for the end of the file to be marked

 
#define XCOVER_MARK_FILE_START (  )     XCOVER_NS_QUAL(::xcover, xcover_markFileStart)(__FILE__, __LINE__, __FUNCTION__, __COUNTER__)

Used to define the start of a file.

Any line marks before this point will not be reported

Note:
This line must be executed at least once for the start of the file to be marked

 
#define XCOVER_MARK_LINE (  )     XCOVER_NS_QUAL(::xcover, xcover_markLine)(__FILE__, __LINE__, __FUNCTION__, __COUNTER__)

Used to mark a line.

#define XCOVER_REPORT_ALIAS_COVERAGE ( aliasName,
reporter   )     XCOVER_NS_QUAL(::xcover, xcover_reportAliasCoverage)(aliasName, reporter)

Reports coverage for an alias.

Parameters:
aliasName The name of the alias
reporter A pointer to a reporter instance. May be NULL

#define XCOVER_REPORT_FILE_COVERAGE ( fileName,
reporter   )     XCOVER_NS_QUAL(::xcover, xcover_reportFileCoverage)(fileName, reporter)

Reports coverage of a file.

Parameters:
fileName The name of the file, or a name that can match the file
reporter A pointer to a reporter instance. May be NULL

#define XCOVER_REPORT_GROUP_COVERAGE ( groupName,
reporter   )     XCOVER_NS_QUAL(::xcover, xcover_reportGroupCoverage)(__FILE__, __LINE__, groupName, reporter)

Reports coverage for a group.

Parameters:
groupName The name of the group
reporter A pointer to a reporter instance. May be NULL

#define XCOVER_REPORT_THIS_FILE_COVERAGE ( reporter   )     XCOVER_NS_QUAL(::xcover, xcover_reportFileCoverage)(__FILE__, reporter)

Reports coverage of the current file.

Parameters:
reporter A pointer to a reporter instance. May be NULL

#define XCOVER_START_GROUP_COVERAGE ( groupName   )     XCOVER_NS_QUAL(::xcover, xcover_startGroupCoverage)(__FILE__, __LINE__, groupName)

Used to define the start of a group.

Any line marks before this point will not be reported

Note:
This line must be executed at least once for the start of the group to be marked

#define XCOVER_VER   0x000201ff

The composite version of the xCover library.

#define XCOVER_VER_MAJOR   0

The Major version number of the xCover library.

#define XCOVER_VER_MINOR   2

Minor version number of the xCover library.

#define XCOVER_VER_REVISION   1

The revision number of the xCover library.


Enumeration Type Documentation

API function error code.

Enumerator:
XCOVER_RC_SUCCESS  The operation completed successfully An exception occurred
XCOVER_RC_EXCEPTION  Out of memory
XCOVER_RC_OUT_OF_MEMORY  An unexpected error occurred
XCOVER_RC_UNEXPECTED  The specified group does not exist
XCOVER_RC_GROUP_NOT_FOUND  The specified file does not exist
XCOVER_RC_FILE_NOT_FOUND  The specified alias does not exist
XCOVER_RC_ALIAS_NOT_FOUND  The specified alias is already used


Function Documentation

xcover_rc_t xcover_associateFileWithGroup ( char const *  fileName,
int  line,
char const *  groupName 
)

Associates the file with a group.

Parameters:
fileName The file name
line The line number
groupName The group name

xcover_rc_t xcover_createFileAlias ( char const *  fileName,
int  line,
char const *  aliasName 
)

Create file alias.

Parameters:
fileName The file name
line The line number
aliasName The alias name

xcover_rc_t xcover_endGroupCoverage ( char const *  fileName,
int  line,
char const *  groupName 
)

Parameters:
fileName The file name
line The line number
groupName The group name

xcover_rc_t xcover_init ( void   ) 

Initialises the xCover API.

Referenced by xcover_initialiser::xcover_initialiser().

xcover_rc_t xcover_markFileEnd ( char const *  fileName,
int  line,
char const *  function,
int  counter 
)

Marks the end of a file.

Parameters:
fileName The file name
line The line number
function The function name
counter The counter
Note:
any posterior markings, via xcover_markLine() (XCOVER_MARK_LINE()) will be discarded

xcover_rc_t xcover_markFileStart ( char const *  fileName,
int  line,
char const *  function,
int  counter 
)

Marks the start of a file.

Parameters:
fileName The file name
line The line number
function The function name
counter The counter
Note:
any prior markings, via xcover_markLine() (XCOVER_MARK_LINE()) will be discarded

xcover_rc_t xcover_markLine ( char const *  fileName,
int  line,
char const *  function,
int  counter 
)

Marks a line for coverage.

Parameters:
fileName The file name
line The line number
function The function name
counter The counter

xcover_rc_t xcover_reportAliasCoverage ( char const *  aliasName,
xcover_reporter_t *  reporter 
)

Reports coverage for all files matching the alias.

Parameters:
aliasName The name of the alias. May not be NULL
reporter A pointer to a reporter instance. May be NULL
Returns:
An error code from the xcover_rc_t enumeration

xcover_rc_t xcover_reportFileCoverage ( char const *  fileName,
xcover_reporter_t *  reporter 
)

Reports coverage for a files.

Parameters:
fileName The file name. May be a file name only, a file name + extension, a full path name, or a shell wild-card path
reporter A pointer to a reporter instance. May be NULL
Returns:
An error code from the xcover_rc_t enumeration

xcover_rc_t xcover_reportGroupCoverage ( char const *  fileName,
int  line,
char const *  groupName,
xcover_reporter_t *  reporter 
)

Reports coverage for all files in the group.

Parameters:
fileName The file name
line The line number
groupName The name of the group. May not be NULL
reporter A pointer to a reporter instance. May be NULL
Returns:
An error code from the xcover_rc_t enumeration

xcover_rc_t xcover_startGroupCoverage ( char const *  fileName,
int  line,
char const *  groupName 
)

Parameters:
fileName The file name
line The line number
groupName The group name

void xcover_uninit ( void   ) 

Uninitialises the xCover API.


xCover Library documentation © Matthew Wilson and Synesis Software Pty Ltd, 2008-2009 SourceForge.net Logo