GCC Code Coverage Report


Directory: ./
File: lib/my/my_strcapitalize.c
Date: 2024-06-05 00:29:21
Exec Total Coverage
Lines: 9 9 100.0%
Functions: 1 1 100.0%
Branches: 10 16 62.5%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_strcapitalize
4 ** File description:
5 ** capitalize first letter of new word (preceding by a ' ' or '-')
6 */
7
8 #include "my.h"
9
10 1 char *my_strcapitalize(char *str)
11 {
12 1 str = my_strlowcase(str);
13
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
5 for (int i = 1; i < my_strlen(str); i++) {
14
4/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 3 times.
4 if (((str[i - 1] == '+' || str[i - 1] == '-' || str[i - 1] == ' '))
15
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 && (str[i] >= 'a' && str[i] <= 'z')) {
16 1 str[i] = str[i] - 32;
17 }
18 }
19
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 if (str[0] >= 'a' && str[0] <= 'z')
20 1 str[0] = str[0] - 32;
21 1 return str;
22 }
23