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 - compile.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.1 lcov report (development 30861-40e9da58f9) Lines: 1629 1809 90.0 %
Date: 2026-05-04 09:27:01 Functions: 89 92 96.7 %
Legend: Lines: hit not hit

Function Name Sort by function name Hit count Sort by hit count
closure_deriv 0
closuretoinl 0
debug_context 0
pari_translate_string 4
compileunexport 6
compileuninline 6
L_compile_err 7
U_compile_err 7
localvars_find 7
matchQ 8
call0 28
compilelocal 28
str_defproto 39
compileexport 41
pack_localvars 53
localpush 70
closure_derivn 112
strtofunction 119
getvardyn 131
push_frame 259
compilelambda 359
compilestate_reset 452
countmatrixelts 462
compilenewptr 847
strtoclosure 1820
compilelvalue 1848
op_insert_loc 2975
compilemy 3566
countvar 3594
is_node_zero 4280
compilemat 9680
optimizemat 9680
ctxmvar 9738
closurefunc 10616
localvars_read_str 10992
getvarvec 12956
compilematcoeff 13609
optimizematcoeff 14610
compileseq 15220
optimizeseq 15220
matindex_type 15737
getclosure 20436
compilefuncinline 20711
checkdups 21009
compilecall 23375
optimizecall 23382
fetch_member_raw 25263
compilestore 46054
cattovec 48924
getlvalue 49678
compilestate_restore 56422
var_push 65891
getvar 66070
access_push 116741
addcopy 274708
getentry 364439
pari_close_compiler 371286
pari_init_compiler 373064
detag 446844
gp_closure 937118
compilestate_save 1431846
strntoGENexp 3822360
translate 3822364
data_push 4804505
snm_closure 9137235
genclosurectx 9138847
genclosure 9149670
genctx 9154195
frame_push 9164095
getfunction 10108016
getcodepos 10108070
optimizefunc 10763899
compilefunc 10768707
getmvar 11140870
gcopyunclone 13968580
compilevec 15460514
optimizevec 15461746
vec_optimize 15558676
compilecast 18614435
first_safe_arg 21591640
get_ret_type 21674713
getfunc 21934213
compilecast_loc 27755084
compilesmall 30552601
countlisttogen 52642915
listtogen 52642915
compilenode 52951020
optimizenode 62098804
op_push 115722468
is_func_named 118408055
parseproto 153726710
op_push_loc 159564387

Generated by: LCOV version 1.16