Max | 70c7d41 | 2017-02-24 13:59:14 +0100 | [diff] [blame] | 1 | #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 | |
| 10 | inline void check_type(enum ctrl_type c) |
| 11 | { |
| 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 | |
| 22 | int 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 | } |