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 - kernel/none - addll.h (source / functions) Hit Total Coverage
Test: PARI/GP v2.8.0 lcov report (development 19217-a6dcf64) Lines: 16 16 100.0 %
Date: 2016-07-27 07:10:32 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. 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             : /* This file originally adapted from gmp-3.1.1 (from T. Granlund), files
      16             :  * longlong.h and gmp-impl.h
      17             : 
      18             :   Copyright (C) 2000 Free Software Foundation, Inc. */
      19             : 
      20             : #undef LOCAL_OVERFLOW
      21             : #define LOCAL_OVERFLOW
      22             : extern ulong overflow;
      23             : 
      24             : #if !defined(INLINE)
      25             : extern long addll(ulong x, ulong y);
      26             : extern long addllx(ulong x, ulong y);
      27             : extern long subll(ulong x, ulong y);
      28             : extern long subllx(ulong x, ulong y);
      29             : #else
      30             : 
      31             : #if defined(__GNUC__) && !defined(DISABLE_INLINE)
      32             : #undef LOCAL_OVERFLOW
      33             : #define LOCAL_OVERFLOW register ulong overflow
      34             : 
      35             : #define addll(a, b)                                             \
      36             : __extension__ ({                                                \
      37             :    ulong __arg1 = (a), __arg2 = (b), __value = __arg1 + __arg2; \
      38             :    overflow = (__value < __arg1);                               \
      39             :    __value;                                                     \
      40             : })
      41             : 
      42             : #define addllx(a, b)                                          \
      43             : __extension__ ({                                              \
      44             :    ulong __arg1 = (a), __arg2 = (b), __value, __tmp = __arg1 + overflow;\
      45             :    overflow = (__tmp < __arg1);                               \
      46             :    __value = __tmp + __arg2;                                  \
      47             :    overflow |= (__value < __tmp);                             \
      48             :    __value;                                                   \
      49             : })
      50             : 
      51             : #define subll(a, b)                                           \
      52             : __extension__ ({                                              \
      53             :    ulong __arg1 = (a), __arg2 = (b);                          \
      54             :    overflow = (__arg2 > __arg1);                              \
      55             :    __arg1 - __arg2;                                           \
      56             : })
      57             : 
      58             : #define subllx(a, b)                                  \
      59             : __extension__ ({                                      \
      60             :    ulong __arg1 = (a), __arg2 = (b), __value, __tmp = __arg1 - overflow;\
      61             :    overflow = (__arg1 < overflow);                    \
      62             :    __value = __tmp - __arg2;                          \
      63             :    overflow |= (__arg2 > __tmp);                      \
      64             :    __value;                                           \
      65             : })
      66             : 
      67             : #else /* __GNUC__ */
      68             : 
      69             : INLINE long
      70 22301734075 : addll(ulong x, ulong y)
      71             : {
      72 22301734075 :   const ulong z = x+y;
      73 22301734075 :   overflow=(z<x);
      74 22301734075 :   return (long) z;
      75             : }
      76             : 
      77             : INLINE long
      78  7629805498 : addllx(ulong x, ulong y)
      79             : {
      80  7629805498 :   const ulong z = x+y+overflow;
      81  7629805498 :   overflow = (z<x || (z==x && overflow));
      82  7629805498 :   return (long) z;
      83             : }
      84             : 
      85             : INLINE long
      86  2995720484 : subll(ulong x, ulong y)
      87             : {
      88  2995720484 :   const ulong z = x-y;
      89  2995720484 :   overflow = (z>x);
      90  2995720484 :   return (long) z;
      91             : }
      92             : 
      93             : INLINE long
      94  4520403686 : subllx(ulong x, ulong y)
      95             : {
      96  4520403686 :   const ulong z = x-y-overflow;
      97  4520403686 :   overflow = (z>x || (z==x && overflow));
      98  4520403686 :   return (long) z;
      99             : }
     100             : 
     101             : #endif /* __GNUC__ */
     102             : 
     103             : #endif

Generated by: LCOV version 1.11