GCC Code Coverage Report


Directory: ./
File: s21_strchr.c
Date: 2025-07-13 17:59:14
Exec Total Coverage
Lines: 9 9 100.0%
Branches: 8 8 100.0%

Line Branch Exec Source
1 #include "s21_string.h"
2
3 3111 char* s21_strchr(const char* str, int c) {
4 3111 char* result = S21_NULL;
5 3111 char* p = (char*)str;
6
4/4
✓ Branch 0 taken 14795 times.
✓ Branch 1 taken 2828 times.
✓ Branch 2 taken 14512 times.
✓ Branch 3 taken 283 times.
17623 for (; *p != '\0' && result == S21_NULL; p++) {
7
2/2
✓ Branch 0 taken 356 times.
✓ Branch 1 taken 14156 times.
14512 if (*p == c) {
8 356 result = p;
9 }
10 }
11
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3108 times.
3111 if (c == '\0') {
12 3 result = p;
13 }
14
15 3111 return result;
16 }
17