| 302 | } |
| 303 | |
| 304 | static int test_member_lookup(void) |
| 305 | { |
| 306 | int ret_ht, ret_cache, ret_vbf, i; |
| 307 | uint16_t set_ht, set_cache, set_vbf; |
| 308 | member_set_t set_ids_ht[NUM_SAMPLES] = {0}; |
| 309 | member_set_t set_ids_cache[NUM_SAMPLES] = {0}; |
| 310 | member_set_t set_ids_vbf[NUM_SAMPLES] = {0}; |
| 311 | |
| 312 | uint32_t num_key_ht = NUM_SAMPLES; |
| 313 | uint32_t num_key_cache = NUM_SAMPLES; |
| 314 | uint32_t num_key_vbf = NUM_SAMPLES; |
| 315 | |
| 316 | const void *key_array[NUM_SAMPLES]; |
| 317 | |
| 318 | /* Single lookup test */ |
| 319 | for (i = 0; i < NUM_SAMPLES; i++) { |
| 320 | ret_ht = rte_member_lookup(setsum_ht, &keys[i], &set_ht); |
| 321 | ret_cache = rte_member_lookup(setsum_cache, &keys[i], |
| 322 | &set_cache); |
| 323 | ret_vbf = rte_member_lookup(setsum_vbf, &keys[i], &set_vbf); |
| 324 | TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >= 0, |
| 325 | "single lookup function error"); |
| 326 | |
| 327 | TEST_ASSERT(set_ht == test_set[i] && |
| 328 | set_cache == test_set[i] && |
| 329 | set_vbf == test_set[i], |
| 330 | "single lookup set value error"); |
| 331 | } |
| 332 | printf("lookup single key success\n"); |
| 333 | |
| 334 | /* Bulk lookup test */ |
| 335 | for (i = 0; i < NUM_SAMPLES; i++) |
| 336 | key_array[i] = &keys[i]; |
| 337 | |
| 338 | ret_ht = rte_member_lookup_bulk(setsum_ht, key_array, |
| 339 | num_key_ht, set_ids_ht); |
| 340 | |
| 341 | ret_cache = rte_member_lookup_bulk(setsum_cache, key_array, |
| 342 | num_key_cache, set_ids_cache); |
| 343 | |
| 344 | ret_vbf = rte_member_lookup_bulk(setsum_vbf, key_array, |
| 345 | num_key_vbf, set_ids_vbf); |
| 346 | |
| 347 | TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >= 0, |
| 348 | "bulk lookup function error"); |
| 349 | |
| 350 | for (i = 0; i < NUM_SAMPLES; i++) { |
| 351 | TEST_ASSERT((set_ids_ht[i] == test_set[i]) && |
| 352 | (set_ids_cache[i] == test_set[i]) && |
| 353 | (set_ids_vbf[i] == test_set[i]), |
| 354 | "bulk lookup result error"); |
| 355 | } |
| 356 | |
| 357 | return 0; |
| 358 | } |
| 359 | |
| 360 | static int test_member_delete(void) |
| 361 | { |
no test coverage detected