MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_get_fn

Function test_get_fn

dpdk/app/test/test_rib6.c:158–234  ·  view source on GitHub ↗

* Call rte_rib6_node access functions with incorrect input. * After call rte_rib6_node access functions with correct args * and check the return values for correctness */

Source from the content-addressed store, hash-verified

156 * and check the return values for correctness
157 */
158int32_t
159test_get_fn(void)
160{
161 struct rte_rib6 *rib = NULL;
162 struct rte_rib6_node *node;
163 struct rte_rib6_conf config;
164 void *ext;
165 uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE] = {192, 0, 2, 0, 0, 0, 0, 0,
166 0, 0, 0, 0, 0, 0, 0, 0};
167 uint8_t ip_ret[RTE_RIB6_IPV6_ADDR_SIZE];
168 uint64_t nh_set = 10;
169 uint64_t nh_ret;
170 uint8_t depth = 24;
171 uint8_t depth_ret;
172 int ret;
173
174 config.max_nodes = MAX_RULES;
175 config.ext_sz = 0;
176
177 rib = rte_rib6_create(__func__, SOCKET_ID_ANY, &config);
178 RTE_TEST_ASSERT(rib != NULL, "Failed to create RIB\n");
179
180 node = rte_rib6_insert(rib, ip, depth);
181 RTE_TEST_ASSERT(node != NULL, "Failed to insert rule\n");
182
183 /* test rte_rib6_get_ip() with incorrect args */
184 ret = rte_rib6_get_ip(NULL, ip_ret);
185 RTE_TEST_ASSERT(ret < 0,
186 "Call succeeded with invalid parameters\n");
187 ret = rte_rib6_get_ip(node, NULL);
188 RTE_TEST_ASSERT(ret < 0,
189 "Call succeeded with invalid parameters\n");
190
191 /* test rte_rib6_get_depth() with incorrect args */
192 ret = rte_rib6_get_depth(NULL, &depth_ret);
193 RTE_TEST_ASSERT(ret < 0,
194 "Call succeeded with invalid parameters\n");
195 ret = rte_rib6_get_depth(node, NULL);
196 RTE_TEST_ASSERT(ret < 0,
197 "Call succeeded with invalid parameters\n");
198
199 /* test rte_rib6_set_nh() with incorrect args */
200 ret = rte_rib6_set_nh(NULL, nh_set);
201 RTE_TEST_ASSERT(ret < 0,
202 "Call succeeded with invalid parameters\n");
203
204 /* test rte_rib6_get_nh() with incorrect args */
205 ret = rte_rib6_get_nh(NULL, &nh_ret);
206 RTE_TEST_ASSERT(ret < 0,
207 "Call succeeded with invalid parameters\n");
208 ret = rte_rib6_get_nh(node, NULL);
209 RTE_TEST_ASSERT(ret < 0,
210 "Call succeeded with invalid parameters\n");
211
212 /* test rte_rib6_get_ext() with incorrect args */
213 ext = rte_rib6_get_ext(NULL);
214 RTE_TEST_ASSERT(ext == NULL,
215 "Call succeeded with invalid parameters\n");

Callers

nothing calls this directly

Calls 9

rte_rib6_createFunction · 0.85
rte_rib6_insertFunction · 0.85
rte_rib6_get_ipFunction · 0.85
rte_rib6_get_depthFunction · 0.85
rte_rib6_set_nhFunction · 0.85
rte_rib6_get_nhFunction · 0.85
rte_rib6_get_extFunction · 0.85
rte_rib6_is_equalFunction · 0.85
rte_rib6_freeFunction · 0.85

Tested by

no test coverage detected