GCC Code Coverage Report


Directory: ./
File: lib/my/my_strcat.c
Date: 2024-06-05 00:36:48
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 14288 char *my_strcat(char *dest, char const *src)
17 {
18 14288 int len_dest = my_strlen(dest);
19 14288 int len_src = my_strlen(src);
20 14288 int i = 0;
21
22
4/4
✓ Branch 0 taken 14287 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 14286 times.
14288 if (dest == NULL || src == NULL)
23 2 return NULL;
24
2/2
✓ Branch 0 taken 189793 times.
✓ Branch 1 taken 14286 times.
204079 for (i = 0; i < len_src; i++) {
25 189793 dest[len_dest + i] = src[i];
26 }
27 14286 dest[len_dest + i] = '\0';
28 14286 return dest;
29 }
30