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