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 30702-bddb8d6928) Lines: 461 529 87.1 %
Date: 2026-02-23 02:23:56 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 1488
ZV_size 1488
arith_set 87569
forcomposite 59
forcomposite_init 59
forcomposite_next 198
forprime 813
forprime_init 1100
forprime_next 33698295
forprimestep 920
forprimestep_init 2030
good_arena_size 1488
init_modular_big 9491329
init_modular_small 3828453
initprimes 1488
initprimes0 1488
initprimes1 1488
initprimetable 1488
maxprime 28630642
maxprimeN 163
maxprime_check 0
maxprimelim 44622610
optimize_chunk 7705666
pari_close_primes 1488
pari_init_primes 1488
pari_sieve_init 1488
prodprimes 902100
prodprimeslim 902100
set_optimize 0
set_prodprimes 1488
shift_cache 97327000
sieve_block 7053
sieve_chunk 6042
sieve_init 7705666
synchronize_primelimits 1488
u_forprime_arith_init 15591720
u_forprime_init 15132002
u_forprime_next 156834062
u_forprime_restrict 54
u_forprime_set_prime_table 6975427
u_forprime_sieve_arith_init 20484483
u_forprime_sieve_init 4892763

Generated by: LCOV version 1.16