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 - hnf_snf.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.1 lcov report (development 30822-5d69697d32) Lines: 1610 1786 90.1 %
Date: 2026-04-17 09:24:44 Functions: 97 107 90.7 %
Legend: Lines: hit not hit

Function Name Sort by function name Hit count Sort by hit count
ZV_snf_trunc 0
do_zero 0
gsmith 0
gsmithall 0
hnfadd 0
hnfspec 0
mathnfspec 0
p_mat 0
trivsmith 0
zv_snf_rank 0
hnflll 7
hnf 14
hnfall 14
hnfmod 14
hnfperm 14
hnfallgen 21
ZM_hnfintersectmod 28
smithall 35
RgM_hnfall 42
snf_pile1 48
RgXM_snf 49
ZV_snf_rank_u 49
RgM_reduce 84
ZV_snf_rank 91
hnfdivide 133
snfrank 154
gsnf_no_divide 196
ZM_hnf_knapsack 238
normalize_as_RgX 364
ZM_hnfperm 385
smith 385
matsnf0 469
RgC_elem 511
smithclean 693
ZV_hnfgcdext 707
gbezout_step 882
mathnf0 973
is_RgX 2590
ZM_snf 15925
ZM_hnfcenter 25158
ZM_hnfall 29370
hnf_i 62151
ZM_snfall 64239
ZM_hnf 90016
ZV_extgcd 110572
ZV_gcdext_i 111272
hnfadd_i 117286
ZM_hnfmod 162602
hnfspec_i 186364
hnf_divscale 197497
ZV_snfclean 227088
hnf_invscale 275322
ZM_rowrankprofile 303650
hnffinal 303652
ZM_hnflll 309167
ZV_snf_group 316912
ZV_snfall 316936
ZV_allequal 322709
remove_0cols 336227
hnfmodid 438499
allhnfmod 438512
hnf_solve 461163
ZpM_echelon 528205
hnf_invimage 547535
count2 554509
negcmpii 602520
reverse_rows 618282
ZM_hnfall_i 752641
ZM_snf_group 764406
hnfmerge_get_1 815969
update 841971
ZM_snfall_i 848115
bezout_step 890605
reduce1 991087
ZMrow_divexact_inplace 1070834
ZM_snfclean 1081389
snf_group 1081389
snf_pile 1123478
ZM_snf_no_divide 1301798
ZM_redpart 1689807
Minus 2995131
ZM_hnfmodprime 3364139
FpM_echelon 3364147
FpM_hnfend 3364382
col_mul 3367797
col_dup 3769081
ZM_reduce 4475302
ZM_hnfmodid 4537554
zlm_echelon 4802246
ZM_hnfmodall 5140498
optimal_D 5189749
ZM_hnfmodall_i 5191604
FpV_Fp_mul_part_ip 5411988
must_swap 6183346
subzi 7912104
count 10216035
hnfswap 11612010
ZC_lincomb1z 29910154
ZC_lincomb1z_i 29926115
FpV_red_part_ipvec 37727145
ZC_elem 41263389
affii2_or_copy_gc 54253823
reduce2 64292133
findi_normalize 128640999
findi 128670288
addzi 277299321
addmulzii 583562564

Generated by: LCOV version 1.16