summaryrefslogtreecommitdiffstats
path: root/src/vat2/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat2/test')
-rw-r--r--src/vat2/test/vat2_test.api11
-rw-r--r--src/vat2/test/vat2_test.c44
2 files changed, 40 insertions, 15 deletions
diff --git a/src/vat2/test/vat2_test.api b/src/vat2/test/vat2_test.api
index 6a2c94d182e..fe96dd75784 100644
--- a/src/vat2/test/vat2_test.api
+++ b/src/vat2/test/vat2_test.api
@@ -28,3 +28,14 @@ enumflag test_enumflags {
autoreply define test_enum {
vl_api_test_enumflags_t flags;
};
+
+typedef test_stringtype {
+ string str[];
+};
+
+autoreply define test_string {
+ vl_api_test_stringtype_t str;
+};
+autoreply define test_string2 {
+ string str[];
+};
diff --git a/src/vat2/test/vat2_test.c b/src/vat2/test/vat2_test.c
index fe788f127c6..b5346eeea47 100644
--- a/src/vat2/test/vat2_test.c
+++ b/src/vat2/test/vat2_test.c
@@ -96,24 +96,38 @@ runtest (char *s, bool should_fail)
}
struct msgs msgs[] = {
-{
- .name = "test_prefix",
- .tojson = (tojson_fn_t)vl_api_test_prefix_t_tojson,
- .fromjson = (fromjson_fn_t)vl_api_test_prefix_t_fromjson,
-},
-{
- .name = "test_enum",
- .tojson = (tojson_fn_t)vl_api_test_enum_t_tojson,
- .fromjson = (fromjson_fn_t)vl_api_test_enum_t_fromjson,
-},
+ {
+ .name = "test_prefix",
+ .tojson = (tojson_fn_t) vl_api_test_prefix_t_tojson,
+ .fromjson = (fromjson_fn_t) vl_api_test_prefix_t_fromjson,
+ },
+ {
+ .name = "test_enum",
+ .tojson = (tojson_fn_t) vl_api_test_enum_t_tojson,
+ .fromjson = (fromjson_fn_t) vl_api_test_enum_t_fromjson,
+ },
+ {
+ .name = "test_string",
+ .tojson = (tojson_fn_t) vl_api_test_string_t_tojson,
+ .fromjson = (fromjson_fn_t) vl_api_test_string_t_fromjson,
+ },
+ {
+ .name = "test_string2",
+ .tojson = (tojson_fn_t) vl_api_test_string2_t_tojson,
+ .fromjson = (fromjson_fn_t) vl_api_test_string2_t_fromjson,
+ },
};
struct tests tests[] = {
- {.s = "{\"_msgname\": \"test_prefix\", \"pref\": \"2001:db8::/64\"}"},
- {.s = "{\"_msgname\": \"test_prefix\", \"pref\": \"192.168.10.0/24\"}"},
- {.s = "{\"_msgname\": \"test_enum\", \"flags\": [\"RED\", \"BLUE\"]}"},
- {.s = "{\"_msgname\": \"test_enum\", \"flags\": [\"BLACK\", \"BLUE\"]}",
- .should_fail = 1},
+ { .s = "{\"_msgname\": \"test_prefix\", \"pref\": \"2001:db8::/64\"}" },
+ { .s = "{\"_msgname\": \"test_prefix\", \"pref\": \"192.168.10.0/24\"}" },
+ { .s = "{\"_msgname\": \"test_enum\", \"flags\": [\"RED\", \"BLUE\"]}" },
+ { .s = "{\"_msgname\": \"test_enum\", \"flags\": [\"BLACK\", \"BLUE\"]}",
+ .should_fail = 1 },
+ { .s = "{\"_msgname\": \"test_string\", \"str\": {\"str\": \"Test string "
+ "type\"}}" },
+ { .s =
+ "{\"_msgname\": \"test_string2\", \"str\": \"Test string toplevel\"}" },
};
int main (int argc, char **argv)