GCC Code Coverage Report


Directory: ./
File: lib/my/my_strcat.c
Date: 2024-06-05 00:34:38
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 1 1 100.0%
Branches: 6 6 100.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_strcat
4 ** File description:
5 ** Concatenates a string (dest) with another string (src)
6 ** and returns the destination string (dest)
7 */
8 /**
9 * @file my_strcat.c
10 * @brief The file containing the my_strcat function
11 * @author Nicolas TORO
12 */
13
14 #include "my.h"
15
16 1200 char *my_strcat(char *dest, char const *src)
17 {
18 1200 int len_dest = my_strlen(dest);
19 1200 int len_src = my_strlen(src);
20 1200 int i = 0;
21
22
4/4
✓ Branch 0 taken 1199 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1198 times.
1200 if (dest == NULL || src == NULL)
23 2 return NULL;
24
2/2
✓ Branch 0 taken 1712 times.
✓ Branch 1 taken 1198 times.
2910 for (i = 0; i < len_src; i++)
25 1712 dest[len_dest + i] = src[i];
26 1198 dest[len_dest + i] = '\0';
27 1198 return dest;
28 }
29