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