1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
10 #include <ecoli_malloc.h>
11 #include <ecoli_log.h>
12 #include <ecoli_test.h>
13 #include <ecoli_strvec.h>
14 #include <ecoli_node.h>
15 #include <ecoli_parse.h>
16 #include <ecoli_complete.h>
17 #include <ecoli_node_empty.h>
19 EC_LOG_TYPE_REGISTER(node_empty);
21 struct ec_node_empty {
25 static int ec_node_empty_parse(const struct ec_node *gen_node,
26 struct ec_parse *state,
27 const struct ec_strvec *strvec)
35 static struct ec_node_type ec_node_empty_type = {
37 .parse = ec_node_empty_parse,
38 .complete = ec_node_complete_unknown,
39 .size = sizeof(struct ec_node_empty),
42 EC_NODE_TYPE_REGISTER(ec_node_empty_type);
45 static int ec_node_empty_testcase(void)
50 node = ec_node("empty", EC_NO_ID);
52 EC_LOG(EC_LOG_ERR, "cannot create node\n");
55 testres |= EC_TEST_CHECK_PARSE(node, 0, "foo");
56 testres |= EC_TEST_CHECK_PARSE(node, 0);
57 testres |= EC_TEST_CHECK_PARSE(node, 0, "foo", "bar");
61 node = ec_node("empty", EC_NO_ID);
63 EC_LOG(EC_LOG_ERR, "cannot create node\n");
66 testres |= EC_TEST_CHECK_COMPLETE(node,
69 testres |= EC_TEST_CHECK_COMPLETE(node,
70 "foo", EC_NODE_ENDLIST,
78 static struct ec_test ec_node_empty_test = {
80 .test = ec_node_empty_testcase,
83 EC_TEST_REGISTER(ec_node_empty_test);