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 - modules - galpol.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.8.0 lcov report (development 16746-c2cb716) Lines: 26 28 92.9 %
Date: 2014-08-31 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 17 25 68.0 %

           Branch data     Line data    Source code
       1                 :            : /* Copyright (C) 2000-2003  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                 :            : #include "pari.h"
      15                 :            : #include "paripriv.h"
      16                 :            : 
      17                 :            : GEN
      18                 :         10 : galoisnbpol(long a)
      19                 :            : {
      20                 :            :   GEN n;
      21                 :            :   pariFILE *F;
      22                 :         10 :   char *s = stack_malloc(strlen(pari_datadir) + 11 + 20 + 1);
      23                 :         10 :   sprintf(s,"%s/galpol/%ld/nb", pari_datadir, a);
      24                 :         10 :   F = pari_fopengz(s);
      25         [ -  + ]:         10 :   if (!F) pari_err_FILE("galpol file",s);
      26                 :         10 :   n = gp_read_stream(F->file);
      27 [ +  - ][ -  + ]:         10 :   if (!n || typ(n)!=t_INT) pari_err_FILE("galpol file [incompatible]",s);
      28                 :         10 :   pari_fclose(F); return n;
      29                 :            : }
      30                 :            : 
      31                 :            : GEN
      32                 :        170 : galoisgetpol(long a, long b, long sig)
      33                 :            : {
      34                 :            :   pariFILE *F;
      35                 :            :   GEN V;
      36                 :            :   const char *si;
      37                 :            :   char *s;
      38         [ -  + ]:        170 :   if (a<=0) pari_err_DOMAIN("galoisgetpol", "degree", "<=", gen_0, stoi(a));
      39         [ -  + ]:        170 :   if (b<0) pari_err_DOMAIN("galoisgetpol", "index", "<", gen_0, stoi(b));
      40         [ +  + ]:        170 :   if (!b) return galoisnbpol(a);
      41      [ +  +  + ]:        165 :   switch(sig)
      42                 :            :   {
      43                 :        130 :     case 1: si="real"; break;
      44         [ +  + ]:         30 :     case 2: if (a%2==0) { si="complex"; break; }
      45                 :          5 :       pari_err_DOMAIN("galoisgetpol", "s", ">", gen_1, stoi(sig));
      46                 :            :     default:
      47                 :          5 :       pari_err_FLAG("galoisgetpol");
      48                 :          0 :       return NULL;
      49                 :            :   }
      50                 :        155 :   s = pari_sprintf("%s/galpol/%ld/%ld/%s", pari_datadir, a,b,si);
      51                 :        155 :   F = pari_fopengz(s); pari_free(s);
      52         [ +  + ]:        155 :   if (!F)
      53                 :            :   {
      54                 :          5 :     long n = itos(galoisnbpol(a));
      55         [ +  - ]:          5 :     if (b > n)
      56                 :          5 :       pari_err_DOMAIN("galoisgetpol", "group index", ">", stoi(n), stoi(b));
      57                 :          0 :     else pari_err_FILE("galpol file", F->name);
      58                 :            :   }
      59                 :        150 :   V = gp_read_stream(F->file);
      60 [ +  - ][ -  + ]:        150 :   if (!V || typ(V)!=t_VEC) pari_err_FILE("galpol file", F->name);
      61                 :        155 :   pari_fclose(F); return V;
      62                 :            : }
      63                 :            : 

Generated by: LCOV version 1.9