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 - addll.h (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.0 lcov report (development 29831-b8da5aa5b5) Lines: 16 16 100.0 %
Date: 2024-12-30 09:09:15 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #line 2 "../src/kernel/none/addll.h"
       2             : /* Copyright (C) 2003  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             : /* This file originally adapted from gmp-3.1.1 (from T. Granlund), files
      17             :  * longlong.h and gmp-impl.h
      18             : 
      19             :   Copyright (C) 2000 Free Software Foundation, Inc. */
      20             : 
      21             : #undef LOCAL_OVERFLOW
      22             : #define LOCAL_OVERFLOW
      23             : extern ulong overflow;
      24             : 
      25             : #if !defined(INLINE)
      26             : extern long addll(ulong x, ulong y);
      27             : extern long addllx(ulong x, ulong y);
      28             : extern long subll(ulong x, ulong y);
      29             : extern long subllx(ulong x, ulong y);
      30             : #else
      31             : 
      32             : #if defined(__GNUC__) && !defined(DISABLE_INLINE)
      33             : #undef LOCAL_OVERFLOW
      34             : #define LOCAL_OVERFLOW ulong overflow
      35             : 
      36             : #define addll(a, b)                                             \
      37             : __extension__ ({                                                \
      38             :    ulong __arg1 = (a), __arg2 = (b), __value = __arg1 + __arg2; \
      39             :    overflow = (__value < __arg1);                               \
      40             :    __value;                                                     \
      41             : })
      42             : 
      43             : #define addllx(a, b)                                          \
      44             : __extension__ ({                                              \
      45             :    ulong __arg1 = (a), __arg2 = (b), __value, __tmp = __arg1 + overflow;\
      46             :    overflow = (__tmp < __arg1);                               \
      47             :    __value = __tmp + __arg2;                                  \
      48             :    overflow |= (__value < __tmp);                             \
      49             :    __value;                                                   \
      50             : })
      51             : 
      52             : #define subll(a, b)                                           \
      53             : __extension__ ({                                              \
      54             :    ulong __arg1 = (a), __arg2 = (b);                          \
      55             :    overflow = (__arg2 > __arg1);                              \
      56             :    __arg1 - __arg2;                                           \
      57             : })
      58             : 
      59             : #define subllx(a, b)                                  \
      60             : __extension__ ({                                      \
      61             :    ulong __arg1 = (a), __arg2 = (b), __value, __tmp = __arg1 - overflow;\
      62             :    overflow = (__arg1 < overflow);                    \
      63             :    __value = __tmp - __arg2;                          \
      64             :    overflow |= (__arg2 > __tmp);                      \
      65             :    __value;                                           \
      66             : })
      67             : 
      68             : #else /* __GNUC__ */
      69             : 
      70             : INLINE long
      71 63087639484 : addll(ulong x, ulong y)
      72             : {
      73 63087639484 :   const ulong z = x+y;
      74 63087639484 :   overflow=(z<x);
      75 63087639484 :   return (long) z;
      76             : }
      77             : 
      78             : INLINE long
      79 21199900128 : addllx(ulong x, ulong y)
      80             : {
      81 21199900128 :   const ulong z = x+y+overflow;
      82 21199900128 :   overflow = (z<x || (z==x && overflow));
      83 21199900128 :   return (long) z;
      84             : }
      85             : 
      86             : INLINE long
      87 25013626664 : subll(ulong x, ulong y)
      88             : {
      89 25013626664 :   const ulong z = x-y;
      90 25013626664 :   overflow = (z>x);
      91 25013626664 :   return (long) z;
      92             : }
      93             : 
      94             : INLINE long
      95 16892603800 : subllx(ulong x, ulong y)
      96             : {
      97 16892603800 :   const ulong z = x-y-overflow;
      98 16892603800 :   overflow = (z>x || (z==x && overflow));
      99 16892603800 :   return (long) z;
     100             : }
     101             : 
     102             : #endif /* __GNUC__ */
     103             : 
     104             : #endif

Generated by: LCOV version 1.16