GCC Code Coverage Report


Directory: ./
File: submodules/ECS/tests/library/ECS/world_tests.c
Date: 2023-09-29 04:53:15
Exec Total Coverage
Lines: 0 25 0.0%
Branches: 0 80 0.0%

Line Branch Exec Source
1 /*
2 * Filename: /home/osvegn/Documents/Repositories/ECS/tests/library/ECS/world_tests.c
3 * Path: /home/osvegn/Documents/Repositories/ECS/tests/library/ECS
4 * Created Date: Friday, April 21st 2023, 9:58:39 pm
5 * Author: osvegn
6 *
7 * Copyright (c) 2023 Your Company
8 */
9
10 #include <criterion/criterion.h>
11 #include "world.h"
12 #include "world_system.h"
13
14 Test(world, world_run_systems_success)
15 {
16 world_t world;
17
18 cr_assert_eq(world_constructor(&world, 0), 0);
19 cr_assert_eq(world_run_systems(&world), 0);
20 world_destructor(&world);
21 }
22
23 Test(world, world_run_systems_failure)
24 {
25 world_t world;
26 system_t system = {.run = NULL};
27
28 cr_assert_eq(world_constructor(&world, 0), 0);
29 world_add_system(&world, &system);
30 cr_assert_eq(world_run_systems(&world), -1);
31 world_destructor(&world);
32 }
33
34 Test(world, world_run_systems_failure_2)
35 {
36 world_t world;
37 system_t system = {.run = (int (*)(void *))1};
38
39 cr_assert_eq(world_constructor(&world, 0), 0);
40 world.system_list.emplace_back(&world.system_list, &system);
41 world.system_list.pointer = 0;
42 cr_assert_eq(world_run_systems(&world), -1);
43 world_destructor(&world);
44 }
45
46 static int system_test_run(void *world)
47 {
48 return -1;
49 }
50
51 Test(world, world_run_systems_failure_3)
52 {
53 world_t world;
54 system_t system = {.run = system_test_run};
55
56 cr_assert_eq(world_constructor(&world, 0), 0);
57 world_add_system(&world, &system);
58 cr_assert_eq(world_run_systems(&world), -1);
59 world_destructor(&world);
60 }
61
62