DelphiCodeCoverage AI-optimized report

Just pushed to my fork of DelphiCodeCoverage a few enhancements to make it more AI-friendly (I’m not sure if the original repo is still maintained).

The key addition one is a new “Code Coverage Gaps” .ccg format that is optimized for AI consumption, and can save a lot of tokens ($$$) when you task an AI with improving unit test coverage..

So far DelphiCodeCoverage had two main export formats, one being html for direct human use, and the other being xml for other tools. The new format aims straight at LLMs tasked with adding tests to improve coverage.

The CCG format was spec’ed with Gemini, and tested with Claude & Qwen 3.5. It is compact, token-optimized, obvious without docs to AIs, easily greppable and parsable.

It starts with a small summary holding key information, followed by details about code coverage (or rather lack of coverage) compressed into a series of function/method entries (source code line ranges and name), and for each function, its “gaps” (which lines aren’t covered). Fully covered functions are not listed.

This allows the AIs to perform quick lookups of the code needing more tests (reading just the lines or the function). All three AIs were able to laser-focus on the extra tests needed for 100% code coverage. This avoided a lot of going back and force with the XML, or even trying to implement an XML parser to get at the information.

PROJECT: mpir_tests
TIMESTAMP: 2026-03-21T18:22:59Z
TOTAL_COVERAGE: 90.0%
GLOBAL_STATS: 5928/6555

UNIT: mpir.tests.gcd_lcm | mpir.tests.gcd_lcm.pas
  COVERAGE: 95.5% (107/112 lines)

  FUNC: 48-55 TestGCDUI
    GAPS: 53
  FUNC: 76-85 TestGCDCommutative
    GAPS: 83
  FUNC: 60-71 TestGCDLCMProperty
    GAPS: 69
  FUNC: 33-42 TestLCM
    GAPS: 40
  FUNC: 18-27 TestGCD
    GAPS: 25

UNIT: mpir.types | mpir.types.pas
  COVERAGE: 73.8% (90/122 lines)

  METH: 261-267 mpz_t.ZeroLimbs
    GAPS: 264
  METH: 216-218 mpz_t.AllocLimbs
    GAPS: 216-218
  METH: 286-290 mpz_t.LimbPtrAt
    GAPS: 286-290
  METH: 210-211 mpz_t.LimbPtr
    GAPS: 210-211
  METH: 274-281 mpz_t.FillLimbs
    GAPS: 277
  METH: 160-170 mpz_t.Normalize
    GAPS: 160-164, 166-170
  METH: 223-256 mpz_t.MoveLimbs
    GAPS: 223-225, 227, 229-230, 238, 240, 251, 253

Leave a Reply

Your email address will not be published. Required fields are marked *