GCC Code Coverage Report


Directory: ./
File: lib/my/my_compute_square_root.c
Date: 2024-06-05 00:34:38
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 1 1 100.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_compute_square_root
4 ** File description:
5 ** Returns the root of the number (nb)
6 */
7 /**
8 * @file my_compute_square_root.c
9 * @brief The file containing the my_compute_square_root function
10 * @author Nicolas TORO
11 */
12
13 #include "my.h"
14
15 3 int my_compute_square_root(int nb)
16 {
17 3 int i = 1;
18
19
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 if (nb == 0)
20 1 return 0;
21
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 while (i * i <= nb) {
22
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
5 if (nb / i == i
23
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 && nb % i == 0) {
24 1 return i;
25 }
26 4 i++;
27 }
28 1 return 0;
29 }
30