mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 16:48:18 +00:00
xxhash: Add custom secret tests.
This commit is contained in:
@@ -167,7 +167,7 @@ test_xxhash_vectors :: proc(t: ^testing.T) {
|
||||
defer delete(buf)
|
||||
|
||||
for seed, table in XXHASH_TEST_VECTOR_SEEDED {
|
||||
fmt.printf("Seed: %v\n", seed)
|
||||
fmt.printf("\tSeed: %v\n", seed)
|
||||
|
||||
for v, i in table {
|
||||
b := buf[:i]
|
||||
@@ -185,4 +185,20 @@ test_xxhash_vectors :: proc(t: ^testing.T) {
|
||||
expect(t, xxh3_128 == v.xxh3_128, xxh3_128_error)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.println("Verifying against XXHASH_TEST_VECTOR_SEEDED:")
|
||||
for secret, table in XXHASH_TEST_VECTOR_SECRET {
|
||||
fmt.printf("\tSecret:\n\t\t\"%v\"\n", secret)
|
||||
|
||||
secret_bytes := transmute([]u8)secret
|
||||
|
||||
for v, i in table {
|
||||
b := buf[:i]
|
||||
|
||||
xxh3_128 := xxhash.XXH3_128(b, secret_bytes)
|
||||
xxh3_128_error := fmt.tprintf("[XXH3_128(%03d)] Expected: %32x. Got: %32x.", i, v.xxh3_128_secret, xxh3_128)
|
||||
|
||||
expect(t, xxh3_128 == v.xxh3_128_secret, xxh3_128_error)
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user