Code coverage tests

This page documents the degree to which the PARI/GP source code is tested by our public test suite, distributed with the source distribution in directory src/test/. This is measured by the gcov utility; we then process gcov output using the lcov frond-end.

We test a few variants depending on Configure flags on the pari.math.u-bordeaux.fr machine (x86_64 architecture), and agregate them in the final report:

The target is to exceed 90% coverage for all mathematical modules (given that branches depending on DEBUGLEVEL or DEBUGMEM are not covered). This script is run to produce the results below.

LCOV - code coverage report
Current view: top level - language - forprime.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.1 lcov report (development 30802-b11b770002) Lines: 461 529 87.1 %
Date: 2026-04-11 09:26:21 Functions: 40 42 95.2 %
Legend: Lines: hit not hit

Function Name Sort by function name Hit count Sort by hit count
ZV_copy_alloc 1880
ZV_size 1880
arith_set 102080
forcomposite 70
forcomposite_init 70
forcomposite_next 238
forprime 1323
forprime_init 1315
forprime_next 45430031
forprimestep 1449
forprimestep_init 2784
good_arena_size 1880
init_modular_big 12050536
init_modular_small 4680521
initprimes 1880
initprimes0 1880
initprimes1 1880
initprimetable 1880
maxprime 36392596
maxprimeN 196
maxprime_check 0
maxprimelim 76368805
optimize_chunk 9244167
pari_close_primes 1880
pari_init_primes 1880
pari_sieve_init 1880
prodprimes 1106978
prodprimeslim 1106978
set_optimize 0
set_prodprimes 1880
shift_cache 130540351
sieve_block 9160
sieve_chunk 7224
sieve_init 9244173
synchronize_primelimits 1880
u_forprime_arith_init 20014269
u_forprime_init 19473535
u_forprime_next 217352200
u_forprime_restrict 63
u_forprime_set_prime_table 8694960
u_forprime_sieve_arith_init 25759903
u_forprime_sieve_init 5745532

Generated by: LCOV version 1.16