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.18.0 lcov report (development 29804-254f602fce) Lines: 45 54 83.3 %
Date: 2024-12-18 09:08:59 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_sprintf("%s/galpol/%ld/nb", pari_datadir, a);
      24         231 :   F = pari_fopengz(s);
      25         231 :   if (!F) pari_err_FILE("galpol file",s);
      26         231 :   n = gp_read_stream(F->file);
      27         231 :   if (!n || typ(n)!=t_INT) pari_err_FILE("galpol file [incompatible]",s);
      28         231 :   pari_fclose(F); return n;
      29             : }
      30             : 
      31             : GEN
      32         952 : galoisgetpol(long a, long b, long sig)
      33             : {
      34             :   pariFILE *F;
      35             :   GEN V;
      36             :   const char *si;
      37             :   char *s;
      38         952 :   if (a<=0) pari_err_DOMAIN("galoisgetpol", "degree", "<=", gen_0, stoi(a));
      39         952 :   if (b<0) pari_err_DOMAIN("galoisgetpol", "index", "<", gen_0, stoi(b));
      40         952 :   if (!b) return galoisnbpol(a);
      41         728 :   switch(sig)
      42             :   {
      43         679 :     case 1: si="real"; break;
      44          42 :     case 2: if (a%2==0) { si="complex"; break; }
      45           7 :       pari_err_DOMAIN("galoisgetpol", "s", ">", gen_1, stoi(sig));
      46           7 :     default:
      47           7 :       pari_err_FLAG("galoisgetpol");
      48             :       return NULL;/*LCOV_EXCL_LINE*/
      49             :   }
      50             :   /* left on stack */
      51         714 :   s = stack_sprintf("%s/galpol/%ld/%ld/%s", pari_datadir, a,b,si);
      52         714 :   F = pari_fopengz(s);
      53         714 :   if (!F)
      54             :   {
      55           7 :     long n = itos(galoisnbpol(a));
      56           7 :     if (b > n)
      57           7 :       pari_err_DOMAIN("galoisgetpol", "group index", ">", stoi(n), stoi(b));
      58           0 :     else pari_err_FILE("galpol file", s);
      59             :   }
      60         707 :   V = gp_read_stream(F->file);
      61         707 :   if (!V || typ(V)!=t_VEC) pari_err_FILE("galpol file", F->name);
      62         707 :   pari_fclose(F); return V;
      63             : }
      64             : 
      65             : GEN
      66          35 : galoisgetgroup(long a, long b)
      67             : {
      68             :   pariFILE *F;
      69             :   GEN V;
      70             :   char *s;
      71          35 :   if (a<=0) pari_err_DOMAIN("galoisgetgroup", "degree", "<=", gen_0, stoi(a));
      72          35 :   if (b<0) pari_err_DOMAIN("galoisgetgroup", "index", "<", gen_0, stoi(b));
      73          35 :   if (!b) return galoisnbpol(a);
      74             :   /* left on stack */
      75          35 :   s = stack_sprintf("%s/galpol/%ld/%ld/group", pari_datadir, a,b);
      76          35 :   F = pari_fopengz(s);
      77          35 :   if (!F)
      78             :   {
      79           0 :     long n = itos(galoisnbpol(a));
      80           0 :     if (b > n)
      81           0 :       pari_err_DOMAIN("galoisgetgroup", "group index", ">", stoi(n), stoi(b));
      82           0 :     else pari_err_FILE("galpol file", s);
      83             :   }
      84          35 :   V = gp_read_stream(F->file);
      85          35 :   if (!V || typ(V)!=t_VEC) pari_err_FILE("galpol file", F->name);
      86          35 :   pari_fclose(F); return V;
      87             : }
      88             : 
      89             : GEN
      90          35 : galoisgetname(long a, long b)
      91             : {
      92             :   pariFILE *F;
      93             :   GEN V;
      94             :   char *s;
      95          35 :   if (a<=0) pari_err_DOMAIN("galoisgetname", "degree", "<=", gen_0, stoi(a));
      96          35 :   if (b<0) pari_err_DOMAIN("galoisgetname", "index", "<", gen_0, stoi(b));
      97             :   /* left on stack */
      98          35 :   s = stack_sprintf("%s/galpol/%ld/%ld/name", pari_datadir, a,b);
      99          35 :   F = pari_fopengz(s);
     100          35 :   if (!F)
     101             :   {
     102           0 :     long n = itos(galoisnbpol(a));
     103           0 :     if (b > n)
     104           0 :       pari_err_DOMAIN("galoisgetname", "group index", ">", stoi(n), stoi(b));
     105           0 :     else pari_err_FILE("galpol file", s);
     106             :   }
     107          35 :   V = gp_read_stream(F->file);
     108          35 :   if (!V || typ(V)!=t_STR) pari_err_FILE("galpol file", F->name);
     109          35 :   pari_fclose(F); return V;
     110             : }

Generated by: LCOV version 1.16