summaryrefslogtreecommitdiff
path: root/tests/test_bootstrap.c
blob: fea04432b6f340129265687a77bdbeedd4a7a7ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*:*
 * ggaze — bootstrap sanity test
 *
 * Confirms the build/test harness is wired: g_test_init runs, and the
 * generated ggaze-config.h exposes the app id and version. No display,
 * no GTK — this is the smallest proof that the unit-test track compiles
 * and executes under `meson test --suite unit`.
 *
 * Copyright (c) 2026 ggaze contributors
 * SPDX-License-Identifier: GPL-3.0-or-later
 *:*/

#include "ggaze-config.h"

#include <glib.h>
#include <string.h>

static void
test_app_id(void) {
   g_assert_cmpstr(GGAZE_APP_ID, ==, "org.buetow.ggaze");
}

static void
test_version(void) {
   g_assert_cmpstr(GGAZE_VERSION, !=, NULL);
   g_assert_cmpint((int)strlen(GGAZE_VERSION), >, 0);
}

static void
test_feature_flags_are_binary(void) {
   /* Feature flags must be 0 or 1, never undefined (compile-time guard). */
   g_assert_cmpint(GGAZE_HAVE_GEGL, >=, 0);
   g_assert_cmpint(GGAZE_HAVE_GEGL, <=, 1);
   g_assert_cmpint(GGAZE_HAVE_JXL, >=, 0);
   g_assert_cmpint(GGAZE_HAVE_JXL, <=, 1);
   g_assert_cmpint(GGAZE_HAVE_AVIF, >=, 0);
   g_assert_cmpint(GGAZE_HAVE_AVIF, <=, 1);
   g_assert_cmpint(GGAZE_HAVE_HEIF, >=, 0);
   g_assert_cmpint(GGAZE_HAVE_HEIF, <=, 1);
}

int
main(int i_argc, char **c_argv) {
   g_test_init(&i_argc, &c_argv, NULL);
   g_test_add_func("/bootstrap/app_id", test_app_id);
   g_test_add_func("/bootstrap/version", test_version);
   g_test_add_func("/bootstrap/feature_flags", test_feature_flags_are_binary);
   return (g_test_run());
}