IMP logo
IMP Manual  for IMP version 2.16.0
coverage.md
1 Code coverage {#coverage}
2 =============
3 
4 To assist in testing your code, we report the coverage of all %IMP modules
5 and applications as part of the
6 [nightly builds](https://integrativemodeling.org/nightly/results/).
7 Coverage is basically a report of which lines of code were executed by your
8 tests; it is then straightforward to see which parts of the code have not
9 been exercised by any test, so that you can write new tests to test those
10 parts. (Of course, lines of code that are never executed
11 have no guarantee of working correctly.)
12 
13 Both the C++ and Python code coverage is reported. For C++ code, only the
14 lines of code that were exercised are reported; for Python code, which
15 conditional branches were taken are also shown (for example, whether both
16 branches from an `if` statement are followed).
17 
18 Ideally, coverage reflects the lines of code in a module or application
19 that were exercised only by running its own tests, rather than the tests of the
20 entire %IMP package, and generally speaking you should try to test a module
21 using its own tests. (Note also that our build machine that runs the coverage
22 test suite does not run 'expensive' tests.)
23 
24 If you have code that for some reason you wish to exclude from coverage,
25 you can add specially formatted comments to the code. For Python code,
26 [add a "pragma: no cover"](https://coverage.readthedocs.io/en/latest/excluding.html)
27 comment to the line to exclude. For C++ code, an individual line can be excluded
28 by adding `LCOV_EXCL_LINE` somewhere on that line, or a block can be excluded
29 by surrounding it with lines containing `LCOV_EXCL_START` and `LCOV_EXCL_STOP`.
30 
31 If you want to run coverage on %IMP yourself, see the `README` file in
32 the `tools/coverage` directory for instructions.
void report(std::string benchmark, std::string algorithm, double time, double check)