Branch Coverage

rational.c
Criterion Covered Total %
branch 112 142 78.8


line true false branch
15 1473 351 while (den > 0) {
30 99 0 if (num == 0 || den == 0) return 0;
0 99 if (num == 0 || den == 0) return 0;
33 99 0 if (n == 0 || d == 0 || gcd_ui(n,d) != 1) return 0;
99 0 if (n == 0 || d == 0 || gcd_ui(n,d) != 1) return 0;
0 99 if (n == 0 || d == 0 || gcd_ui(n,d) != 1) return 0;
36 49 50 if (n < d) { /* n/d is 0 */
38 6 44 } else if (d == 1) {
39 0 6 if (n == UV_MAX) return 0;
44 0 44 if (nr > UV_MAX-dr) return 0;
53 99 0 if (num == 0 || den == 0) return 0;
0 99 if (num == 0 || den == 0) return 0;
56 99 0 if (n == 0 || d == 0 || gcd_ui(n,d) != 1) return 0;
99 0 if (n == 0 || d == 0 || gcd_ui(n,d) != 1) return 0;
0 99 if (n == 0 || d == 0 || gcd_ui(n,d) != 1) return 0;
64 6 93 if (*den == 1) { /* At end of the row, go to the start of the next. */
65 0 6 if (*num == UV_MAX) return 0;
101 0 313 if (rem != 1) croak("Rational must be reduced");
102 0 313 if (steps == 0) return 0;
105 1187 307 for (i = 0; i < steps; i++) {
106 6 1181 if ((shift+cf[i]) >= BITS_PER_WORD)
108 662 519 if (d)
109 944 662 for (bit = 0; bit < cf[i]; bit++)
115 6 307 if (i < steps) return 0;
123 3 200 if (M == 0) return 0;
124 1094 200 for (n = 1; M > 1; M >>= 1)
134 635 107 { UV v = n; while (v >>= 1) b++; }
135 742 107 while (b--) {
136 450 292 if ((n >> b) & 1) p += q;
146 1094 200 while (n > 1) {
147 562 532 if (n & 1) p += q;
159 2115 340 while (n) {
160 1132 983 if (n & 1) p += q;
172 34 0 return (t == 0) ? 0 : 1 + sumtotient(n);
180 939 0 if (n == 0 || p == 0 || q == 0 || *p >= *q) return 0;
939 0 if (n == 0 || p == 0 || q == 0 || *p >= *q) return 0;
939 0 if (n == 0 || p == 0 || q == 0 || *p >= *q) return 0;
0 939 if (n == 0 || p == 0 || q == 0 || *p >= *q) return 0;
199 10 0 if (n < 1 || len < 2 || len >= UVCONST(4294967295))
10 0 if (n < 1 || len < 2 || len >= UVCONST(4294967295))
0 10 if (n < 1 || len < 2 || len >= UVCONST(4294967295))
202 0 10 New(0, num, len, uint32_t);
203 0 10 New(0, den, len, uint32_t);
205 114 10 for (i = 0; i < len; i++) {
243 346 0 if (n == 0 || q == 0 || p == 0) return 0;
346 0 if (n == 0 || q == 0 || p == 0) return 0;
11 335 if (n == 0 || q == 0 || p == 0) return 0;
246 96 239 if (g != 1) { p /= g; q /= g; }
250 8442 335 for (i = 2; i <= n; i++)
253 8442 335 for (i = 2; i <= n; i++) {
255 28389 8442 for (j = i; j <= n-i; j += i)
296 28 62 if (k == 0) { *p = p0; *q = q0; return 1; }
303 83 62 while (--k) {
318 20 108 if (k < 2) {
319 10 10 if (k == 0) { *p = 0; *q = 1; }
323 1 107 if (n < 2) return 0;
332 95 12 if (n >= 5) {
337 19 76 if (guess <= lo) guess = lo+1; else if (guess >= hi) guess = hi-1;
2 74 if (guess <= lo) guess = lo+1; else if (guess >= hi) guess = hi-1;
339 95 0 if (lo < hi) {
341 80 15 if (gcnt <= k) { lo = guess; cnt = gcnt; } else { hi = guess-1; }
347 80 15 if (gcnt <= k) { guess = (hi-ginc < guess) ? hi : guess+ginc; }
80 0 if (gcnt <= k) { guess = (hi-ginc < guess) ? hi : guess+ginc; }
348 1 14 else { guess = (lo+ginc+1 > guess) ? lo : guess-1-ginc; }
350 81 14 if (lo < hi && guess > lo && guess < hi) {
81 0 if (lo < hi && guess > lo && guess < hi) {
67 14 if (lo < hi && guess > lo && guess < hi) {
352 21 46 if (gcnt <= k) { lo = guess; cnt = gcnt; } else { hi = guess-1; }
358 74 107 while (lo < hi) {
361 26 48 if (midcnt <= k) { lo = mid; cnt = midcnt; }
364 17 90 if (lo == n) {