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

Generated by: LCOV version 1.11