Branch Coverage

random_prime.c
Criterion Covered Total %
branch 45 58 77.5


line true false branch
19 1 3 case 2: return urandomb(ctx,1) ? 2 : 3;
20 1 3 case 3: return urandomb(ctx,1) ? 5 : 7;
21 4 0 case 4: return urandomb(ctx,1) ? 11 : 13;
30 20 222 if (start)
33 0 222 if (b > BITS_PER_WORD)
40 222 2574 if (is_prob_prime(n))
48 22 0 if ( (d == 0) || (BITS_PER_WORD == 32 && d >= 10) || (BITS_PER_WORD == 64 && d >= 20) ) return 0;
3 19 if ( (d == 0) || (BITS_PER_WORD == 32 && d >= 10) || (BITS_PER_WORD == 64 && d >= 20) ) return 0;
49 1 18 if (d == 1) return nth_prime(1 + urandomm32(ctx,4));
50 1 17 if (d == 2) return nth_prime(5 + urandomm32(ctx,21));
55 17 210 if (is_prob_prime(n))
63 2 22015 if (lo > hi) return 0;
65 9010 13005 lo = (lo <= 2) ? 2 : next_prime(lo-1);
66 22015 0 hi = (hi >= MPU_MAX_PRIME) ? MPU_MAX_PRIME : prev_prime(hi+1);
67 4 22011 if (lo > hi) return 0;
69 13003 9008 if (!(lo&1)) lo--; /* treat 2 as 1 */
73 130289 3578 if (n == 1 || is_prob_prime(n))
18433 111856 if (n == 1 || is_prob_prime(n))
74 18433 3578 return (n == 1) ? 2 : n;
81 0 5 if (k >= 3*(n/4))
85 20 3 while (k--) {
87 2 18 if (!miller_rabin(n, &base, 1))
97 2 0 if (b < 4 || b > BITS_PER_WORD)
0 2 if (b < 4 || b > BITS_PER_WORD)
117 0 1 } while (n < min || n > max);
0 1 } while (n < min || n > max);
125 1 0 if (b < 3 || b > BITS_PER_WORD)
0 1 if (b < 3 || b > BITS_PER_WORD)
143 0 0 } while (!is_semiprime(n));