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 24038-ebe36f6c4) Lines: 106 113 93.8 %
Date: 2019-07-23 05:53:17 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 YYSIZE_T size_t
      18             : #define YYLLOC_DEFAULT(Current, Rhs, N)     \
      19             :         ((Current).start  = ((N)?(Rhs)[1].start:(Rhs)[0].end),  \
      20             :          (Current).end    = (Rhs)[N].end)
      21             : #include "parsec.h"
      22             : #define NOARG(x) newnode(Fnoarg,-1,-1,&(x))
      23             : #define NORANGE(x) newnode(Fnorange,-1,-1,&(x))
      24             : %}
      25             : %define parse.error verbose
      26             : %define api.prefix {pari_}
      27             : %pure-parser
      28             : %parse-param {char **lex}
      29             : %lex-param {char **lex}
      30       99009 : %initial-action{ @$.start=@$.end=*lex; }
      31             : %token KPARROW ")->"
      32             : %token KARROW "->"
      33             : %token KDOTDOT ".."
      34             : %token KPE   "+="
      35             : %token KSE   "-="
      36             : %token KME   "*="
      37             : %token KDE   "/="
      38             : %token KDRE  "\\/="
      39             : %token KEUCE "\\="
      40             : %token KMODE "%="
      41             : %token KAND  "&&"
      42             : %token KOR   "||"
      43             : %token KID   "==="
      44             : %token KEQ   "=="
      45             : %token KNE   "!="
      46             : %token KGE   ">="
      47             : %token KLE   "<="
      48             : %token KSRE  ">>="
      49             : %token KSLE  "<<="
      50             : %token KSR   ">>"
      51             : %token KSL   "<<"
      52             : %token KDR   "\\/"
      53             : %token KPP   "++"
      54             : %token KSS   "--"
      55             : %token <gen> KINTEGER "integer"
      56             : %token <gen> KREAL "real number"
      57             : %token KENTRY "variable name"
      58             : %token KSTRING "character string"
      59             : %left SEQ DEFFUNC
      60             : %left INT LVAL
      61             : %right ")->" "->"
      62             : %left ';' ',' ".."
      63             : %right '=' "+=" "-=" "*=" "/=" "\\/=" "\\=" "%=" ">>=" "<<="
      64             : %left '&' "&&" "||"
      65             : %left "===" "==" "!=" '>' ">=" '<' "<="
      66             : %left '+' '-'
      67             : %left '%' "\\/" '\\' '/' '*' ">>" "<<"
      68             : %left SIGN
      69             : %right '^'
      70             : %left '#'
      71             : %left '!' '~' '[' DERIV
      72             : %left '\''
      73             : %left '.'
      74             : %left "++" "--"
      75             : %left '('
      76             : %left ':'
      77             : %type <val> seq sequence
      78             : %type <val> range matrix matrix_index expr
      79             : %type <val> lvalue deriv
      80             : %type <val> matrixelts matrixlines arg listarg definition
      81             : %type <val> funcid memberid
      82             : %type <val> backticks history
      83             : %type <val> compr in inseq
      84           0 : %destructor { pari_discarded++; } seq matrix range matrix_index expr lvalue matrixelts matrixlines arg listarg definition funcid memberid backticks history compr in inseq deriv
      85             : %%
      86             : 
      87       99009 : sequence: seq        {$$=$1;} /* skip the destructor */
      88             : ;
      89             : 
      90       10806 : seq: /**/ %prec SEQ  {$$=NOARG(@$);}
      91      376332 :    | expr %prec SEQ  {$$=$1;}
      92       29626 :    | seq ';'         {$$=$1; @$=@1;}
      93       24877 :    | seq ';' expr    {$$=newnode(Fseq,$1,$3,&@$);}
      94             : ;
      95             : 
      96         784 : range: /* */          { $$=newnode(Frange,NORANGE(@$),NORANGE(@$),&@$); }
      97       10309 :      | expr           { $$=newnode(Frange,$1,NORANGE(@$),&@$); }
      98         504 :      | expr ".." expr { $$=newnode(Frange,$1,$3,&@$); }
      99          84 :      | '^' expr       { $$=newnode(Frange,NORANGE(@$),$2,&@$); }
     100             : ;
     101             : 
     102        1204 : matrix_index: '[' range ',' range ']' {$$=newnode(Fmatrix,$2,$4,&@$);}
     103        9273 :             | '[' range ']'           {$$=newnode(Fmatrix,$2,-1,&@$);}
     104             : ;
     105             : 
     106          35 : backticks: '`' {$$=1;}
     107          84 :          | backticks '`' {$$=$1+1;}
     108             : ;
     109             : 
     110          49 : history: '%'           {$$=newopcall(OPhist,-1,-1,&@$);}
     111          14 :        | '%' KINTEGER  {$$=newopcall(OPhist,newintnode(&@2),-1,&@$);}
     112          28 :        | '%' backticks {$$=newopcall(OPhist,newnode(Fsmall,-$2,-1,&@$),-1,&@$);}
     113           7 :        | '%' '#'          {$$=newopcall(OPhisttime,-1,-1,&@$);}
     114           7 :        | '%' '#' KINTEGER {$$=newopcall(OPhisttime,newintnode(&@3),-1,&@$);}
     115           7 :        | '%' '#' backticks{$$=newopcall(OPhisttime,newnode(Fsmall,-$3,-1,&@$),-1,&@$);}
     116             : ;
     117             : 
     118         140 : deriv: '\'' {$$ = 1;}
     119          42 :      | deriv '\'' {$$ = $1+1;}
     120             : ;
     121             : 
     122     7733853 : expr: KINTEGER %prec INT  {$$=newintnode(&@1);}
     123        3268 :     | KREAL               {$$=newconst(CSTreal,&@$);}
     124           0 :     | '.'                 {$$=newconst(CSTreal,&@$);}
     125           0 :     | KINTEGER '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),
     126             :                                                 newintnode(&@1),&@$);}
     127     1108391 :     | KSTRING       {$$=newconst(CSTstr,&@$);}
     128        2816 :     | '\'' KENTRY   {$$=newconst(CSTquote,&@$);}
     129         112 :     | history           {$$=$1;}
     130         315 :     | expr '(' listarg ')'  {$$=newnode(Fcall,$1,$3,&@$);}
     131      147200 :     | funcid            {$$=$1;}
     132      210149 :     | lvalue %prec LVAL {$$=$1;}
     133     3846906 :     | matrix            {$$=$1;}
     134         574 :     | compr             {$$=$1;}
     135        7860 :     | definition        {$$=$1;}
     136         784 :     | matrix '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     137       35349 :     | lvalue '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     138         133 :     | lvalue "++"     {$$=newopcall(OPpp,$1,-1,&@$);}
     139          14 :     | lvalue "--"     {$$=newopcall(OPss,$1,-1,&@$);}
     140         156 :     | lvalue "*="   expr {$$=newopcall(OPme,$1,$3,&@$);}
     141          35 :     | lvalue "/="   expr {$$=newopcall(OPde,$1,$3,&@$);}
     142           7 :     | lvalue "\\/=" expr {$$=newopcall(OPdre,$1,$3,&@$);}
     143           7 :     | lvalue "\\="  expr {$$=newopcall(OPeuce,$1,$3,&@$);}
     144           7 :     | lvalue "%="   expr {$$=newopcall(OPmode,$1,$3,&@$);}
     145           7 :     | lvalue "<<="  expr {$$=newopcall(OPsle,$1,$3,&@$);}
     146           7 :     | lvalue ">>="  expr {$$=newopcall(OPsre,$1,$3,&@$);}
     147         152 :     | lvalue "+="   expr {$$=newopcall(OPpe,$1,$3,&@$);}
     148          49 :     | lvalue "-="   expr {$$=newopcall(OPse,$1,$3,&@$);}
     149         455 :     | '!' expr         {$$=newopcall(OPnb,$2,-1,&@$);}
     150        3009 :     | '#' expr         {$$=newopcall(OPlength,$2,-1,&@$);}
     151         294 :     | expr "||"  expr  {$$=newopcall(OPor,$1,$3,&@$);}
     152         665 :     | expr "&&"  expr  {$$=newopcall(OPand,$1,$3,&@$);}
     153           0 :     | expr '&'   expr  {$$=newopcall(OPand,$1,$3,&@$);}
     154         343 :     | expr "===" expr  {$$=newopcall(OPid,$1,$3,&@$);}
     155        8109 :     | expr "=="  expr  {$$=newopcall(OPeq,$1,$3,&@$);}
     156        1771 :     | expr "!="  expr  {$$=newopcall(OPne,$1,$3,&@$);}
     157          65 :     | expr ">="  expr  {$$=newopcall(OPge,$1,$3,&@$);}
     158         329 :     | expr '>'   expr  {$$=newopcall(OPg,$1,$3,&@$);}
     159         170 :     | expr "<="  expr  {$$=newopcall(OPle,$1,$3,&@$);}
     160         389 :     | expr '<'   expr  {$$=newopcall(OPl,$1,$3,&@$);}
     161       17757 :     | expr '-'   expr  {$$=newopcall(OPs,$1,$3,&@$);}
     162       38571 :     | expr '+'   expr  {$$=newopcall(OPp,$1,$3,&@$);}
     163         105 :     | expr "<<"  expr  {$$=newopcall(OPsl,$1,$3,&@$);}
     164          21 :     | expr ">>"  expr  {$$=newopcall(OPsr,$1,$3,&@$);}
     165         406 :     | expr '%'   expr  {$$=newopcall(OPmod,$1,$3,&@$);}
     166          28 :     | expr "\\/" expr  {$$=newopcall(OPdr,$1,$3,&@$);}
     167         133 :     | expr '\\'  expr  {$$=newopcall(OPeuc,$1,$3,&@$);}
     168      119343 :     | expr '/'   expr  {$$=newopcall(OPd,$1,$3,&@$);}
     169       36601 :     | expr '*'   expr  {$$=newopcall(OPm,$1,$3,&@$);}
     170          63 :     | '+' expr %prec SIGN {$$=$2;}
     171     2379103 :     | '-' expr %prec SIGN {$$=newopcall(OPn,$2,-1,&@$);}
     172       49806 :     | expr '^' expr {$$=newopcall(OPpow,$1,$3,&@$);}
     173        3458 :     | expr '~' {$$=newopcall(OPtrans,$1,-1,&@$);}
     174         140 :     | expr deriv %prec DERIV {$$=newopcall(OPderivn,$1, newnode(Fsmall,$2,-1,&@$),&@$);}
     175         194 :     | expr '!'  {$$=newopcall(OPfact,$1,-1,&@$);}
     176        3112 :     | expr matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     177       11263 :     | memberid {$$=$1;}
     178           0 :     | expr ':' KENTRY   {$$=newnode(Ftag,$1,0,&@$);}
     179       10169 :     | '(' expr ')' {$$=$2;}
     180             : ;
     181             : 
     182      249041 : lvalue: KENTRY %prec LVAL   {$$=newnode(Fentry,newconst(CSTentry,&@1),-1,&@$);}
     183        7365 :       | lvalue matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     184           0 :       | lvalue ':' KENTRY   {$$=newnode(Ftag,$1,newconst(CSTentry,&@2),&@$);}
     185             : ;
     186             : 
     187     3337594 : matrixelts: expr {$$=$1;}
     188     9033704 :           | matrixelts ',' expr {$$=newnode(Fmatrixelts,$1,$3,&@$);}
     189             : ;
     190             : 
     191        7812 : matrixlines: matrixelts  ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     192       20125 :            | matrixlines ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     193             : ;
     194             : 
     195      536753 : matrix: '[' ']'             {$$=newnode(Fvec,-1,-1,&@$);}
     196         475 :       | '[' expr ".." expr ']' {$$=newopcall(OPrange,$2,$4,&@$);}
     197         805 :       | '[' ';' ']'         {$$=newnode(Fmat,-1,-1,&@$);}
     198     3301845 :       | '[' matrixelts ']'  {$$=newnode(Fvec,$2,-1,&@$);}
     199        7812 :       | '[' matrixlines ']' {$$=newnode(Fmat,$2,-1,&@$);}
     200           0 :       | '[' error ']'       {$$=-1; YYABORT;}
     201             : ;
     202             : 
     203         665 : in: lvalue '<' '-' expr {$$=newnode(Flistarg,$4,$1,&@$);}
     204             : ;
     205             : 
     206         441 : inseq: in                    {$$=newopcall(OPcompr,$1,-2,&@$);}
     207         133 :      | in ',' expr           {$$=newopcall3(OPcompr,$1,-2,$3,&@$);}
     208          77 :      | in ';' inseq          {$$=newopcall(OPcomprc,$1,$3,&@$);}
     209          14 :      | in ',' expr ';' inseq {$$=newopcall3(OPcomprc,$1,$5,$3,&@$);}
     210             : ;
     211             : 
     212         574 : compr: '[' expr '|' inseq ']' {$$=addcurrexpr($4,$2,&@$);}
     213             : ;
     214             : 
     215      280269 : arg: seq        {$$=$1;}
     216          21 :    | lvalue '[' ".." ']' {$$=newnode(Fvararg,$1,-1,&@$);}
     217         994 :    | '&' lvalue {$$=newnode(Frefarg,$2,-1,&@$);}
     218         308 :    | '~' lvalue {$$=newnode(Findarg,$2,-1,&@$);}
     219         112 :    | arg error  {if (!pari_once) { yyerrok; } pari_once=1;}  expr
     220         112 :                      {pari_once=0; $$=newopcall(OPcat,$1,$4,&@$);}
     221             : ;
     222             : 
     223      154380 : listarg: arg {$$=$1;}
     224      127212 :        | listarg ',' arg {$$=newnode(Flistarg,$1,$3,&@$);}
     225             : ;
     226             : 
     227      147200 : funcid: KENTRY '(' listarg ')' {$$=newnode(Ffunction,newconst(CSTentry,&@1),$3,&@$);}
     228             : ;
     229             : 
     230       11263 : memberid: expr '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),$1,&@$);}
     231             : ;
     232             : 
     233             : definition: KENTRY '(' listarg ')' '=' seq %prec DEFFUNC
     234        2962 :                                    {$$=newfunc(CSTentry,&@1,$3,$6,&@$);}
     235             :           | expr '.' KENTRY '=' seq %prec DEFFUNC
     236          14 :                                    {$$=newfunc(CSTmember,&@3,newnode(Findarg,$1,-1,&@1),$5,&@$);}
     237         981 :           | lvalue "->" seq              {$$=newnode(Flambda, $1,$3,&@$);}
     238        3903 :           | '(' listarg ")->" seq        {$$=newnode(Flambda, $2,$4,&@$);}
     239             : ;
     240             : 
     241             : %%

Generated by: LCOV version 1.13