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:
- with GMP kernel
- with GMP kernel using --mt=pthread
- with native kernel, including micro-assembler code
- with native kernel, without micro-assembler
- with native kernel, without micro-assembler, disabling GCC extensions
(DISABLE_INLINE)
- with GMP kernel, emulating an
x86_32
architecture at
Configure time via setarch
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 |
|
|
|
|
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 63041151823 : addll(ulong x, ulong y)
72 : {
73 63041151823 : const ulong z = x+y;
74 63041151823 : overflow=(z<x);
75 63041151823 : return (long) z;
76 : }
77 :
78 : INLINE long
79 21200091280 : addllx(ulong x, ulong y)
80 : {
81 21200091280 : const ulong z = x+y+overflow;
82 21200091280 : overflow = (z<x || (z==x && overflow));
83 21200091280 : return (long) z;
84 : }
85 :
86 : INLINE long
87 24877409797 : subll(ulong x, ulong y)
88 : {
89 24877409797 : const ulong z = x-y;
90 24877409797 : overflow = (z>x);
91 24877409797 : return (long) z;
92 : }
93 :
94 : INLINE long
95 16883891232 : subllx(ulong x, ulong y)
96 : {
97 16883891232 : const ulong z = x-y-overflow;
98 16883891232 : overflow = (z>x || (z==x && overflow));
99 16883891232 : return (long) z;
100 : }
101 :
102 : #endif /* __GNUC__ */
103 :
104 : #endif
|