GCC Code Coverage Report


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