aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/frameworks/7 gnome/mkenums/main.c
blob: d257185ddc27ee1f16f7b9fcbf71052e6af21caa (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
#include<stdio.h>
#include<string.h>
#include<glib-object.h>
#include"meson-sample.h"
#include"@ENUM_FILE@"

int main(int argc, char **argv) {
    GEnumClass *xenum = g_type_class_ref(MESON_TYPE_THE_XENUM);
    GFlagsClass *flags_enum = g_type_class_ref(MESON_TYPE_THE_FLAGS_ENUM);
    if (g_enum_get_value_by_name(xenum, "MESON_THE_XVALUE")->value != MESON_THE_XVALUE) {
        fprintf(stderr, "Get MESON_THE_XVALUE by name failed.\n");
        return 1;
    }
    if (g_enum_get_value_by_nick(xenum, "the-xvalue")->value != MESON_THE_XVALUE) {
        fprintf(stderr, "Get MESON_THE_XVALUE by nick failed.\n");
        return 2;
    }
    if (g_flags_get_value_by_name(flags_enum, "MESON_THE_FIRST_VALUE")->value != MESON_THE_FIRST_VALUE) {
        fprintf(stderr, "Get MESON_THE_FIRST_VALUE by name failed.\n");
        return 3;
    }
    if (g_flags_get_value_by_nick(flags_enum, "the-first-value")->value != MESON_THE_FIRST_VALUE) {
        fprintf(stderr, "Get MESON_THE_FIRST_VALUE by nick failed.\n");
        return 4;
    }
    g_type_class_unref(xenum);
    g_type_class_unref(flags_enum);
    fprintf(stderr, "All ok.\n");
    return 0;
}