Loops
Template output is structured with loops, indicating ctcreport how dynamic, repeating content has to be placed.
For structured HTML templates, loop controls are embedded in comments. The general loop syntax is
<!-- CTC_LOOP("LoopType") --> ... <!-- CTC_LOOP_END("LoopType") -->
For single-file text templates, loops controls are embedded in
{...}
:
{CTC_LOOP("LoopType")}
...
{CTC_LOOP_END("LoopType")}
Loop Types
- General Structure (HTML): Level1, Level2
- According to the layout used from ctcreport-layout.ini, the coverage data is hierarchically structured in one or two levels (e.g., for entities files and functions). This is implemented by these two nested loops.
- General Structure (text): Directories, SourceFiles, Functions
- The data is hierarchically structured in up to three levels with entity-specific loops. The layout concept is not relevant for single-file templates.
- CoverageMeasures
- This loop is available in general scope, inside Level1
and Level2 loops and in Directories,
SoureFiles, Functions loops. For
all coverage measures chosen by ctcreport
option
-measures
, it provides coverage data (ratios, hits, name of coverage measure, …) for the current entity. - Symbolfiles
- In the overview page, this loop provides information about all symbol files used for generating the report.
- Datafiles
- In the overview page, this loop provides information about all data files used for generating the report.
- Justifications
- This loop is available in general scope and inside Level 1 and Level 2 loops. For current entity, the numbers of justifications grouped by tags are provided.
- Sibling Loops (Detail pages) : OverviewLevel1, OverviewLevel2
- For detail pages, a navigation menu with links to all siblings of the current entity (for example, a directory) is provided by using two nested loops. These loops refer to the layout structure chosen for overview page. If detail pages are generated for level 1 entities from overview page, the second loop is empty.
- Sibling Loops (Source View pages): GroupingSourceFiles, SourceFiles
- For source code views, a navigation menu with links to other source view pages is provided. The source code pages referenced are grouped by the outer loop. The grouping criteria is derived by ctcreport from the layout chosen. For example, if directories and files are selected as entities on the overview page, directories are the grouping criteria for source files.
Special loops for source code representation
The source code inside source view pages of HTML templates is structured with the following loop types:
- Functions
- Loops over instrumented functions for the source file. Code outside instrumented functions is handed over inside one artifical function.
- Lines
- Loops over all source code lines belonging to one function. Provides line number and source code.
- CodeSnippets
- Provides source code of one source line in snippets to distinguish code for syntax highlighting.
- Probes
- A probe is roughly a code element ctc instruments with one or more counters. Per source code line, there are typically zero or one probes, but there can be arbitrary many probes. On probe level, a true and a false counter are provided, possibly empty. For higher coverage levels than decision coverage, specialized loops provide details.
- ConditionDetails
- For decisions consisting of several atomic conditions, this loop provides true and false counters per condition.
- MulticonditionDetails
- Provides counters per true-false combination for a multicondition.
- MCDCDetails
- Provides MC/DC pairs and their coverage information per condition.
- MCDCPairs
- Provides each MC/DC pair of conditions.