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 - modules - galpol.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.14.0 lcov report (development 27102-e8476a37b5) Lines: 46 55 83.6 %
Date: 2021-12-02 07:05:14 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright (C) 2000-2018  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; either version 2 of the License, or (at your option) any later
       8             : version. 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             : #include "pari.h"
      16             : #include "paripriv.h"
      17             : 
      18             : GEN
      19         231 : galoisnbpol(long a)
      20             : {
      21             :   GEN n;
      22             :   pariFILE *F;
      23         231 :   char *s = stack_malloc(strlen(pari_datadir) + 11 + 20 + 1);
      24         231 :   sprintf(s,"%s/galpol/%ld/nb", pari_datadir, a);
      25         231 :   F = pari_fopengz(s);
      26         231 :   if (!F) pari_err_FILE("galpol file",s);
      27         231 :   n = gp_read_stream(F->file);
      28         231 :   if (!n || typ(n)!=t_INT) pari_err_FILE("galpol file [incompatible]",s);
      29         231 :   pari_fclose(F); return n;
      30             : }
      31             : 
      32             : GEN
      33         952 : galoisgetpol(long a, long b, long sig)
      34             : {
      35             :   pariFILE *F;
      36             :   GEN V;
      37             :   const char *si;
      38             :   char *s;
      39         952 :   if (a<=0) pari_err_DOMAIN("galoisgetpol", "degree", "<=", gen_0, stoi(a));
      40         952 :   if (b<0) pari_err_DOMAIN("galoisgetpol", "index", "<", gen_0, stoi(b));
      41         952 :   if (!b) return galoisnbpol(a);
      42         728 :   switch(sig)
      43             :   {
      44         679 :     case 1: si="real"; break;
      45          42 :     case 2: if (a%2==0) { si="complex"; break; }
      46           7 :       pari_err_DOMAIN("galoisgetpol", "s", ">", gen_1, stoi(sig));
      47           7 :     default:
      48           7 :       pari_err_FLAG("galoisgetpol");
      49             :       return NULL;/*LCOV_EXCL_LINE*/
      50             :   }
      51             :   /* left on stack */
      52         714 :   s = stack_sprintf("%s/galpol/%ld/%ld/%s", pari_datadir, a,b,si);
      53         714 :   F = pari_fopengz(s);
      54         714 :   if (!F)
      55             :   {
      56           7 :     long n = itos(galoisnbpol(a));
      57           7 :     if (b > n)
      58           7 :       pari_err_DOMAIN("galoisgetpol", "group index", ">", stoi(n), stoi(b));
      59           0 :     else pari_err_FILE("galpol file", s);
      60             :   }
      61         707 :   V = gp_read_stream(F->file);
      62         707 :   if (!V || typ(V)!=t_VEC) pari_err_FILE("galpol file", F->name);
      63         707 :   pari_fclose(F); return V;
      64             : }
      65             : 
      66             : GEN
      67          35 : galoisgetgroup(long a, long b)
      68             : {
      69             :   pariFILE *F;
      70             :   GEN V;
      71             :   char *s;
      72          35 :   if (a<=0) pari_err_DOMAIN("galoisgetgroup", "degree", "<=", gen_0, stoi(a));
      73          35 :   if (b<0) pari_err_DOMAIN("galoisgetgroup", "index", "<", gen_0, stoi(b));
      74          35 :   if (!b) return galoisnbpol(a);
      75             :   /* left on stack */
      76          35 :   s = stack_sprintf("%s/galpol/%ld/%ld/group", pari_datadir, a,b);
      77          35 :   F = pari_fopengz(s);
      78          35 :   if (!F)
      79             :   {
      80           0 :     long n = itos(galoisnbpol(a));
      81           0 :     if (b > n)
      82           0 :       pari_err_DOMAIN("galoisgetgroup", "group index", ">", stoi(n), stoi(b));
      83           0 :     else pari_err_FILE("galpol file", s);
      84             :   }
      85          35 :   V = gp_read_stream(F->file);
      86          35 :   if (!V || typ(V)!=t_VEC) pari_err_FILE("galpol file", F->name);
      87          35 :   pari_fclose(F); return V;
      88             : }
      89             : 
      90             : GEN
      91          35 : galoisgetname(long a, long b)
      92             : {
      93             :   pariFILE *F;
      94             :   GEN V;
      95             :   char *s;
      96          35 :   if (a<=0) pari_err_DOMAIN("galoisgetname", "degree", "<=", gen_0, stoi(a));
      97          35 :   if (b<0) pari_err_DOMAIN("galoisgetname", "index", "<", gen_0, stoi(b));
      98             :   /* left on stack */
      99          35 :   s = stack_sprintf("%s/galpol/%ld/%ld/name", pari_datadir, a,b);
     100          35 :   F = pari_fopengz(s);
     101          35 :   if (!F)
     102             :   {
     103           0 :     long n = itos(galoisnbpol(a));
     104           0 :     if (b > n)
     105           0 :       pari_err_DOMAIN("galoisgetname", "group index", ">", stoi(n), stoi(b));
     106           0 :     else pari_err_FILE("galpol file", s);
     107             :   }
     108          35 :   V = gp_read_stream(F->file);
     109          35 :   if (!V || typ(V)!=t_STR) pari_err_FILE("galpol file", F->name);
     110          35 :   pari_fclose(F); return V;
     111             : }

Generated by: LCOV version 1.13