GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 5 / 0 / 5
Functions: 100.0% 1 / 0 / 1
Branches: 66.7% 4 / 0 / 6

tests/test-emulation.c
Line Branch Exec Source
1 /*
2 * Copyright (C) 2026 Canonical, Ltd.
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, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include "fpi-device.h"
20 #include "fpi-test-emulation.h"
21
22 gboolean
23 49 (fpi_device_emulation_mode_enabled) (FpDevice *device)
24 {
25 49 static gsize emulation_mode = 0;
26
27
3/4
✓ Branch 2 → 3 taken 20 times.
✓ Branch 2 → 10 taken 29 times.
✓ Branch 4 → 5 taken 20 times.
✗ Branch 4 → 10 not taken.
49 if (g_once_init_enter (&emulation_mode))
28
1/2
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 20 times.
20 g_once_init_leave (&emulation_mode,
29 g_strcmp0 (g_getenv (FPI_EMULATION_ENV_VAR), "1") == 0 ?
30 TRUE : G_MAXSIZE);
31
32 49 return emulation_mode == TRUE;
33 }
34