diff options
author | Álvaro Neira Ayuso <alvaroneay@gmail.com> | 2013-08-27 20:10:55 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-08-28 00:21:32 +0200 |
commit | dba0f80206c48795441e04a604ace1655ea92e1f (patch) | |
tree | 492becc7b4467e1cf87687dc33ff84ee24a7afab /tests/nft-parsing-test.c | |
parent | 346b24fde7fceec7e69306e3e3fa07056aecc088 (diff) |
tests: set: add json parsing support
Test the functions for parsing set in JSON.
Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/nft-parsing-test.c')
-rw-r--r-- | tests/nft-parsing-test.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/nft-parsing-test.c b/tests/nft-parsing-test.c index 648ed36..ecde0e2 100644 --- a/tests/nft-parsing-test.c +++ b/tests/nft-parsing-test.c @@ -158,6 +158,7 @@ static int test_json(const char *filename) struct nft_table *t; struct nft_chain *c; struct nft_rule *r; + struct nft_set *s; json_t *root; json_error_t error; char *json; @@ -200,6 +201,16 @@ static int test_json(const char *filename) nft_rule_free(r); } + } else if (json_object_get(root, "set") != NULL) { + s = nft_set_alloc(); + if (s != NULL) { + if (nft_set_parse(s, NFT_SET_PARSE_JSON, json) == 0) + ret = compare_test(TEST_JSON_SET, s, filename); + else + goto failparsing; + + nft_set_free(s); + } } free(json); |