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 30703-cd958ce78c) Lines: 461 529 87.1 %
Date: 2026-02-23 09:22:43 Functions: 40 42 95.2 %
Legend: Lines: hit not hit

Function Name Sort by function name Hit count Sort by hit count
maxprime_check 0
set_optimize 0
u_forprime_restrict 63
forcomposite 70
forcomposite_init 70
maxprimeN 196
forcomposite_next 238
forprime 973
forprimestep 1099
forprime_init 1315
ZV_copy_alloc 1897
ZV_size 1897
good_arena_size 1897
initprimes 1897
initprimes0 1897
initprimes1 1897
initprimetable 1897
pari_close_primes 1897
pari_init_primes 1897
pari_sieve_init 1897
set_prodprimes 1897
synchronize_primelimits 1897
forprimestep_init 2434
sieve_chunk 7269
sieve_block 9177
arith_set 102080
prodprimes 1073205
prodprimeslim 1073205
init_modular_small 4602688
u_forprime_sieve_init 5666997
u_forprime_set_prime_table 8575459
sieve_init 9061430
optimize_chunk 9061432
init_modular_big 12044513
u_forprime_init 19340180
u_forprime_arith_init 19886417
u_forprime_sieve_arith_init 25553718
maxprime 36131259
forprime_next 45413581
maxprimelim 75925535
shift_cache 130460998
u_forprime_next 206656526

Generated by: LCOV version 1.16