Coverage report for server


src/
File: src/eggs.c
Date: 2024-06-25 10:57:05
Lines:
8/8
100.0%
Functions:
1/1
100.0%
Branches:
3/6
50.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** zappy
4 ** File description:
5 ** eggs.c
6 */
7
8 #include "server.h"
9
10 10 egg_t *init_egg(int width, int height)
11 {
12 static int id = 0;
13 10 egg_t *egg = malloc(sizeof(egg_t));
14
15
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 if (egg == NULL)
16 return NULL;
17
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 egg->x = width == 0 ? 0 : rand() % width;
18
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 egg->y = height == 0 ? 0 : rand() % height;
19 10 egg->id = id;
20 10 id++;
21 10 return egg;
22 }
23