All Manuals > LispWorks User Guide and Reference Manual > 38 The HCL Package

NextPrevUpTopContentsIndex

add-code-coverage-data

reverse-subtract-code-coverage-data

subtract-code-coverage-data

destructive-add-code-coverage-data

destructive-subtract-code-coverage-data

destructive-reverse-subtract-code-coverage-data

Functions
Summary

Add or subtract two code-coverage-data objects.

Package

hcl

Signature

add-code-coverage-data ccd1 ccd2 name => new-ccd

subtract-code-coverage-data ccd1 ccd2 name => new-ccd

reverse-subtract-code-coverage-data ccd1 ccd2 name => new-ccd

destructive-add-code-coverage-data ccd1 ccd2 => ccd1

destructive-subtract-code-coverage-data ccd1 ccd2 => ccd1

destructive-reverse-subtract-code-coverage-data ccd1 ccd2 => ccd1

Arguments

ccd1

A code-coverage-data object or (for the non-destructive functions only) t.

ccd2

A code-coverage-data object or t.

name

A Lisp object, normally a symbol or a string.

Values

new-ccd

A code-coverage-data object.

Description

Adding (subtracting) code coverage datas means adding (subtracting) all pairs of counters for the same piece of code from the two datas. When the data contains actual counters, adding (subtracting) really means adding (subtracting) the counter values, and reverse subtract means subtracting the first argument from the second. When the data contains only binary flags (that is, the code was compiled with counters = nil, see generate-code-coverage), addition is performed by doing logical OR, and subtraction by doing logical AND-NOT. Note that having counters is a property of each individual file, and a code-coverage-data object may have files that are compiled with either of these options.

If ccd1 or ccd2 has value t, this is interpreted as the internal code-coverage-data object.

These functions operate on each file in ccd1 (first argument), and for each of these file for which there is a match in ccd2, perform the operation on all the counters of this file. That is, they add (subtract) the counter from ccd2 to (from) the matching counter in ccd1. If there is no matching file in ccd2, the operation is done with 0 so the information from ccd1 is used unchanged.

For files which have matches in ccd2, the information must be based on the same binary file, otherwise these functions signal an error.

The functions add-code-coverage-data, subtract-code-coverage-data and reverse-subtract-code-coverage-data all produce a new code-coverage-data object (with name name) which is the result of the operation. The functions destructive-add-code-coverage-data, destructive-subtract-code-coverage-data and destructive-reverse-subtract-code-coverage-data all overwrite ccd1 with the result and return it.

For all these functions the result is a code-coverage-data object with information for each file for which there is information in ccd1, combined with the counters from ccd2 for files with a match. Files in ccd2 for which there is no match in ccd1 are ignored.

Notes

For reverse-subtract-code-coverage-data and destructive-reverse-subtract-code-coverage-data the result for files with no match may be considered inconsistent, because negation their counters may be more consistent.

See also

Code Coverage


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex