GCC Code Coverage Report


Directory: source/
File: source/utils/ecs_window.c
Date: 2023-12-18 09:27:49
Exec Total Coverage
Lines: 0 35 0.0%
Branches: 0 2 0.0%

Line Branch Exec Source
1 /*
2 * Filename: ecs_window.c
3 * Path: tests/unit_test
4 * Created Date: Thursday, November 30th 2023, 5:39 pm
5 * Author: osvegn
6 *
7 * Copyright (c) 2023 ECS
8 */
9
10 #include "utils/ecs_window.h"
11 #include <stdlib.h>
12 #include <string.h>
13
14 ✗ static void remove_name(ecs_window_t *win)
15 {
16 ✗ if (win->name)
17 ✗ free(win->name);
18 ✗ win->name = NULL;
19 }
20
21 ✗ int window_constructor(ecs_window_t *win)
22 {
23 ✗ win->fps = 60;
24 ✗ win->height = 300;
25 ✗ win->width = 300;
26 ✗ win->name = strdup("Untitled");
27 ✗ return win->name != NULL;
28 }
29
30 ✗ void window_destructor(ecs_window_t *win)
31 {
32 ✗ remove_name(win);
33 }
34
35 ✗ void set_window_width(ecs_window_t *win, unsigned int width)
36 {
37 ✗ win->width = width;
38 }
39
40 ✗ unsigned int get_window_width(ecs_window_t *win)
41 {
42 ✗ return win->width;
43 }
44
45 ✗ void set_window_height(ecs_window_t *win, unsigned int height)
46 {
47 ✗ win->height = height;
48 }
49
50 ✗ unsigned int get_window_height(ecs_window_t *win)
51 {
52 ✗ return win->height;
53 }
54
55 ✗ void set_window_fps(ecs_window_t *win, unsigned int fps)
56 {
57 ✗ win->fps = fps;
58 }
59
60 ✗ unsigned int get_window_fps(ecs_window_t *win)
61 {
62 ✗ return win->fps;
63 }
64
65 ✗ void set_window_name(ecs_window_t *win, char *name)
66 {
67 ✗ remove_name(win);
68 ✗ win->name = strdup(name);
69 }
70
71 ✗ char *get_window_name(ecs_window_t *win)
72 {
73 ✗ return win->name;
74 }
75
76 ✗ void copy_window(ecs_window_t *dest, ecs_window_t *src)
77 {
78 ✗ window_constructor(dest);
79 ✗ set_window_width(dest, get_window_width(src));
80 ✗ set_window_height(dest, get_window_height(src));
81 ✗ set_window_fps(dest, get_window_fps(src));
82 ✗ set_window_name(dest, get_window_name(src));
83 }
84