GCC Code Coverage Report


Directory: ./
File: lib/my/my_is_prime.c
Date: 2024-06-05 00:29:21
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 1 1 100.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_is_prime
4 ** File description:
5 ** Returns 1 if the number (nb) is prime and 0 otherwise
6 */
7
8 3 int my_is_prime(int nb)
9 {
10 3 int i = 0;
11
12
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
3 if (nb <= 1 || nb == 4) {
13 1 return 0;
14 }
15
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (i = 2; i < nb / 2; i++) {
16
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 if (nb % i == 0) {
17 1 return 0;
18 }
19 }
20 1 return 1;
21 }
22