GCC Code Coverage Report


Directory: ./
File: lib/my/my_str_isalpha.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 1 1 100.0%
Branches: 10 12 83.3%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_str_isalpha
4 ** File description:
5 ** Returns 1 if the string (str) contains only alphabetical characters
6 */
7 /**
8 * @file my_str_isalpha.c
9 * @brief The file containing the my_str_isalpha function
10 * @author Nicolas TORO
11 */
12
13 #include "my.h"
14
15 10 int my_str_isalpha(char const *str)
16 {
17
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 9 times.
10 if (my_strlen(str) == 0)
18 1 return 1;
19
2/2
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 6 times.
36 for (int i = 0; i < my_strlen(str); i++) {
20
6/8
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 21 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 27 times.
30 if (str[i] < 'A' || (str[i] > 'Z' && str[i] < 'a') || str[i] > 'z')
21 3 return 0;
22 }
23 6 return 1;
24 }
25