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