GCC Code Coverage Report


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

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_str_isnum
4 ** File description:
5 ** return 1 if str is only digit or zero if not
6 */
7
8 #include "my.h"
9
10 3 int my_str_isnum(char const *str)
11 {
12
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
3 if (my_strlen(str) == 0)
13 1 return 1;
14
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
5 for (int i = 0; i < my_strlen(str); i++) {
15
3/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
4 if (str[i] < '0' || str[i] > '9') {
16 1 return 0;
17 }
18 }
19 1 return 1;
20 }
21