blob: 08be15f6aa9bcde74bedf7abfcad0ef12c7812d8 [file] [log] [blame]
Max70c7d412017-02-24 13:59:14 +01001#include <stdio.h>
2#include <stdlib.h>
3#include <stdint.h>
4#include <string.h>
5#include <stdbool.h>
6
7#include <osmocom/core/utils.h>
8#include <osmocom/ctrl/control_cmd.h>
9
Vadim Yanitskiyc2afe812017-06-13 01:43:23 +070010static void check_type(enum ctrl_type c)
Max70c7d412017-02-24 13:59:14 +010011{
12 const char *t = get_value_string(ctrl_type_vals, c);
13 int v = get_string_value(ctrl_type_vals, t);
14
15 printf("ctrl type %d is %s ", c, t);
16 if (v < 0)
17 printf("[PARSE FAILED]\n");
18 else
19 printf("-> %d %s\n", v, c != v ? "FAIL" : "OK");
20}
21
22int main(int argc, char **argv)
23{
24 printf("Checking ctrl types...\n");
25
26 check_type(CTRL_TYPE_UNKNOWN);
27 check_type(CTRL_TYPE_GET);
28 check_type(CTRL_TYPE_SET);
29 check_type(CTRL_TYPE_GET_REPLY);
30 check_type(CTRL_TYPE_SET_REPLY);
31 check_type(CTRL_TYPE_TRAP);
32 check_type(CTRL_TYPE_ERROR);
33 check_type(64);
34
35 return 0;
36}