Debian Codegraph @

vendored-meson/meson/test cases/frameworks/7 gnome/mkenums/main5.c

raw
1 #include <stdio.h>
2 #include <string.h>
3 #include <glib-object.h>
4 #include "enums5.h"
5 #include "meson-sample.h"
6
7 int main(int argc, char **argv) {
8 GEnumClass *xenum = g_type_class_ref(MESON_TYPE_THE_XENUM);
9 GFlagsClass *flags_enum = g_type_class_ref(MESON_TYPE_THE_FLAGS_ENUM);
10 if (g_enum_get_value_by_name(xenum, "MESON_THE_XVALUE")->value != MESON_THE_XVALUE) {
11 fprintf(stderr, "Get MESON_THE_XVALUE by name failed.\n");
12 return 1;
13 }
14 if (g_enum_get_value_by_nick(xenum, "the-xvalue")->value != MESON_THE_XVALUE) {
15 fprintf(stderr, "Get MESON_THE_XVALUE by nick failed.\n");
16 return 2;
17 }
18 if (g_flags_get_value_by_name(flags_enum, "MESON_THE_FIRST_VALUE")->value != MESON_THE_FIRST_VALUE) {
19 fprintf(stderr, "Get MESON_THE_FIRST_VALUE by name failed.\n");
20 return 3;
21 }
22 if (g_flags_get_value_by_nick(flags_enum, "the-first-value")->value != MESON_THE_FIRST_VALUE) {
23 fprintf(stderr, "Get MESON_THE_FIRST_VALUE by nick failed.\n");
24 return 4;
25 }
26
27 /* Make sure that funcs do not have any extra prefix */
28 if (!meson_the_xenum_get_type())
29 g_error ("Bad!");
30
31 g_type_class_unref(xenum);
32 g_type_class_unref(flags_enum);
33 fprintf(stderr, "All ok.\n");
34 return 0;
35 }