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 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.8.0 lcov report (development 19355-c7ae729) Lines: 123 129 95.3 %
Date: 2016-08-26 06:12: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 YYSIZE_T size_t
      16             : #define YYSTYPE union token_value
      17             : #define YYLTYPE struct node_loc
      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             : %error-verbose
      26             : %name-prefix "pari_"
      27             : %pure-parser
      28             : %parse-param {char **lex}
      29             : %lex-param {char **lex}
      30       79745 : %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 '!' '~' '[' '\''
      72             : %left '.'
      73             : %left "++" "--"
      74             : %left '('
      75             : %left ':'
      76             : %type <val> seq sequence
      77             : %type <val> range matrix matrix_index expr
      78             : %type <val> lvalue
      79             : %type <val> matrixelts matrixlines arg listarg definition
      80             : %type <val> funcid memberid
      81             : %type <val> backticks history
      82             : %type <val> compr in inseq
      83           0 : %destructor { pari_discarded++; } seq matrix range matrix_index expr lvalue matrixelts matrixlines arg listarg definition funcid memberid backticks history compr in inseq
      84             : %%
      85             : 
      86       79745 : sequence: seq        {$$=$1;} /* skip the destructor */
      87       79745 : ;
      88             : 
      89       10248 : seq: /**/ %prec SEQ  {$$=NOARG(@$);}
      90       10248 :    | expr %prec SEQ  {$$=$1;}
      91      300833 :    | seq ';'         {$$=$1; @$=@1;}
      92       23347 :    | seq ';' expr    {$$=newnode(Fseq,$1,$3,&@$);}
      93       18378 : ;
      94             : 
      95         392 : range: /* */          { $$=newnode(Frange,NORANGE(@$),NORANGE(@$),&@$); }
      96         392 :      | expr           { $$=newnode(Frange,$1,NORANGE(@$),&@$); }
      97        6584 :      | expr ".." expr { $$=newnode(Frange,$1,$3,&@$); }
      98         322 :      | '^' expr       { $$=newnode(Frange,NORANGE(@$),$2,&@$); }
      99          63 : ;
     100             : 
     101         693 : matrix_index: '[' range ',' range ']' {$$=newnode(Fmatrix,$2,$4,&@$);}
     102         693 :             | '[' range ']'           {$$=newnode(Fmatrix,$2,-1,&@$);}
     103        5975 : ;
     104             : 
     105          35 : backticks: '`' {$$=1;}
     106          35 :          | backticks '`' {$$=$1+1;}
     107          84 : ;
     108             : 
     109          49 : history: '%'           {$$=newopcall(OPhist,-1,-1,&@$);}
     110          49 :        | '%' KINTEGER  {$$=newopcall(OPhist,newintnode(&@2),-1,&@$);}
     111          14 :        | '%' backticks {$$=newopcall(OPhist,newnode(Fsmall,-$2,-1,&@$),-1,&@$);}
     112          28 :        | '%' '#'          {$$=newopcall(OPhisttime,-1,-1,&@$);}
     113           7 :        | '%' '#' KINTEGER {$$=newopcall(OPhisttime,newintnode(&@3),-1,&@$);}
     114           7 :        | '%' '#' backticks{$$=newopcall(OPhisttime,newnode(Fsmall,-$3,-1,&@$),-1,&@$);}
     115           7 : ;
     116             : 
     117     7398477 : expr: KINTEGER %prec INT  {$$=newintnode(&@1);}
     118     7398477 :     | KREAL               {$$=newconst(CSTreal,&@$);}
     119        2206 :     | '.'                 {$$=newconst(CSTreal,&@$);}
     120           0 :     | KINTEGER '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),
     121             :                                                 newintnode(&@1),&@$);}
     122           0 :     | KSTRING       {$$=newconst(CSTstr,&@$);}
     123     1107825 :     | '\'' KENTRY   {$$=newconst(CSTquote,&@$);}
     124        2142 :     | history           {$$=$1;}
     125         112 :     | expr '(' listarg ')'  {$$=newnode(Fcall,$1,$3,&@$);}
     126         217 :     | funcid            {$$=$1;}
     127      112279 :     | lvalue %prec LVAL {$$=$1;}
     128      155771 :     | matrix            {$$=$1;}
     129     3798359 :     | compr             {$$=$1;}
     130         441 :     | definition        {$$=$1;}
     131        6700 :     | matrix '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     132         336 :     | lvalue '=' expr {$$=newnode(Fassign,$1,$3,&@$);}
     133       26358 :     | lvalue "++"     {$$=newopcall(OPpp,$1,-1,&@$);}
     134          70 :     | lvalue "--"     {$$=newopcall(OPss,$1,-1,&@$);}
     135          14 :     | lvalue "*="   expr {$$=newopcall(OPme,$1,$3,&@$);}
     136         156 :     | lvalue "/="   expr {$$=newopcall(OPde,$1,$3,&@$);}
     137           7 :     | lvalue "\\/=" expr {$$=newopcall(OPdre,$1,$3,&@$);}
     138           7 :     | lvalue "\\="  expr {$$=newopcall(OPeuce,$1,$3,&@$);}
     139           7 :     | lvalue "%="   expr {$$=newopcall(OPmode,$1,$3,&@$);}
     140           7 :     | lvalue "<<="  expr {$$=newopcall(OPsle,$1,$3,&@$);}
     141           7 :     | lvalue ">>="  expr {$$=newopcall(OPsre,$1,$3,&@$);}
     142           7 :     | lvalue "+="   expr {$$=newopcall(OPpe,$1,$3,&@$);}
     143         103 :     | lvalue "-="   expr {$$=newopcall(OPse,$1,$3,&@$);}
     144          35 :     | '!' expr         {$$=newopcall(OPnb,$2,-1,&@$);}
     145         336 :     | '#' expr         {$$=newopcall(OPlength,$2,-1,&@$);}
     146        2106 :     | expr "||"  expr  {$$=newopcall(OPor,$1,$3,&@$);}
     147         259 :     | expr "&&"  expr  {$$=newopcall(OPand,$1,$3,&@$);}
     148         609 :     | expr '&'   expr  {$$=newopcall(OPand,$1,$3,&@$);}
     149           0 :     | expr "===" expr  {$$=newopcall(OPid,$1,$3,&@$);}
     150         329 :     | expr "=="  expr  {$$=newopcall(OPeq,$1,$3,&@$);}
     151        6243 :     | expr "!="  expr  {$$=newopcall(OPne,$1,$3,&@$);}
     152         987 :     | expr ">="  expr  {$$=newopcall(OPge,$1,$3,&@$);}
     153          58 :     | expr '>'   expr  {$$=newopcall(OPg,$1,$3,&@$);}
     154         224 :     | expr "<="  expr  {$$=newopcall(OPle,$1,$3,&@$);}
     155         163 :     | expr '<'   expr  {$$=newopcall(OPl,$1,$3,&@$);}
     156         806 :     | expr '-'   expr  {$$=newopcall(OPs,$1,$3,&@$);}
     157       13402 :     | expr '+'   expr  {$$=newopcall(OPp,$1,$3,&@$);}
     158       30369 :     | expr "<<"  expr  {$$=newopcall(OPsl,$1,$3,&@$);}
     159         105 :     | expr ">>"  expr  {$$=newopcall(OPsr,$1,$3,&@$);}
     160          21 :     | expr '%'   expr  {$$=newopcall(OPmod,$1,$3,&@$);}
     161         238 :     | expr "\\/" expr  {$$=newopcall(OPdr,$1,$3,&@$);}
     162          28 :     | expr '\\'  expr  {$$=newopcall(OPeuc,$1,$3,&@$);}
     163          98 :     | expr '/'   expr  {$$=newopcall(OPd,$1,$3,&@$);}
     164      115614 :     | expr '*'   expr  {$$=newopcall(OPm,$1,$3,&@$);}
     165       30736 :     | '+' expr %prec SIGN {$$=$2;}
     166          63 :     | '-' expr %prec SIGN {$$=newopcall(OPn,$2,-1,&@$);}
     167     2268004 :     | expr '^' expr {$$=newopcall(OPpow,$1,$3,&@$);}
     168       39276 :     | expr '~' {$$=newopcall(OPtrans,$1,-1,&@$);}
     169        2261 :     | expr '\'' {$$=newopcall(OPderiv,$1,-1,&@$);}
     170          84 :     | expr '!'  {$$=newopcall(OPfact,$1,-1,&@$);}
     171         171 :     | expr matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     172        1971 :     | memberid {$$=$1;}
     173        9968 :     | expr ':' KENTRY   {$$=newnode(Ftag,$1,0,&@$);}
     174           0 :     | '(' expr ')' {$$=$2;}
     175        7706 : ;
     176             : 
     177      184443 : lvalue: KENTRY %prec LVAL   {$$=newnode(Fentry,newconst(CSTentry,&@1),-1,&@$);}
     178      184443 :       | lvalue matrix_index {$$=newnode(Fmatcoeff,$1,$2,&@$);}
     179        4697 :       | lvalue ':' KENTRY   {$$=newnode(Ftag,$1,newconst(CSTentry,&@2),&@$);}
     180           0 : ;
     181             : 
     182     3285543 : matrixelts: expr {$$=$1;}
     183     3285543 :           | matrixelts ',' expr {$$=newnode(Fmatrixelts,$1,$3,&@$);}
     184     8731023 : ;
     185             : 
     186        6412 : matrixlines: matrixelts  ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     187        6412 :            | matrixlines ';' matrixelts {$$=newnode(Fmatrixlines,$1,$3,&@$);}
     188       17689 : ;
     189             : 
     190      536312 : matrix: '[' ']'             {$$=newnode(Fvec,-1,-1,&@$);}
     191      536312 :       | '[' expr ".." expr ']' {$$=newopcall(OPrange,$2,$4,&@$);}
     192         269 :       | '[' ';' ']'         {$$=newnode(Fmat,-1,-1,&@$);}
     193         672 :       | '[' matrixelts ']'  {$$=newnode(Fvec,$2,-1,&@$);}
     194     3255030 :       | '[' matrixlines ']' {$$=newnode(Fmat,$2,-1,&@$);}
     195        6412 :       | '[' error ']'       {$$=-1; YYABORT;}
     196             : ;
     197             : 
     198         532 : in: lvalue '<' '-' expr {$$=newnode(Flistarg,$4,$1,&@$);}
     199         532 : ;
     200             : 
     201         336 : inseq: in                    {$$=newopcall(OPcompr,$1,-2,&@$);}
     202         336 :      | in ',' expr           {$$=newopcall3(OPcompr,$1,-2,$3,&@$);}
     203         105 :      | in ';' inseq          {$$=newopcall(OPcomprc,$1,$3,&@$);}
     204          77 :      | in ',' expr ';' inseq {$$=newopcall3(OPcomprc,$1,$5,$3,&@$);}
     205          14 : ;
     206             : 
     207         441 : compr: '[' expr '|' inseq ']' {$$=addcurrexpr($4,$2,&@$);}
     208         441 : ;
     209             : 
     210      224636 : arg: seq        {$$=$1;}
     211      224636 :    | lvalue '[' ".." ']' {$$=newnode(Fvararg,$1,-1,&@$);}
     212          21 :    | '&' lvalue {$$=newnode(Frefarg,$2,-1,&@$);}
     213         630 :    | arg error  {if (!pari_once) { yyerrok; } pari_once=1;}  expr
     214         126 :                      {pari_once=0; $$=newopcall(OPcat,$1,$4,&@$);}
     215         126 : ;
     216             : 
     217      118478 : listarg: arg {$$=$1;}
     218      118478 :        | listarg ',' arg {$$=newnode(Flistarg,$1,$3,&@$);}
     219      106809 : ;
     220             : 
     221      112279 : funcid: KENTRY '(' listarg ')' {$$=newnode(Ffunction,newconst(CSTentry,&@1),$3,&@$);}
     222      112279 : ;
     223             : 
     224        9968 : memberid: expr '.' KENTRY {$$=newnode(Ffunction,newconst(CSTmember,&@3),$1,&@$);}
     225        9968 : ;
     226             : 
     227             : definition: KENTRY '(' listarg ')' '=' seq %prec DEFFUNC
     228        2123 :                                    {$$=newfunc(CSTentry,&@1,$3,$6,&@$);}
     229        2123 :           | expr '.' KENTRY '=' seq %prec DEFFUNC
     230           7 :                                    {$$=newfunc(CSTmember,&@3,$1,$5,&@$);}
     231           7 :           | lvalue "->" seq              {$$=newnode(Flambda, $1,$3,&@$);}
     232         711 :           | '(' listarg ")->" seq        {$$=newnode(Flambda, $2,$4,&@$);}
     233        3859 : ;
     234             : 
     235             : %%

Generated by: LCOV version 1.11