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) Coverage Total Hit
Test: PARI/GP v2.19.0 lcov report (development 31057-89c4d54ba6) Lines: 87.1 % 529 461
Test Date: 2026-07-25 17:02:42 Functions: 95.2 % 42 40
Legend: Lines:     hit not hit

Function Name Sort by function name Hit count Sort by function hit count
maxprime_check 0
set_optimize 0
u_forprime_restrict 63
forcomposite 70
forcomposite_init 70
maxprimeN 196
forcomposite_next 238
forprime_init 1315
forprime 1330
forprimestep 1456
ZV_copy_alloc 1887
ZV_size 1887
good_arena_size 1887
initprimes 1887
initprimes0 1887
initprimes1 1887
initprimetable 1887
pari_close_primes 1887
pari_init_primes 1887
pari_sieve_init 1887
set_prodprimes 1887
synchronize_primelimits 1887
forprimestep_init 2791
sieve_chunk 7251
sieve_block 9238
arith_set 102080
prodprimes 1106514
prodprimeslim 1106514
init_modular_small 4278320
u_forprime_sieve_init 5394427
optimize_chunk 8843446
sieve_init 8843446
u_forprime_set_prime_table 8843575
init_modular_big 12020644
u_forprime_init 19589237
u_forprime_arith_init 20136090
u_forprime_sieve_arith_init 25530517
maxprime 36499206
forprime_next 47789149
maxprimelim 64097379
shift_cache 132523313
u_forprime_next 219640779

Generated by: LCOV version 2.0-1