GCC Code Coverage Report


Directory: ./
File: lib/my/my_count_letter.c
Date: 2024-06-05 02:24:39
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 1 1 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** my_count_letter
4 ** File description:
5 ** Returns the number of times the letter (c) chose is in the string (str)
6 */
7 /**
8 * @file my_count_letter.c
9 * @brief The file containing the my_count_letter function
10 * @author Nicolas TORO
11 */
12
13 #include "my.h"
14
15 1 int my_count_letter(char const *str, char c)
16 {
17 1 int count = 0;
18
19
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 times.
7 for (int index = 0; str[index] != '\0'; index++) {
20
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4 times.
6 if (str[index] == c)
21 2 count++;
22 }
23 1 return count;
24 }
25