* Sequence of operations for find existing setsummary * * - create setsum * - find existing setsum: hit * - find non-existing setsum: miss * */
| 134 | * |
| 135 | */ |
| 136 | static int |
| 137 | test_member_find_existing(void) |
| 138 | { |
| 139 | struct rte_member_setsum *tmp_setsum = NULL, *result = NULL; |
| 140 | struct rte_member_parameters tmp_params = { |
| 141 | .name = "member_find_existing", |
| 142 | .num_keys = MAX_ENTRIES, /* Total hash table entries. */ |
| 143 | .key_len = KEY_SIZE, /* Length of hash key. */ |
| 144 | .type = RTE_MEMBER_TYPE_HT, |
| 145 | .num_set = 32, |
| 146 | .false_positive_rate = 0.03, |
| 147 | .prim_hash_seed = 1, |
| 148 | .sec_hash_seed = 11, |
| 149 | .socket_id = 0 /* NUMA Socket ID for memory. */ |
| 150 | }; |
| 151 | |
| 152 | /* Create */ |
| 153 | tmp_setsum = rte_member_create(&tmp_params); |
| 154 | TEST_ASSERT(tmp_setsum != NULL, "setsum creation failed"); |
| 155 | |
| 156 | /* Try to find existing hash table */ |
| 157 | result = rte_member_find_existing("member_find_existing"); |
| 158 | TEST_ASSERT(result == tmp_setsum, "could not find existing setsum"); |
| 159 | |
| 160 | /* Try to find non-existing hash table */ |
| 161 | result = rte_member_find_existing("member_find_non_existing"); |
| 162 | TEST_ASSERT(result == NULL, "found setsum that shouldn't exist"); |
| 163 | |
| 164 | /* Cleanup. */ |
| 165 | rte_member_free(tmp_setsum); |
| 166 | |
| 167 | return 0; |
| 168 | } |
| 169 | |
| 170 | /* |
| 171 | * Test for bad creating parameters |
no test coverage detected