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 - basemath - gen2.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.1 lcov report (development 30773-2078653b96) Lines: 1554 1658 93.7 %
Date: 2026-03-31 09:27:24 Functions: 149 156 95.5 %
Legend: Lines: hit not hit

Function Name Sort by function name Hit count Sort by hit count
Q_lval 9430389
Q_lvalrem 6302826
Q_pval 9426193
Q_pvalrem 6304425
ZV_Z_dvd 1309
ZV_lval 0
ZV_lvalrem 0
ZV_pval 30934
ZV_pvalrem 4182925
ZXV_pvalrem 0
ZXX_pvalrem 1400
ZX_gen_pvalrem 1400
ZX_lval 766410
ZX_lvalrem 721
ZX_pval 102493
ZX_pvalrem 4304793
Z_lval 70328033
Z_lvalrem 64493060
Z_lvalrem_stop 117229134
Z_pval 50389955
Z_pvalrem 69392639
Z_pvalrem_DC 2184930
_Fp_div 163005
_domul 2258886
affgc 2590
chk_true_err 189
closure_identical 70
cmp_str 3681020
cmp_universal 89002308
cmp_universal_rec 39283463
cmpfrac 4590919
cmpgen 161
cmpifrac 455583
cmprfrac 81308
col_test 294560
ctop 14
cvstop2 399
cvtop 600617
cvtop2 17619978
cx_approx0 2557825
cx_approx_equal 2496154
ensure_nb 810971
factorial_lval 1993178
frac_lval 381841
frac_val 292596
gabs 53583602
gassoc_proto 2463140
gcmp 282531950
gcmpsg 762243
gcvtop 126
gen_2val 791842
gen_2valrem 4914746
gen_Z_divides 6854
gen_lval 889512
gen_lvalrem 8475529
gen_pval 133427
gen_pvalrem 8487720
gen_pvalrem_DC 11751
gen_z_divides 4935
gequal 239953986
gequal0 2692321081
gequal1 339941315
gequalX 8501207
gequal_try 5316307
gequalm1 74233556
gequalsg 43988
gexpo 842972439
gexpo_safe 843266260
gidentical 123814359
gisexactzero 47328125
glength 5149550
gmax 79310
gmaxgs 0
gmequal_try 28
gmin 12180
gmings 0
gneg 465652623
gneg_i 140182791
gpexponent 90215
gpvaluation 3934
gsigne 83607426
gtolist 5965
gtolong 77
gtranslength 3878
gvaluation 1396053
identicalrr 1547
intdvd 91
is_monomial_test 19829193
is_negative 0
isexactzero 743275265
isless_iu 15152744
isrationalzero 900612400
itop2_coprime 17612321
lexcmp 1617664
lexcmp_i 1617664
lexcmp_s_matvec 21
lexcmp_scal_matvec 357
lexcmp_scal_vecsmall 42
lexcmp_similar 372032
lexcmp_vec_mat 98
lexcmp_vecsmall_mat 42
lexcmp_vecsmall_other 196
lexcmp_vecsmall_vec 154
lexcmpgs 42
lexcmpsg 343
list_cmp 343
listinsert 35014
listinsert0 35028
listpop 21917
listpop0 56
listput 776125
listput0 724955
listsort 21
map_proto_G 462
map_proto_lG 37167621
map_proto_lGL 126
mat_test 16366
matsize 1862
minval 77315
mklist 6870
mklist_typ 6926
mklistcopy 70
mkmap 49
normalizepol 99617095
normalizepol_approx 0
normalizepol_lg 960669608
normalizeser 15095790
padic_to_Fl 421697
padic_to_Fp 4550
polequal 10491153
polidentical 5629340
qtop 42
quadtofp 252
r_approx0 1809356
roughtype 3235670
serequal 420
seridentical 14
sizedigit 7
u_lval 71609010
u_lvalrem 89645352
u_lvalrem_stop 134604805
u_pval 136813
u_pvalrem 2624797
vecequal 5529384
vecidentical 5441433
vecindexmax 503303
vecindexmin 182759
vecmax 66202
vecmax0 226892
vecmin 35234
vecmin0 147402
z_lval 1836784
z_lvalrem 87345
z_pval 1318031
z_pvalrem 399
zx_lval 28931

Generated by: LCOV version 1.16