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 - gp - whatnow.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.0 lcov report (development 29815-a300ec5c34) Lines: 32 32 100.0 %
Date: 2024-12-26 09:08:56 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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; 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             : #include "gp.h"
      18             : #include "whatnow.h"
      19             : 
      20             : static void
      21        2674 : msg(PariOUT *out, const char *s)
      22             : {
      23        2674 :   out_term_color(out, c_HELP);
      24        2674 :   out_print_text(out, s);
      25        2674 :   out_putc(out, '\n');
      26        2674 :   out_term_color(out, c_NONE);
      27        2674 : }
      28             : /* If flag = 0 (default): check if s existed in 1.39.15 and print verbosely
      29             :  * the answer.
      30             :  * Else: return 1 if function changed, 0 otherwise, and print help message
      31             :  * plus the above. */
      32             : int
      33        2751 : whatnow(PariOUT *out, const char *s, int flag)
      34             : {
      35             :   const char *def;
      36        2751 :   const whatnow_t *wp = whatnowlist;
      37             :   entree *ep;
      38             : 
      39     1036007 :   while (wp->old && strcmp(wp->old,s)) wp++;
      40             :   /* Above linear search is slow, esp. if the symbol is not found. BUT no
      41             :    * point in wasting time by preallocating [ or autoloading ] a hashtable:
      42             :    * whatnow() is never used in a case where speed would be necessary */
      43        2751 :   if (!wp->old)
      44             :   {
      45          63 :     if (!flag) msg(out, "This function did not exist in Pari 1.39");
      46          63 :     return 0;
      47             :   }
      48        2688 :   def = wp->name;
      49        2688 :   if (def == SAME)
      50             :   {
      51          14 :     if (!flag)
      52           7 :       msg(out, "This function did not change");
      53          14 :     return 0;
      54             :   }
      55        2674 :   if (flag)
      56             :   {
      57        2653 :     out_term_color(out, c_NONE);
      58        2653 :     out_print_text(out, "\nA function with that name existed in GP-1.39.15. Please update your script.");
      59        2653 :     out_putc(out, '\n');
      60             :   }
      61             : 
      62        2674 :   if (def == REMOV)
      63             :   {
      64         203 :     msg(out, "This function no longer exists");
      65         203 :     return 0;
      66             :   }
      67             :   /* special case compimag -> x*y */
      68        2471 :   if (!strcmp(def,"x*y")) def = "_*_";
      69        2471 :   ep = is_entry(def);
      70        2471 :   if (!ep) pari_err_BUG("whatnow");
      71        2457 :   out_puts(out, "New syntax: ");
      72        2457 :   out_term_color(out, c_ERR);
      73        2457 :   out_printf(out, "%s%s ===> %s%s\n\n", s, wp->oldarg, wp->name, wp->newarg);
      74        2457 :   msg(out, ep->help);
      75        2457 :   out_term_color(out, c_NONE); return 1;
      76             : }

Generated by: LCOV version 1.16