Branch Coverage

random_prime.c
Criterion Covered Total %
branch 47 58 81.0


line true false branch
19 1 3 case 2: return urandomb(ctx,1) ? 2 : 3;
20 3 1 case 3: return urandomb(ctx,1) ? 5 : 7;
21 3 1 case 4: return urandomb(ctx,1) ? 11 : 13;
30 20 228 if (start)
33 0 228 if (b > BITS_PER_WORD)
40 228 2581 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 187 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 126882 3591 if (n == 1 || is_prob_prime(n))
18420 108462 if (n == 1 || is_prob_prime(n))
74 18420 3591 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 3 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));