GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 22
Functions: 0.0% 0 / 0 / 6
Branches: 0.0% 0 / 0 / 10

shumate/shumate-utils.c
Line Branch Exec Source
1 /*
2 * Copyright (C) 2023 James Westman <james@jwestman.net>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
16 */
17
18 #include "shumate-utils-private.h"
19
20 void
21 ✗ shumate_grid_position_init (ShumateGridPosition *self,
22 int x,
23 int y,
24 int zoom)
25 {
26 ✗ self->x = x;
27 ✗ self->y = y;
28 ✗ self->zoom = zoom;
29 ✗ }
30
31 ShumateGridPosition *
32 ✗ shumate_grid_position_new (int x,
33 int y,
34 int zoom)
35 {
36 ✗ ShumateGridPosition *self = g_new0 (ShumateGridPosition, 1);
37 ✗ shumate_grid_position_init (self, x, y, zoom);
38 ✗ return self;
39 }
40
41 ShumateGridPosition *
42 ✗ shumate_grid_position_copy (ShumateGridPosition *pos)
43 {
44 ✗ return shumate_grid_position_new (pos->x, pos->y, pos->zoom);
45 }
46
47 guint
48 ✗ shumate_grid_position_hash (gconstpointer pointer)
49 {
50 ✗ const ShumateGridPosition *self = pointer;
51 ✗ return self->x ^ self->y ^ self->zoom;
52 }
53
54 gboolean
55 ✗ shumate_grid_position_equal (gconstpointer a, gconstpointer b)
56 {
57 ✗ const ShumateGridPosition *pos_a = a;
58 ✗ const ShumateGridPosition *pos_b = b;
59 ✗ return pos_a->x == pos_b->x && pos_a->y == pos_b->y && pos_a->zoom == pos_b->zoom;
60 }
61
62 void
63 ✗ shumate_grid_position_free (gpointer pointer)
64 {
65 ✗ ShumateGridPosition *self = pointer;
66 ✗ if (!self)
67 return;
68
69 ✗ g_free (self);
70 }
71
72