Debian Codegraph @

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

raw
1 #include<stdio.h>
2 #include<string.h>
3 #include<glib-object.h>
4 #include"meson-sample.h"
5 #include"@ENUM_FILE@"
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 g_type_class_unref(xenum);
27 g_type_class_unref(flags_enum);
28 fprintf(stderr, "All ok.\n");
29 return 0;
30 }