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-bordeaux1.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 - gp - gp_init.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.8.0 lcov report (development 16741-1378b1c) Lines: 18 22 81.8 %
Date: 2014-08-17 Functions: 5 6 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 12 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* Copyright (C) 2000  The PARI group.
       2                 :            : 
       3                 :            : This file is part of the PARI/GP package.
       4                 :            : 
       5                 :            : PARI/GP is free software; you can redistribute it and/or modify it under the
       6                 :            : terms of the GNU General Public License as published by the Free Software
       7                 :            : Foundation. It is distributed in the hope that it will be useful, but WITHOUT
       8                 :            : ANY WARRANTY WHATSOEVER.
       9                 :            : 
      10                 :            : Check the License for details. You should have received a copy of it, along
      11                 :            : with the package; see the file 'COPYING'. If not, write to the Free Software
      12                 :            : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      13                 :            : 
      14                 :            : /*******************************************************************/
      15                 :            : /*                                                                 */
      16                 :            : /*                    GP-SPECIFIC FUNCTIONS                        */
      17                 :            : /*                                                                 */
      18                 :            : /*******************************************************************/
      19                 :            : #include "pari.h"
      20                 :            : #include "paripriv.h"
      21                 :            : #include "../graph/rect.h"
      22                 :            : #include "gp.h"
      23                 :            : 
      24                 :         25 : static void whatnow0(char *s) { whatnow(pariOut, s,0); }
      25                 :            : 
      26                 :            : static void
      27                 :         55 : allocatemem0(GEN z)
      28                 :            : {
      29                 :            :   ulong newsize;
      30         [ -  + ]:         55 :   if (!z) newsize = 0;
      31                 :            :   else {
      32         [ -  + ]:         55 :     if (typ(z) != t_INT) pari_err_TYPE("allocatemem",z);
      33                 :         55 :     newsize = itou(z);
      34         [ -  + ]:         55 :     if (signe(z) < 0) pari_err_DOMAIN("allocatemem","size","<",gen_0,z);
      35                 :            :   }
      36         [ -  + ]:         55 :   if (pari_mainstack->vsize)
      37                 :          0 :     paristack_resize(newsize);
      38                 :            :   else
      39                 :         55 :     paristack_newrsize(newsize);
      40                 :          0 : }
      41                 :            : 
      42                 :            : #include "gp_init.h"
      43                 :            : #include "gp_default.h"
      44                 :            : 
      45                 :            : /* Backward Compatibility */
      46                 :            : 
      47                 :            : static GEN
      48                 :          5 : gtype(GEN x)
      49                 :            : {
      50                 :          5 :   return stoi(typ(x));
      51                 :            : }
      52                 :            : 
      53                 :            : static GEN
      54                 :          0 : gsettype(GEN x,long t)
      55                 :            : {
      56                 :          0 :   x=gcopy(x); settyp(x,t); return x;
      57                 :            : }
      58                 :            : 
      59                 :            : static long
      60                 :          5 : setserieslength(long n)
      61                 :            : {
      62                 :          5 :   long m=precdl;
      63         [ +  - ]:          5 :   if(n>0) precdl=n;
      64                 :          5 :   return m;
      65                 :            : }
      66                 :            : 
      67                 :            : static long
      68                 :          5 : setprecr(long n)
      69                 :            : {
      70                 :          5 :   long m = GP_DATA->fmt->sigd;
      71         [ +  - ]:          5 :   if (n > 0) { GP_DATA->fmt->sigd = n; precreal = ndec2prec(n); }
      72                 :          5 :   return m;
      73                 :            : }
      74                 :            : 
      75                 :            : entree functions_oldgp[] = {
      76                 :            : {"allocatemem",11,(void *)allocatemem0,2,"vLp","allocatemem(s)=allocates a new stack of s bytes, or doubles the stack if size is 0"},
      77                 :            : {"box",35,(void *)rectbox,10,"vLGG","box(w,x2,y2)=if the cursor is at position (x1,y1), draw a box with diagonal (x1,y1) and (x2,y2) in rectwindow w (cursor does not move)"},
      78                 :            : {"color",2,(void *)rectcolor,2,"vLL","color(w,c)=set default color to c in rectwindow. Possible values for c are 1=sienna, 2=cornsilk, 3=red, 4=black, 5=grey, 6=blue, 7=gainsborough"},
      79                 :            : {"cursor",11,(void*)rectcursor,10,"vLp","cursor(w)=current position of cursor in rectwindow w"},
      80                 :            : {"default",0,(void*)default0,11,"D\"\",r,D\"\",s,D0,L,","default({opt},{v},{flag}): set the default opt to v. If v is omitted, print the current default for opt. If no argument is given, print a list of all defaults as well as their values. If flag is non-zero, return the result instead of printing it on screen. See manual for details"},
      81                 :            : {"draw",1,(void*)rectdraw,10,"vGp","draw(list)=draw vector of rectwindows list at indicated x,y positions; list is a vector w1,x1,y1,w2,x2,y2,etc..."},
      82                 :            : {"initrect",34,(void*)initrect,10,"vLLL","initrect(w,x,y)=initialize rectwindow w to size x,y"},
      83                 :            : {"kill",85,(void*)kill0,11,"vr","kill(x)=kills the present value of the variable or function x. Returns new value or 0"},
      84                 :            : {"killrect",11,(void *)killrect,10,"vL","killrect(w)=erase the rectwindow w"},
      85                 :            : {"line",35,(void *)rectline,10,"vLGG","line(w,x2,y2)=if cursor is at position (x1,y1), draw a line from (x1,y1) to (x2,y2) (and move the cursor) in the rectwindow w"},
      86                 :            : {"lines",35,(void *)rectlines,10,"vLGG","lines(w,listx,listy)=draws an open polygon in rectwindow w where listx and listy contain the x (resp. y) coordinates of the vertices"},
      87                 :            : {"move",35,(void*)rectmove,10,"vLGG","move(w,x,y)=move cursor to position x,y in rectwindow w"},
      88                 :            : {"plot",99,(void *)plot,10,"vV=GGEDGDGp","plot(X=a,b,expr)=crude plot of expression expr, X goes from a to b"},
      89                 :            : {"ploth",37,(void *)ploth,10,"V=GGEp","ploth(X=a,b,expr)=plot of expression expr, X goes from a to b in high resolution"},
      90                 :            : {"ploth2",37,(void *)ploth2,10,"V=GGEp","ploth2(X=a,b,[expr1,expr2])=plot of points [expr1,expr2], X goes from a to b in high resolution"},
      91                 :            : {"plothmult",37,(void *)plothmult,10,"V=GGEp","plothmult(X=a,b,[expr1,...])=plot of expressions expr1,..., X goes from a to b in high resolution"},
      92                 :            : {"plothraw",2,(void *)plothraw,10,"GGp","plothraw(listx,listy)=plot in high resolution points whose x (resp. y) coordinates are in listx (resp. listy)"},
      93                 :            : {"point",35,(void *)rectpoint,10,"vLGG","point(w,x,y)=draw a point (and move cursor) at position x,y in rectwindow w"},
      94                 :            : {"points",35,(void *)rectpoints,10,"vLGG","points(w,listx,listy)=draws in rectwindow w the points whose x (resp y) coordinates are in listx (resp listy)"},
      95                 :            : {"postdraw",1,(void *)postdraw,10,"vG","postdraw(list)=same as plotdraw, except that the output is a PostScript program in file \"pari.ps\""},
      96                 :            : {"postploth",37,(void *)postploth,10,"V=GGEpD0,L,D0,L,","postploth(X=a,b,expr)=same as ploth, except that the output is a PostScript program in the file \"pari.ps\""},
      97                 :            : {"postploth2",37,(void *)postploth2,10,"V=GGEpD0,L,","postploth2(X=a,b,[expr1,expr2])=same as ploth2, except that the output is a PostScript program in the file \"pari.ps\""},
      98                 :            : {"postplothraw",2,(void *)postplothraw,10,"GGD0,L,","postplothraw(listx,listy)=same as plothraw, except that the output is a PostScript program in the file \"pari.ps\""},
      99                 :            : {"pprint",0,(void*)print,11,"vs*","pprint(a)=outputs a in beautified format ending with newline"},
     100                 :            : {"pprint1",0,(void*)print1,11,"vs*","pprint1(a)=outputs a in beautified format without ending with newline"},
     101                 :            : {"print",0,(void*)print,11,"vs*","print(a)=outputs a in raw format ending with newline"},
     102                 :            : {"print1",0,(void*)print1,11,"vs*","print1(a)=outputs a in raw format without ending with newline"},
     103                 :            : {"rbox",35,(void *)rectrbox,10,"vLGG","rbox(w,dx,dy)=if the cursor is at (x1,y1), draw a box with diagonal (x1,y1)-(x1+dx,y1+dy) in rectwindow w (cursor does not move)"},
     104                 :            : {"read",0,(void *)input0,11,"","read()=read an expression from the input file or standard input"},
     105                 :            : {"rline",35,(void *)rectrline,10,"vLGG","rline(w,dx,dy)=if the cursor is at (x1,y1), draw a line from (x1,y1) to (x1+dx,y1+dy) (and move the cursor) in the rectwindow w"},
     106                 :            : {"rlines",35,(void *)rectlines,10,"vLGG","rlines(w,dx,dy)=draw in rectwindow w the points given by vector of first coordinates xsand vector of second coordinates, connect them by lines"},
     107                 :            : {"rmove",35,(void *)rectrmove,10,"vLGG","rmove(w,dx,dy)=move cursor to position (dx,dy) relative to the present position in the rectwindow w"},
     108                 :            : {"rpoint",35,(void *)rectrpoint,10,"vLGG","rpoint(w,dx,dy)=draw a point (and move cursor) at position dx,dy relative to present position of the cursor in rectwindow w"},
     109                 :            : {"rpoints",35,(void *)rectpoints,10,"vLGG","rpoints(w,xs,ys)=draw in rectwindow w the points given by vector of first coordinates xs and vector of second coordinates ys"},
     110                 :            : {"scale",59,(void *)rectscale,10,"vLGGGG","scale(w,x1,x2,y1,y2)=scale the coordinates in rectwindow w so that x goes from x1 to x2 and y from y1 to y2 (y2<y1 is allowed)"},
     111                 :            : {"setprecision",15,(void *)setprecr,2,"lL","setprecision(n)=set the current precision to n decimal digits if n>0, or return the current precision if n<=0"},
     112                 :            : {"setserieslength",15,(void *)setserieslength,2,"lL","setserieslength(n)=set the default length of power series to n if n>0, or return the current default length if n<=0"},
     113                 :            : {"settype",21,(void *)gsettype,2,"GL","settype(x,t)=make a copy of x with type t (to use with extreme care)"},
     114                 :            : {"string",57,(void*)rectstring,10,"vLs","string(w,x)=draw in rectwindow w the string corresponding to x, where x is either a string, or a number in R, written in format 9.3"},
     115                 :            : {"system",70,(void*) system0,11,"vs","system(a): a being a string, execute the system command a (not valid on every machine)"},
     116                 :            : {"texprint",0,(void*)printtex,11,"vs*","texprint(a)=outputs a in TeX format"},
     117                 :            : {"type",1,(void *)gtype,2,"Gp","type(x)=internal type number of the GEN x"},
     118                 :            : 
     119                 :            : {NULL,0,NULL,0,NULL,NULL} /* sentinel */
     120                 :            : ,};

Generated by: LCOV version 1.9