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.12.1 lcov report (development 25819-e703fe1174) Lines: 110 117 94.0 %
Date: 2020-09-18 06:10:04 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. It is distributed in the hope that it will be useful, but WITHOUT
       9             : ANY WARRANTY WHATSOEVER.
      10             : 
      11             : Check the License for details. You should have received a copy of it, along
      12             : with the package; see the file 'COPYING'. If not, write to the Free Software
      13             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      14             : 
      15             : #define PARI_STYPE union token_value
      16             : #define PARI_LTYPE struct node_loc
      17             : #define YYPTRDIFF_T long
      18             : #define YYPTRDIFF_MAXIMUM LONG_MAX
      19             : #define YYSIZE_T size_t
      20             : #define YYLLOC_DEFAULT(Current, Rhs, N)     \
      21             :         ((Current).start  = ((N)?(Rhs)[1].start:(Rhs)[0].end),  \
      22             :          (Current).end    = (Rhs)[N].end)
      23             : #include "parsec.h"
      24             : #define NOARG(x) newnode(Fnoarg,-1,-1,&(x))
      25             : #define NORANGE(x) newnode(Fnorange,-1,-1,&(x))
      26             : %}
      27             : %define parse.error verbose
      28             : %define api.prefix {pari_}
      29             : %define api.pure full
      30             : %parse-param {char **lex}
      31             : %lex-param {char **lex}
      32      105510 : %initial-action{ @$.start=@$.end=*lex; }
      33             : %token KPARROW ")->"
      34             : %token KARROW "->"
      35             : %token KDOTDOT ".."
      36             : %token KPE   "+="
      37             : %token KSE   "-="
      38             : %token KME   "*="
      39             : %token KDE   "/="
      40             : %token KDRE  "\\/="
      41             : %token KEUCE "\\="
      42             : %token KMODE "%="
      43             : %token KAND  "&&"
      44             : %token KOR   "||"
      45             : %token KID   "==="
      46             : %token KEQ   "=="
      47             : %token KNE   "!="
      48             : %token KGE   ">="
      49             : %token KLE   "<="
      50             : %token KSRE  ">>="
      51             : %token KSLE  "<<="
      52             : %token KSR   ">>"
      53             : %token KSL   "<<"
      54             : %token KDR   "\\/"
      55             : %token KPP   "++"
      56             : %token KSS   "--"
      57             : %token <gen> KINTEGER "integer"
      58             : %token <gen> KREAL "real number"
      59             : %token KENTRY "variable name"
      60             : %token KSTRING "character string"
      61             : %left SEQ DEFFUNC
      62             : %left INT LVAL
      63             : %right ")->" "->"
      64             : %left ';' ',' ".."
      65             : %right '=' "+=" "-=" "*=" "/=" "\\/=" "\\=" "%=" ">>=" "<<="
      66             : %left '&' "&&" "||"
      67             : %left "===" "==" "!=" '>' ">=" '<' "<="
      68             : %left '+' '-'
      69             : %left '%' "\\/" '\\' '/' '*' ">>" "<<"
      70             : %left SIGN
      71             : %right '^'
      72             : %left '#'
      73             : %left '!' '~' '[' DERIV
      74             : %left '\''
      75             : %left '.'
      76             : %left "++" "--"
      77             : %left '('
      78             : %left ':'
      79             : %type <val> seq sequence
      80             : %type <val> range matrix matrix_index expr exprno
      81             : %type <val> lvalue deriv
      82             : %type <val> matrixelts matrixeltsno matrixlines arg listarg definition
      83             : %type <val> funcid memberid
      84             : %type <val> backticks history
      85             : %type <val> compr in inseq
      86           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
      87             : %%
      88             : 
      89      105510 : sequence: seq        {$$=$1;} /* skip the destructor */
      90             : ;
      91             : 
      92       11461 : seq: /**/ %prec SEQ  {$$=NOARG(@$);}
      93      403660 :    | expr %prec SEQ  {$$=$1;}
      94       32284 :    | seq ';'         {$$=$1; @$=@1;}
      95       26871 :    | seq ';' expr    {$$=newnode(Fseq,$1,$3,&@$);}
      96             : ;
      97             : 
      98         791 : range: /* */          { $$=newnode(Frange,NORANGE(@$),NORANGE(@$),&@$); }
      99       10939 :      | expr           { $$=newnode(Frange,$1,NORANGE(@$),&@$); }
     100         525 :      | expr ".." expr { $$=newnode(Frange,$1,$3,&@$); }
     101          98 :      | '^' expr       { $$=newnode(Frange,NORANGE(@$),$2,&@$); }
     102             : ;
     103             : 
     104        1309 : matrix_index: '[' range ',' range ']' {$$=newnode(Fmatrix,$2,$4,&@$);}
     105        9735 :             | '[' range ']'           {$$=newnode(Fmatrix,$2,-1,&@$);}
     106             : ;
     107             : 
     108          35 : backticks: '`' {$$=1;}
     109          84 :          | backticks '`' {$$=$1+1;}
     110             : ;
     111             : 
     112          49 : history: '%'           {$$=newopcall(OPhist,-1,-1,&@$);}
     113          14 :        | '%' KINTEGER  {$$=newopcall(OPhist,newintnode(&@2),-1,&@$);}
     114          28 :        | '%' backticks {$$=newopcall(OPhist,newnode(Fsmall,-$2,-1,&@$),-1,&@$);}
     115           7 :        | '%' '#'          {$$=newopcall(OPhisttime,-1,-1,&@$);}
     116          11 :        | '%' '#' KINTEGER {$$=newopcall(OPhisttime,newintnode(&@3),-1,&@$);}
     117           7 :        | '%' '#' backticks{$$=newopcall(OPhisttime,newnode(Fsmall,-$3,-1,&@$),-1,&@$);}
     118             : ;
     119             : 
     120         140 : deriv: '\'' {$$ = 1;}
     121          42 :      | deriv '\'' {$$ = $1+1;}
     122             : ;
     123             : 
     124     7800624 : expr: KINTEGER %prec INT  {$$=newintnode(&@1);}
     125        3475 :     | KREAL               {$$=newconst(CSTreal,&@$);}
     126           0 :     | '.'                 {$$=newconst(CSTreal,&@$);}
     127           0 :     | KINTEGER '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),
     128             :                                                 newintnode(&@1),&@$);}
     129     1144945 :     | KSTRING       {$$=newconst(CSTstr,&@$);}
     130        2992 :     | '\'' KENTRY   {$$=newconst(CSTquote,&@$);}
     131         116 :     | history           {$$=$1;}
     132         315 :     | expr '(' listarg ')'  {$$=newnode(Fcall,$1,$3,&@$);}
     133      158419 :     | funcid            {$$=$1;}
     134      228693 :     | lvalue %prec LVAL {$$=$1;}
     135     3945901 :     | matrix            {$$=$1;}
     136         609 :     | compr             {$$=$1;}
     137        8406 :     | definition        {$$=$1;}
     138         844 :     | matrix '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     139       38386 :     | lvalue '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     140         141 :     | lvalue "++"     {$$=newopcall(OPpp,$1,-1,&@$);}
     141          14 :     | lvalue "--"     {$$=newopcall(OPss,$1,-1,&@$);}
     142         160 :     | lvalue "*="   expr {$$=newopcall(OPme,$1,$3,&@$);}
     143          35 :     | lvalue "/="   expr {$$=newopcall(OPde,$1,$3,&@$);}
     144           7 :     | lvalue "\\/=" expr {$$=newopcall(OPdre,$1,$3,&@$);}
     145           7 :     | lvalue "\\="  expr {$$=newopcall(OPeuce,$1,$3,&@$);}
     146           7 :     | lvalue "%="   expr {$$=newopcall(OPmode,$1,$3,&@$);}
     147           7 :     | lvalue "<<="  expr {$$=newopcall(OPsle,$1,$3,&@$);}
     148           7 :     | lvalue ">>="  expr {$$=newopcall(OPsre,$1,$3,&@$);}
     149         176 :     | lvalue "+="   expr {$$=newopcall(OPpe,$1,$3,&@$);}
     150          49 :     | lvalue "-="   expr {$$=newopcall(OPse,$1,$3,&@$);}
     151         525 :     | '!' expr         {$$=newopcall(OPnb,$2,-1,&@$);}
     152        3130 :     | '#' expr         {$$=newopcall(OPlength,$2,-1,&@$);}
     153         315 :     | expr "||"  expr  {$$=newopcall(OPor,$1,$3,&@$);}
     154         704 :     | expr "&&"  expr  {$$=newopcall(OPand,$1,$3,&@$);}
     155           0 :     | expr '&'   expr  {$$=newopcall(OPand,$1,$3,&@$);}
     156         357 :     | expr "===" expr  {$$=newopcall(OPid,$1,$3,&@$);}
     157        8290 :     | expr "=="  expr  {$$=newopcall(OPeq,$1,$3,&@$);}
     158        1862 :     | expr "!="  expr  {$$=newopcall(OPne,$1,$3,&@$);}
     159          76 :     | expr ">="  expr  {$$=newopcall(OPge,$1,$3,&@$);}
     160         340 :     | expr '>'   expr  {$$=newopcall(OPg,$1,$3,&@$);}
     161         174 :     | expr "<="  expr  {$$=newopcall(OPle,$1,$3,&@$);}
     162         430 :     | expr '<'   expr  {$$=newopcall(OPl,$1,$3,&@$);}
     163       21181 :     | expr '-'   expr  {$$=newopcall(OPs,$1,$3,&@$);}
     164       44866 :     | expr '+'   expr  {$$=newopcall(OPp,$1,$3,&@$);}
     165         105 :     | expr "<<"  expr  {$$=newopcall(OPsl,$1,$3,&@$);}
     166          21 :     | expr ">>"  expr  {$$=newopcall(OPsr,$1,$3,&@$);}
     167         504 :     | expr '%'   expr  {$$=newopcall(OPmod,$1,$3,&@$);}
     168          28 :     | expr "\\/" expr  {$$=newopcall(OPdr,$1,$3,&@$);}
     169         133 :     | expr '\\'  expr  {$$=newopcall(OPeuc,$1,$3,&@$);}
     170      121745 :     | expr '/'   expr  {$$=newopcall(OPd,$1,$3,&@$);}
     171       44134 :     | expr '*'   expr  {$$=newopcall(OPm,$1,$3,&@$);}
     172          77 :     | '+' expr %prec SIGN {$$=$2;}
     173     2361918 :     | '-' expr %prec SIGN {$$=newopcall(OPn,$2,-1,&@$);}
     174       58003 :     | expr '^' expr {$$=newopcall(OPpow,$1,$3,&@$);}
     175        3549 :     | expr '~' {$$=newopcall(OPtrans,$1,-1,&@$);}
     176         140 :     | expr deriv %prec DERIV {$$=newopcall(OPderivn,$1, newnode(Fsmall,$2,-1,&@$),&@$);}
     177         218 :     | expr '!'  {$$=newopcall(OPfact,$1,-1,&@$);}
     178        3246 :     | expr matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     179       11452 :     | memberid {$$=$1;}
     180           0 :     | expr ':' KENTRY   {$$=newnode(Ftag,$1,0,&@$);}
     181       11261 :     | '(' expr ')' {$$=$2;}
     182             : ;
     183             : 
     184      270882 : lvalue: KENTRY %prec LVAL   {$$=newnode(Fentry,newconst(CSTentry,&@1),-1,&@$);}
     185        7798 :       | lvalue matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     186           0 :       | lvalue ':' KENTRY   {$$=newnode(Ftag,$1,newconst(CSTentry,&@2),&@$);}
     187             : ;
     188             : 
     189     9130642 : exprno: expr {$$=$1;}
     190          35 :       | /**/ {$$=NOARG(@$);}
     191             : 
     192     9130670 : matrixeltsno: matrixelts {$$=$1;}
     193           7 :             | /**/ {$$=NOARG(@$);}
     194             : ;
     195             : 
     196     3415190 : matrixelts: expr {$$=$1;}
     197     9130677 :           | matrixeltsno ',' exprno {$$=newnode(Fmatrixelts,$1,$3,&@$);}
     198             : ;
     199             : 
     200        8036 : matrixlines: matrixelts  ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     201       20209 :            | matrixlines ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     202             : ;
     203             : 
     204      558404 : matrix: '[' ']'             {$$=newnode(Fvec,-1,-1,&@$);}
     205         563 :       | '[' expr ".." expr ']' {$$=newopcall(OPrange,$2,$4,&@$);}
     206         826 :       | '[' ';' ']'         {$$=newnode(Fmat,-1,-1,&@$);}
     207     3378916 :       | '[' matrixelts ']'  {$$=newnode(Fvec,$2,-1,&@$);}
     208        8036 :       | '[' matrixlines ']' {$$=newnode(Fmat,$2,-1,&@$);}
     209           0 :       | '[' error ']'       {$$=-1; YYABORT;}
     210             : ;
     211             : 
     212         700 : in: lvalue '<' '-' expr {$$=newnode(Flistarg,$4,$1,&@$);}
     213             : ;
     214             : 
     215         469 : inseq: in                    {$$=newopcall(OPcompr,$1,-2,&@$);}
     216         140 :      | in ',' expr           {$$=newopcall3(OPcompr,$1,-2,$3,&@$);}
     217          77 :      | in ';' inseq          {$$=newopcall(OPcomprc,$1,$3,&@$);}
     218          14 :      | in ',' expr ';' inseq {$$=newopcall3(OPcomprc,$1,$5,$3,&@$);}
     219             : ;
     220             : 
     221         609 : compr: '[' expr '|' inseq ']' {$$=addcurrexpr($4,$2,&@$);}
     222             : ;
     223             : 
     224      301205 : arg: seq        {$$=$1;}
     225          21 :    | lvalue '[' ".." ']' {$$=newnode(Fvararg,$1,-1,&@$);}
     226        1043 :    | '&' lvalue {$$=newnode(Frefarg,$2,-1,&@$);}
     227         322 :    | '~' lvalue {$$=newnode(Findarg,$2,-1,&@$);}
     228          14 :    | arg error  {if (!pari_once) { yyerrok; } pari_once=1;}  expr
     229          14 :                      {pari_once=0; $$=newopcall(OPcat,$1,$4,&@$);}
     230             : ;
     231             : 
     232      166019 : listarg: arg {$$=$1;}
     233      136572 :        | listarg ',' arg {$$=newnode(Flistarg,$1,$3,&@$);}
     234             : ;
     235             : 
     236      158419 : funcid: KENTRY '(' listarg ')' {$$=newnode(Ffunction,newconst(CSTentry,&@1),$3,&@$);}
     237             : ;
     238             : 
     239       11452 : memberid: expr '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),$1,&@$);}
     240             : ;
     241             : 
     242             : definition: KENTRY '(' listarg ')' '=' seq %prec DEFFUNC
     243        3206 :                                    {$$=newfunc(CSTentry,&@1,$3,$6,&@$);}
     244             :           | expr '.' KENTRY '=' seq %prec DEFFUNC
     245          14 :                                    {$$=newfunc(CSTmember,&@3,newnode(Findarg,$1,-1,&@1),$5,&@$);}
     246        1107 :           | lvalue "->" seq              {$$=newnode(Flambda, $1,$3,&@$);}
     247        4079 :           | '(' listarg ")->" seq        {$$=newnode(Flambda, $2,$4,&@$);}
     248             : ;
     249             : 
     250             : %%

Generated by: LCOV version 1.13