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 - kernel/none - bfffo.h (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.0 lcov report (development 29789-eb252ba62d) Lines: 8 8 100.0 %
Date: 2024-12-03 09:08:48 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #line 2 "../src/kernel/none/bfffo.h"
       2             : /* Copyright (C) 2000  The PARI group.
       3             : 
       4             : This file is part of the PARI/GP package.
       5             : 
       6             : PARI/GP is free software; you can redistribute it and/or modify it under the
       7             : terms of the GNU General Public License as published by the Free Software
       8             : Foundation; either version 2 of the License, or (at your option) any later
       9             : version. It is distributed in the hope that it will be useful, but WITHOUT
      10             : ANY WARRANTY WHATSOEVER.
      11             : 
      12             : Check the License for details. You should have received a copy of it, along
      13             : with the package; see the file 'COPYING'. If not, write to the Free Software
      14             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      15             : 
      16             : #if !defined(INLINE)
      17             : extern int  bfffo(ulong x);
      18             : #else
      19             : 
      20             : #if defined(__GNUC__) && !defined(DISABLE_INLINE)
      21             : 
      22             : #ifdef LONG_IS_64BIT
      23             : #  define bfffo(x) \
      24             : __extension__ ({ \
      25             :   static int __bfffo_tabshi[16]={4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};\
      26             :   int __value = BITS_IN_LONG - 4; \
      27             :   ulong __arg1=(x); \
      28             :   if (__arg1 & ~0xffffffffUL) {__value -= 32; __arg1 >>= 32;}\
      29             :   if (__arg1 & ~0xffffUL) {__value -= 16; __arg1 >>= 16;} \
      30             :   if (__arg1 & ~0x00ffUL) {__value -= 8; __arg1 >>= 8;} \
      31             :   if (__arg1 & ~0x000fUL) {__value -= 4; __arg1 >>= 4;} \
      32             :   __value + __bfffo_tabshi[__arg1]; \
      33             : })
      34             : #else
      35             : #  define bfffo(x) \
      36             : __extension__ ({ \
      37             :   static int __bfffo_tabshi[16]={4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};\
      38             :   int __value = BITS_IN_LONG - 4; \
      39             :   ulong __arg1=(x); \
      40             :   if (__arg1 & ~0xffffUL) {__value -= 16; __arg1 >>= 16;} \
      41             :   if (__arg1 & ~0x00ffUL) {__value -= 8; __arg1 >>= 8;} \
      42             :   if (__arg1 & ~0x000fUL) {__value -= 4; __arg1 >>= 4;} \
      43             :   __value + __bfffo_tabshi[__arg1]; \
      44             : })
      45             : #endif
      46             : 
      47             : #else
      48             : 
      49             : INLINE int
      50  5744887297 : bfffo(ulong x)
      51             : {
      52             :   static int tabshi[16]={4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
      53  5744887297 :   int value = BITS_IN_LONG - 4;
      54  5744887297 :   ulong arg1=x;
      55             : #ifdef LONG_IS_64BIT
      56  5744887297 :   if (arg1 & ~0xffffffffUL) {value -= 32; arg1 >>= 32;}
      57             : #endif
      58  5744887297 :   if (arg1 & ~0xffffUL) {value -= 16; arg1 >>= 16;}
      59  5744887297 :   if (arg1 & ~0x00ffUL) {value -= 8; arg1 >>= 8;}
      60  5744887297 :   if (arg1 & ~0x000fUL) {value -= 4; arg1 >>= 4;}
      61  5744887297 :   return value + tabshi[arg1];
      62             : }
      63             : #endif
      64             : 
      65             : #endif

Generated by: LCOV version 1.16