Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file test_new.c |
| 3 | * @author: Michal Vasko <mvasko@cesnet.cz> |
| 4 | * @brief unit tests for functions for creating data |
| 5 | * |
| 6 | * Copyright (c) 2020 CESNET, z.s.p.o. |
| 7 | * |
| 8 | * This source code is licensed under BSD 3-Clause License (the "License"). |
| 9 | * You may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * https://opensource.org/licenses/BSD-3-Clause |
| 13 | */ |
| 14 | |
| 15 | #include <stdarg.h> |
| 16 | #include <stddef.h> |
| 17 | #include <stdio.h> |
| 18 | #include <setjmp.h> |
| 19 | #include <cmocka.h> |
| 20 | |
Radek Krejci | 70593c1 | 2020-06-13 20:48:09 +0200 | [diff] [blame] | 21 | #include "libyang.h" |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 22 | |
| 23 | #define BUFSIZE 1024 |
| 24 | char logbuf[BUFSIZE] = {0}; |
| 25 | int store = -1; /* negative for infinite logging, positive for limited logging */ |
| 26 | |
| 27 | struct ly_ctx *ctx; /* context for tests */ |
| 28 | |
| 29 | /* set to 0 to printing error messages to stderr instead of checking them in code */ |
| 30 | #define ENABLE_LOGGER_CHECKING 1 |
| 31 | |
| 32 | #if ENABLE_LOGGER_CHECKING |
| 33 | static void |
| 34 | logger(LY_LOG_LEVEL level, const char *msg, const char *path) |
| 35 | { |
| 36 | (void) level; /* unused */ |
| 37 | if (store) { |
| 38 | if (path && path[0]) { |
| 39 | snprintf(logbuf, BUFSIZE - 1, "%s %s", msg, path); |
| 40 | } else { |
| 41 | strncpy(logbuf, msg, BUFSIZE - 1); |
| 42 | } |
| 43 | if (store > 0) { |
| 44 | --store; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | #endif |
| 49 | |
| 50 | static int |
| 51 | setup(void **state) |
| 52 | { |
| 53 | (void) state; /* unused */ |
| 54 | |
| 55 | const char *schema_a = "module a {namespace urn:tests:a;prefix a;yang-version 1.1;" |
| 56 | "list l1 { key \"a b\"; leaf a {type string;} leaf b {type string;} leaf c {type string;}}" |
| 57 | "leaf foo { type uint16;}" |
| 58 | "leaf-list ll { type string;}" |
| 59 | "container c {leaf-list x {type string;}}" |
| 60 | "anydata any {config false;}" |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 61 | "list l2 {config false; container c{leaf x {type string;}}}" |
| 62 | "rpc oper {input {leaf param {type string;}} output {leaf param {type int8;}}}}"; |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 63 | |
| 64 | #if ENABLE_LOGGER_CHECKING |
| 65 | ly_set_log_clb(logger, 1); |
| 66 | #endif |
| 67 | |
| 68 | assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, 0, &ctx)); |
Michal Vasko | 3a41dff | 2020-07-15 14:30:28 +0200 | [diff] [blame] | 69 | assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, schema_a, LYS_IN_YANG, NULL)); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 70 | |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | static int |
| 75 | teardown(void **state) |
| 76 | { |
| 77 | #if ENABLE_LOGGER_CHECKING |
| 78 | if (*state) { |
| 79 | fprintf(stderr, "%s\n", logbuf); |
| 80 | } |
| 81 | #else |
| 82 | (void) state; /* unused */ |
| 83 | #endif |
| 84 | |
| 85 | ly_ctx_destroy(ctx, NULL); |
| 86 | ctx = NULL; |
| 87 | |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | void |
| 92 | logbuf_clean(void) |
| 93 | { |
| 94 | logbuf[0] = '\0'; |
| 95 | } |
| 96 | |
| 97 | #if ENABLE_LOGGER_CHECKING |
| 98 | # define logbuf_assert(str) assert_string_equal(logbuf, str) |
| 99 | #else |
| 100 | # define logbuf_assert(str) |
| 101 | #endif |
| 102 | |
| 103 | static void |
| 104 | test_top_level(void **state) |
| 105 | { |
| 106 | *state = test_top_level; |
| 107 | |
| 108 | const struct lys_module *mod; |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 109 | struct lyd_node *node, *rpc; |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 110 | |
| 111 | /* we need the module first */ |
| 112 | mod = ly_ctx_get_module_implemented(ctx, "a"); |
| 113 | assert_non_null(mod); |
| 114 | |
| 115 | /* list */ |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 116 | assert_int_equal(lyd_new_list(NULL, mod, "l1", 0, &node, "val_a", "val_b"), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 117 | lyd_free_tree(node); |
| 118 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 119 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[]", 0, &node), LY_EVALID); |
Michal Vasko | 0b468e6 | 2020-10-19 09:33:04 +0200 | [diff] [blame] | 120 | logbuf_assert("Unexpected XPath token \"]\" (\"]\")."); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 121 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 122 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[key1='a'][key2='b']", 0, &node), LY_ENOTFOUND); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 123 | logbuf_assert("Not found node \"key1\" in path."); |
| 124 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 125 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[a='a'][b='b'][c='c']", 0, &node), LY_EVALID); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 126 | logbuf_assert("Key expected instead of leaf \"c\" in path. /a:l1/c"); |
| 127 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 128 | assert_int_equal(lyd_new_list2(NULL, mod, "c", "[a='a'][b='b']", 0, &node), LY_ENOTFOUND); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 129 | logbuf_assert("List node \"c\" not found."); |
| 130 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 131 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[a='a'][b='b']", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 132 | lyd_free_tree(node); |
| 133 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 134 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[a=''][b='']", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 135 | lyd_free_tree(node); |
| 136 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 137 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[a:a='a'][a:b='b']", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 138 | lyd_free_tree(node); |
| 139 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 140 | assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[a= 'a']\n[b =\t'b']", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 141 | lyd_free_tree(node); |
| 142 | |
| 143 | /* leaf */ |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 144 | assert_int_equal(lyd_new_term(NULL, mod, "foo", "[a='a'][b='b'][c='c']", 0, &node), LY_EVALID); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 145 | logbuf_assert("Invalid uint16 value \"[a='a'][b='b'][c='c']\". /a:foo"); |
| 146 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 147 | assert_int_equal(lyd_new_term(NULL, mod, "c", "value", 0, &node), LY_ENOTFOUND); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 148 | logbuf_assert("Term node \"c\" not found."); |
| 149 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 150 | assert_int_equal(lyd_new_term(NULL, mod, "foo", "256", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 151 | lyd_free_tree(node); |
| 152 | |
| 153 | /* leaf-list */ |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 154 | assert_int_equal(lyd_new_term(NULL, mod, "ll", "ahoy", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 155 | lyd_free_tree(node); |
| 156 | |
| 157 | /* container */ |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 158 | assert_int_equal(lyd_new_inner(NULL, mod, "c", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 159 | lyd_free_tree(node); |
| 160 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 161 | assert_int_equal(lyd_new_inner(NULL, mod, "l1", 0, &node), LY_ENOTFOUND); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 162 | logbuf_assert("Inner node (and not a list) \"l1\" not found."); |
| 163 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 164 | assert_int_equal(lyd_new_inner(NULL, mod, "l2", 0, &node), LY_ENOTFOUND); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 165 | logbuf_assert("Inner node (and not a list) \"l2\" not found."); |
| 166 | |
| 167 | /* anydata */ |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 168 | assert_int_equal(lyd_new_any(NULL, mod, "any", "some-value", LYD_ANYDATA_STRING, 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 169 | lyd_free_tree(node); |
| 170 | |
| 171 | /* key-less list */ |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 172 | assert_int_equal(lyd_new_list2(NULL, mod, "l2", "[a='a'][b='b']", 0, &node), LY_EVALID); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 173 | logbuf_assert("List predicate defined for keyless list \"l2\" in path."); |
| 174 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 175 | assert_int_equal(lyd_new_list2(NULL, mod, "l2", "", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 176 | lyd_free_tree(node); |
| 177 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 178 | assert_int_equal(lyd_new_list2(NULL, mod, "l2", NULL, 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 179 | lyd_free_tree(node); |
| 180 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 181 | assert_int_equal(lyd_new_list(NULL, mod, "l2", 0, &node), LY_SUCCESS); |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 182 | lyd_free_tree(node); |
| 183 | |
Radek Krejci | 41ac994 | 2020-11-02 14:47:56 +0100 | [diff] [blame] | 184 | /* RPC */ |
| 185 | assert_int_equal(lyd_new_inner(NULL, mod, "oper", 0, &rpc), LY_SUCCESS); |
| 186 | assert_int_equal(lyd_new_term(rpc, mod, "param", "22", 0, &node), LY_SUCCESS); |
| 187 | assert_int_equal(LY_TYPE_STRING, ((struct lysc_node_leaf *)node->schema)->type->basetype); |
| 188 | assert_int_equal(lyd_new_term(rpc, mod, "param", "22", 1, &node), LY_SUCCESS); |
| 189 | assert_int_equal(LY_TYPE_INT8, ((struct lysc_node_leaf *)node->schema)->type->basetype); |
| 190 | lyd_free_tree(rpc); |
| 191 | |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 192 | *state = NULL; |
| 193 | } |
| 194 | |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 195 | static void |
| 196 | test_opaq(void **state) |
| 197 | { |
| 198 | *state = test_opaq; |
| 199 | |
| 200 | struct lyd_node *root, *node; |
| 201 | struct lyd_node_opaq *opq; |
| 202 | |
Michal Vasko | 3a41dff | 2020-07-15 14:30:28 +0200 | [diff] [blame] | 203 | assert_int_equal(lyd_new_opaq(NULL, ctx, "node1", NULL, "my-module", &root), LY_SUCCESS); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 204 | assert_null(root->schema); |
| 205 | opq = (struct lyd_node_opaq *)root; |
| 206 | assert_string_equal(opq->name, "node1"); |
| 207 | assert_string_equal(opq->value, ""); |
Radek Krejci | 1798aae | 2020-07-14 13:26:06 +0200 | [diff] [blame] | 208 | assert_string_equal(opq->prefix.module_name, "my-module"); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 209 | |
Michal Vasko | 3a41dff | 2020-07-15 14:30:28 +0200 | [diff] [blame] | 210 | assert_int_equal(lyd_new_opaq(root, NULL, "node2", "value", "my-module2", &node), LY_SUCCESS); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 211 | assert_null(node->schema); |
| 212 | opq = (struct lyd_node_opaq *)node; |
| 213 | assert_string_equal(opq->name, "node2"); |
| 214 | assert_string_equal(opq->value, "value"); |
Radek Krejci | 1798aae | 2020-07-14 13:26:06 +0200 | [diff] [blame] | 215 | assert_string_equal(opq->prefix.module_name, "my-module2"); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 216 | assert_ptr_equal(opq->parent, root); |
| 217 | |
| 218 | lyd_free_tree(root); |
| 219 | |
| 220 | *state = NULL; |
| 221 | } |
| 222 | |
| 223 | static void |
| 224 | test_path(void **state) |
| 225 | { |
| 226 | *state = test_path; |
| 227 | |
| 228 | LY_ERR ret; |
| 229 | struct lyd_node *root, *node, *parent; |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 230 | |
| 231 | /* create 2 nodes */ |
| 232 | ret = lyd_new_path2(NULL, ctx, "/a:c/x[.='val']", "vvv", 0, 0, &root, &node); |
| 233 | assert_int_equal(ret, LY_SUCCESS); |
| 234 | assert_non_null(root); |
| 235 | assert_string_equal(root->schema->name, "c"); |
| 236 | assert_non_null(node); |
| 237 | assert_string_equal(node->schema->name, "x"); |
Michal Vasko | b7be7a8 | 2020-08-20 09:09:04 +0200 | [diff] [blame] | 238 | assert_string_equal("val", LYD_CANON_VALUE(node)); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 239 | |
| 240 | /* append another */ |
| 241 | ret = lyd_new_path2(root, NULL, "/a:c/x", "val2", 0, 0, &parent, &node); |
| 242 | assert_int_equal(ret, LY_SUCCESS); |
| 243 | assert_ptr_equal(parent, node); |
| 244 | assert_string_equal(node->schema->name, "x"); |
Michal Vasko | b7be7a8 | 2020-08-20 09:09:04 +0200 | [diff] [blame] | 245 | assert_string_equal("val2", LYD_CANON_VALUE(node)); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 246 | |
| 247 | /* and a last one */ |
| 248 | ret = lyd_new_path2(root, NULL, "x", "val3", 0, 0, &parent, &node); |
| 249 | assert_int_equal(ret, LY_SUCCESS); |
| 250 | assert_ptr_equal(parent, node); |
| 251 | assert_string_equal(node->schema->name, "x"); |
Michal Vasko | b7be7a8 | 2020-08-20 09:09:04 +0200 | [diff] [blame] | 252 | assert_string_equal("val3", LYD_CANON_VALUE(node)); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 253 | |
| 254 | lyd_free_tree(root); |
| 255 | |
| 256 | /* try LYD_NEWOPT_OPAQ */ |
| 257 | ret = lyd_new_path2(NULL, ctx, "/a:l1", NULL, 0, 0, NULL, NULL); |
| 258 | assert_int_equal(ret, LY_EINVAL); |
| 259 | logbuf_assert("Predicate missing for list \"l1\" in path."); |
| 260 | |
Radek Krejci | 092e33c | 2020-10-12 15:33:10 +0200 | [diff] [blame] | 261 | ret = lyd_new_path2(NULL, ctx, "/a:l1", NULL, 0, LYD_NEW_PATH_OPAQ, NULL, &root); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 262 | assert_int_equal(ret, LY_SUCCESS); |
| 263 | assert_non_null(root); |
| 264 | assert_null(root->schema); |
| 265 | |
| 266 | lyd_free_tree(root); |
| 267 | |
| 268 | ret = lyd_new_path2(NULL, ctx, "/a:foo", NULL, 0, 0, NULL, NULL); |
| 269 | assert_int_equal(ret, LY_EVALID); |
| 270 | logbuf_assert("Invalid empty uint16 value. /a:foo"); |
| 271 | |
Radek Krejci | 092e33c | 2020-10-12 15:33:10 +0200 | [diff] [blame] | 272 | ret = lyd_new_path2(NULL, ctx, "/a:foo", NULL, 0, LYD_NEW_PATH_OPAQ, NULL, &root); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 273 | assert_int_equal(ret, LY_SUCCESS); |
| 274 | assert_non_null(root); |
| 275 | assert_null(root->schema); |
| 276 | |
| 277 | lyd_free_tree(root); |
| 278 | |
| 279 | /* try LYD_NEWOPT_UPDATE */ |
| 280 | ret = lyd_new_path2(NULL, ctx, "/a:l2[1]/c/x", "val", 0, 0, &root, &node); |
| 281 | assert_int_equal(ret, LY_SUCCESS); |
| 282 | assert_non_null(root); |
| 283 | assert_string_equal(node->schema->name, "x"); |
Michal Vasko | b7be7a8 | 2020-08-20 09:09:04 +0200 | [diff] [blame] | 284 | assert_string_equal("val", LYD_CANON_VALUE(node)); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 285 | |
| 286 | ret = lyd_new_path2(root, NULL, "/a:l2[1]/c/x", "val", 0, 0, NULL, &node); |
| 287 | assert_int_equal(ret, LY_EEXIST); |
| 288 | |
Radek Krejci | 092e33c | 2020-10-12 15:33:10 +0200 | [diff] [blame] | 289 | ret = lyd_new_path2(root, NULL, "/a:l2[1]/c/x", "val", 0, LYD_NEW_PATH_UPDATE, NULL, &node); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 290 | assert_int_equal(ret, LY_SUCCESS); |
| 291 | assert_null(node); |
| 292 | |
Radek Krejci | 092e33c | 2020-10-12 15:33:10 +0200 | [diff] [blame] | 293 | ret = lyd_new_path2(root, NULL, "/a:l2[1]/c/x", "val2", 0, LYD_NEW_PATH_UPDATE, NULL, &node); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 294 | assert_int_equal(ret, LY_SUCCESS); |
| 295 | assert_non_null(node); |
| 296 | assert_string_equal(node->schema->name, "x"); |
Michal Vasko | b7be7a8 | 2020-08-20 09:09:04 +0200 | [diff] [blame] | 297 | assert_string_equal("val2", LYD_CANON_VALUE(node)); |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 298 | |
| 299 | lyd_free_tree(root); |
| 300 | |
| 301 | *state = NULL; |
| 302 | } |
| 303 | |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 304 | int main(void) |
| 305 | { |
| 306 | const struct CMUnitTest tests[] = { |
| 307 | cmocka_unit_test_setup_teardown(test_top_level, setup, teardown), |
Michal Vasko | 00cbf53 | 2020-06-15 13:58:47 +0200 | [diff] [blame] | 308 | cmocka_unit_test_setup_teardown(test_opaq, setup, teardown), |
| 309 | cmocka_unit_test_setup_teardown(test_path, setup, teardown), |
Michal Vasko | 004d315 | 2020-06-11 19:59:22 +0200 | [diff] [blame] | 310 | }; |
| 311 | |
| 312 | return cmocka_run_group_tests(tests, NULL, NULL); |
| 313 | } |