* Verify that rte_jhash and rte_jhash_1word, rte_jhash_2words * and rte_jhash_3words return the same */
| 220 | * and rte_jhash_3words return the same |
| 221 | */ |
| 222 | static int |
| 223 | verify_jhash_words(void) |
| 224 | { |
| 225 | unsigned i; |
| 226 | uint32_t key[3]; |
| 227 | uint32_t hash, hash_words; |
| 228 | |
| 229 | for (i = 0; i < 3; i++) |
| 230 | key[i] = rand(); |
| 231 | |
| 232 | /* Test rte_jhash_1word */ |
| 233 | hash = rte_jhash(key, 4, 0); |
| 234 | hash_words = rte_jhash_1word(key[0], 0); |
| 235 | if (hash != hash_words) { |
| 236 | printf("rte_jhash returns different value (0x%x)" |
| 237 | "than rte_jhash_1word (0x%x)\n", |
| 238 | hash, hash_words); |
| 239 | return -1; |
| 240 | } |
| 241 | /* Test rte_jhash_2words */ |
| 242 | hash = rte_jhash(key, 8, 0); |
| 243 | hash_words = rte_jhash_2words(key[0], key[1], 0); |
| 244 | if (hash != hash_words) { |
| 245 | printf("rte_jhash returns different value (0x%x)" |
| 246 | "than rte_jhash_2words (0x%x)\n", |
| 247 | hash, hash_words); |
| 248 | return -1; |
| 249 | } |
| 250 | /* Test rte_jhash_3words */ |
| 251 | hash = rte_jhash(key, 12, 0); |
| 252 | hash_words = rte_jhash_3words(key[0], key[1], key[2], 0); |
| 253 | if (hash != hash_words) { |
| 254 | printf("rte_jhash returns different value (0x%x)" |
| 255 | "than rte_jhash_3words (0x%x)\n", |
| 256 | hash, hash_words); |
| 257 | return -1; |
| 258 | } |
| 259 | |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | /* |
| 264 | * Run all functional tests for hash functions |
no test coverage detected