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 - parse.y (source / functions) Hit Total Coverage
Test: PARI/GP v2.14.0 lcov report (development 27783-affec94c65) Lines: 110 117 94.0 %
Date: 2022-07-07 07:34:25 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : %{
       2             : /* Copyright (C) 2006  The PARI group.
       3             : 
       4             : This file is part of the PARI package.
       5             : 
       6             : PARI/GP is free software; you can redistribute it and/or modify it under the
       7             : terms of the GNU General Public License as published by the Free Software
       8             : Foundation; either version 2 of the License, or (at your option) any later
       9             : version. It is distributed in the hope that it will be useful, but WITHOUT
      10             : ANY WARRANTY WHATSOEVER.
      11             : 
      12             : Check the License for details. You should have received a copy of it, along
      13             : with the package; see the file 'COPYING'. If not, write to the Free Software
      14             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      15             : 
      16             : #define PARI_STYPE union token_value
      17             : #define PARI_LTYPE struct node_loc
      18             : #define YYPTRDIFF_T long
      19             : #define YYPTRDIFF_MAXIMUM LONG_MAX
      20             : #define YYSIZE_T size_t
      21             : #define YYLLOC_DEFAULT(Current, Rhs, N)     \
      22             :         ((Current).start  = ((N)?(Rhs)[1].start:(Rhs)[0].end),  \
      23             :          (Current).end    = (Rhs)[N].end)
      24             : #include "parsec.h"
      25             : #define NOARG(x) newnode(Fnoarg,-1,-1,&(x))
      26             : #define NORANGE(x) newnode(Fnorange,-1,-1,&(x))
      27             : %}
      28             : %define parse.error verbose
      29             : %define api.prefix {pari_}
      30             : %define api.pure full
      31             : %parse-param {char **lex}
      32             : %lex-param {char **lex}
      33     9109884 : %initial-action{ @$.start=@$.end=*lex; }
      34             : %token KPARROW ")->"
      35             : %token KARROW "->"
      36             : %token KDOTDOT ".."
      37             : %token KPE   "+="
      38             : %token KSE   "-="
      39             : %token KME   "*="
      40             : %token KDE   "/="
      41             : %token KDRE  "\\/="
      42             : %token KEUCE "\\="
      43             : %token KMODE "%="
      44             : %token KAND  "&&"
      45             : %token KOR   "||"
      46             : %token KID   "==="
      47             : %token KEQ   "=="
      48             : %token KNE   "!="
      49             : %token KGE   ">="
      50             : %token KLE   "<="
      51             : %token KSRE  ">>="
      52             : %token KSLE  "<<="
      53             : %token KSR   ">>"
      54             : %token KSL   "<<"
      55             : %token KDR   "\\/"
      56             : %token KPP   "++"
      57             : %token KSS   "--"
      58             : %token <gen> KINTEGER "integer"
      59             : %token <gen> KREAL "real number"
      60             : %token KENTRY "variable name"
      61             : %token KSTRING "character string"
      62             : %left SEQ DEFFUNC
      63             : %left INT LVAL
      64             : %right ")->" "->"
      65             : %left ';' ',' ".."
      66             : %right '=' "+=" "-=" "*=" "/=" "\\/=" "\\=" "%=" ">>=" "<<="
      67             : %left '&' "&&" "||"
      68             : %left "===" "==" "!=" '>' ">=" '<' "<="
      69             : %left '+' '-'
      70             : %left '%' "\\/" '\\' '/' '*' ">>" "<<"
      71             : %left SIGN
      72             : %right '^'
      73             : %left '#'
      74             : %left '!' '~' '[' DERIV
      75             : %left '\''
      76             : %left '.'
      77             : %left "++" "--"
      78             : %left '('
      79             : %left ':'
      80             : %type <val> seq sequence
      81             : %type <val> range matrix matrix_index expr exprno
      82             : %type <val> lvalue deriv
      83             : %type <val> matrixelts matrixeltsno matrixlines arg listarg definition
      84             : %type <val> funcid memberid
      85             : %type <val> backticks history
      86             : %type <val> compr in inseq
      87           0 : %destructor { pari_discarded++; } seq matrix range matrix_index expr exprno lvalue matrixelts matrixeltsno matrixlines arg listarg definition funcid memberid backticks history compr in inseq deriv
      88             : %%
      89             : 
      90     9109884 : sequence: seq        {$$=$1;} /* skip the destructor */
      91             : ;
      92             : 
      93       12165 : seq: /**/ %prec SEQ  {$$=NOARG(@$);}
      94     9444587 :    | expr %prec SEQ  {$$=$1;}
      95       37751 :    | seq ';'         {$$=$1; @$=@1;}
      96       28882 :    | seq ';' expr    {$$=newnode(Fseq,$1,$3,&@$);}
      97             : ;
      98             : 
      99         889 : range: /* */          { $$=newnode(Frange,NORANGE(@$),NORANGE(@$),&@$); }
     100       12315 :      | expr           { $$=newnode(Frange,$1,NORANGE(@$),&@$); }
     101         630 :      | expr ".." expr { $$=newnode(Frange,$1,$3,&@$); }
     102          98 :      | '^' expr       { $$=newnode(Frange,NORANGE(@$),$2,&@$); }
     103             : ;
     104             : 
     105        1428 : matrix_index: '[' range ',' range ']' {$$=newnode(Fmatrix,$2,$4,&@$);}
     106       11076 :             | '[' range ']'           {$$=newnode(Fmatrix,$2,-1,&@$);}
     107             : ;
     108             : 
     109          35 : backticks: '`' {$$=1;}
     110          84 :          | backticks '`' {$$=$1+1;}
     111             : ;
     112             : 
     113          49 : history: '%'           {$$=newopcall(OPhist,-1,-1,&@$);}
     114          14 :        | '%' KINTEGER  {$$=newopcall(OPhist,newintnode(&@2),-1,&@$);}
     115          28 :        | '%' backticks {$$=newopcall(OPhist,newnode(Fsmall,-$2,-1,&@$),-1,&@$);}
     116           7 :        | '%' '#'          {$$=newopcall(OPhisttime,-1,-1,&@$);}
     117          11 :        | '%' '#' KINTEGER {$$=newopcall(OPhisttime,newintnode(&@3),-1,&@$);}
     118           7 :        | '%' '#' backticks{$$=newopcall(OPhisttime,newnode(Fsmall,-$3,-1,&@$),-1,&@$);}
     119             : ;
     120             : 
     121         140 : deriv: '\'' {$$ = 1;}
     122          42 :      | deriv '\'' {$$ = $1+1;}
     123             : ;
     124             : 
     125    68544682 : expr: KINTEGER %prec INT  {$$=newintnode(&@1);}
     126        4316 :     | KREAL               {$$=newconst(CSTreal,&@$);}
     127           0 :     | '.'                 {$$=newconst(CSTreal,&@$);}
     128           0 :     | KINTEGER '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),
     129             :                                                 newintnode(&@1),&@$);}
     130      763670 :     | KSTRING       {$$=newconst(CSTstr,&@$);}
     131        3188 :     | '\'' KENTRY   {$$=newconst(CSTquote,&@$);}
     132         116 :     | history           {$$=$1;}
     133         315 :     | expr '(' listarg ')'  {$$=newnode(Fcall,$1,$3,&@$);}
     134      177866 :     | funcid            {$$=$1;}
     135      256902 :     | lvalue %prec LVAL {$$=$1;}
     136    20438929 :     | matrix            {$$=$1;}
     137         662 :     | compr             {$$=$1;}
     138        8716 :     | definition        {$$=$1;}
     139         984 :     | matrix '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     140       44085 :     | lvalue '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     141         148 :     | lvalue "++"     {$$=newopcall(OPpp,$1,-1,&@$);}
     142          28 :     | lvalue "--"     {$$=newopcall(OPss,$1,-1,&@$);}
     143         188 :     | lvalue "*="   expr {$$=newopcall(OPme,$1,$3,&@$);}
     144          35 :     | lvalue "/="   expr {$$=newopcall(OPde,$1,$3,&@$);}
     145           7 :     | lvalue "\\/=" expr {$$=newopcall(OPdre,$1,$3,&@$);}
     146           7 :     | lvalue "\\="  expr {$$=newopcall(OPeuce,$1,$3,&@$);}
     147           7 :     | lvalue "%="   expr {$$=newopcall(OPmode,$1,$3,&@$);}
     148           7 :     | lvalue "<<="  expr {$$=newopcall(OPsle,$1,$3,&@$);}
     149           7 :     | lvalue ">>="  expr {$$=newopcall(OPsre,$1,$3,&@$);}
     150         197 :     | lvalue "+="   expr {$$=newopcall(OPpe,$1,$3,&@$);}
     151          63 :     | lvalue "-="   expr {$$=newopcall(OPse,$1,$3,&@$);}
     152         574 :     | '!' expr         {$$=newopcall(OPnb,$2,-1,&@$);}
     153        3543 :     | '#' expr         {$$=newopcall(OPlength,$2,-1,&@$);}
     154         392 :     | expr "||"  expr  {$$=newopcall(OPor,$1,$3,&@$);}
     155         725 :     | expr "&&"  expr  {$$=newopcall(OPand,$1,$3,&@$);}
     156           0 :     | expr '&'   expr  {$$=newopcall(OPand,$1,$3,&@$);}
     157         343 :     | expr "===" expr  {$$=newopcall(OPid,$1,$3,&@$);}
     158        8703 :     | expr "=="  expr  {$$=newopcall(OPeq,$1,$3,&@$);}
     159        1967 :     | expr "!="  expr  {$$=newopcall(OPne,$1,$3,&@$);}
     160         104 :     | expr ">="  expr  {$$=newopcall(OPge,$1,$3,&@$);}
     161         424 :     | expr '>'   expr  {$$=newopcall(OPg,$1,$3,&@$);}
     162         202 :     | expr "<="  expr  {$$=newopcall(OPle,$1,$3,&@$);}
     163         710 :     | expr '<'   expr  {$$=newopcall(OPl,$1,$3,&@$);}
     164       25763 :     | expr '-'   expr  {$$=newopcall(OPs,$1,$3,&@$);}
     165       51717 :     | expr '+'   expr  {$$=newopcall(OPp,$1,$3,&@$);}
     166         147 :     | expr "<<"  expr  {$$=newopcall(OPsl,$1,$3,&@$);}
     167          21 :     | expr ">>"  expr  {$$=newopcall(OPsr,$1,$3,&@$);}
     168         560 :     | expr '%'   expr  {$$=newopcall(OPmod,$1,$3,&@$);}
     169          28 :     | expr "\\/" expr  {$$=newopcall(OPdr,$1,$3,&@$);}
     170         154 :     | expr '\\'  expr  {$$=newopcall(OPeuc,$1,$3,&@$);}
     171      105958 :     | expr '/'   expr  {$$=newopcall(OPd,$1,$3,&@$);}
     172       52908 :     | expr '*'   expr  {$$=newopcall(OPm,$1,$3,&@$);}
     173          77 :     | '+' expr %prec SIGN {$$=$2;}
     174    26598489 :     | '-' expr %prec SIGN {$$=newopcall(OPn,$2,-1,&@$);}
     175       67496 :     | expr '^' expr {$$=newopcall(OPpow,$1,$3,&@$);}
     176        3976 :     | expr '~' {$$=newopcall(OPtrans,$1,-1,&@$);}
     177         140 :     | expr deriv %prec DERIV {$$=newopcall(OPderivn,$1, newnode(Fsmall,$2,-1,&@$),&@$);}
     178         218 :     | expr '!'  {$$=newopcall(OPfact,$1,-1,&@$);}
     179        3890 :     | expr matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     180       11837 :     | memberid {$$=$1;}
     181           0 :     | expr ':' KENTRY   {$$=newnode(Ftag,$1,0,&@$);}
     182       12962 :     | '(' expr ')' {$$=$2;}
     183             : ;
     184             : 
     185      305405 : lvalue: KENTRY %prec LVAL   {$$=newnode(Fentry,newconst(CSTentry,&@1),-1,&@$);}
     186        8614 :       | lvalue matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     187           0 :       | lvalue ':' KENTRY   {$$=newnode(Ftag,$1,newconst(CSTentry,&@2),&@$);}
     188             : ;
     189             : 
     190    60223646 : exprno: expr {$$=$1;}
     191          35 :       | /**/ {$$=NOARG(@$);}
     192             : 
     193    60223674 : matrixeltsno: matrixelts {$$=$1;}
     194           7 :             | /**/ {$$=NOARG(@$);}
     195             : ;
     196             : 
     197    20167284 : matrixelts: expr {$$=$1;}
     198    60223681 :           | matrixeltsno ',' exprno {$$=newnode(Fmatrixelts,$1,$3,&@$);}
     199             : ;
     200             : 
     201        8204 : matrixlines: matrixelts  ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     202       20482 :            | matrixlines ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     203             : ;
     204             : 
     205      299880 : matrix: '[' ']'             {$$=newnode(Fvec,-1,-1,&@$);}
     206         602 :       | '[' expr ".." expr ']' {$$=newopcall(OPrange,$2,$4,&@$);}
     207         826 :       | '[' ';' ']'         {$$=newnode(Fmat,-1,-1,&@$);}
     208    20130401 :       | '[' matrixelts ']'  {$$=newnode(Fvec,$2,-1,&@$);}
     209        8204 :       | '[' matrixlines ']' {$$=newnode(Fmat,$2,-1,&@$);}
     210           0 :       | '[' error ']'       {$$=-1; YYABORT;}
     211             : ;
     212             : 
     213         753 : in: lvalue '<' '-' expr {$$=newnode(Flistarg,$4,$1,&@$);}
     214             : ;
     215             : 
     216         515 : inseq: in                    {$$=newopcall(OPcompr,$1,-2,&@$);}
     217         147 :      | in ',' expr           {$$=newopcall3(OPcompr,$1,-2,$3,&@$);}
     218          77 :      | in ';' inseq          {$$=newopcall(OPcomprc,$1,$3,&@$);}
     219          14 :      | in ',' expr ';' inseq {$$=newopcall3(OPcomprc,$1,$5,$3,&@$);}
     220             : ;
     221             : 
     222         662 : compr: '[' expr '|' inseq ']' {$$=addcurrexpr($4,$2,&@$);}
     223             : ;
     224             : 
     225      338152 : arg: seq        {$$=$1;}
     226          21 :    | lvalue '[' ".." ']' {$$=newnode(Fvararg,$1,-1,&@$);}
     227        1407 :    | '&' lvalue {$$=newnode(Frefarg,$2,-1,&@$);}
     228         357 :    | '~' lvalue {$$=newnode(Findarg,$2,-1,&@$);}
     229          35 :    | arg error  {if (!pari_once) { yyerrok; } pari_once=1;}  expr
     230          35 :                      {pari_once=0; $$=newopcall(OPcat,$1,$4,&@$);}
     231             : ;
     232             : 
     233      185697 : listarg: arg {$$=$1;}
     234      154240 :        | listarg ',' arg {$$=newnode(Flistarg,$1,$3,&@$);}
     235             : ;
     236             : 
     237      177866 : funcid: KENTRY '(' listarg ')' {$$=newnode(Ffunction,newconst(CSTentry,&@1),$3,&@$);}
     238             : ;
     239             : 
     240       11837 : memberid: expr '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),$1,&@$);}
     241             : ;
     242             : 
     243             : definition: KENTRY '(' listarg ')' '=' seq %prec DEFFUNC
     244        3437 :                                    {$$=newfunc(CSTentry,&@1,$3,$6,&@$);}
     245             :           | expr '.' KENTRY '=' seq %prec DEFFUNC
     246          14 :                                    {$$=newfunc(CSTmember,&@3,newnode(Findarg,$1,-1,&@1),$5,&@$);}
     247        1186 :           | lvalue "->" seq              {$$=newnode(Flambda, $1,$3,&@$);}
     248        4079 :           | '(' listarg ")->" seq        {$$=newnode(Flambda, $2,$4,&@$);}
     249             : ;
     250             : 
     251             : %%

Generated by: LCOV version 1.13