-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* clean up of the rounding functions * fix: time span math * fix: type annotations * cleanup xxhash tests
- Loading branch information
1 parent
60d7601
commit 85f0954
Showing
5 changed files
with
382 additions
and
1,936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from typing import TypedDict | ||
|
||
import ry | ||
|
||
_PWD = Path(__file__).parent.absolute() | ||
_TEST_DATA = _PWD / "xxhash.ndjson" | ||
|
||
XX32_SEEDS = [0, 1, 2**32 - 1] | ||
XX64_SEEDS = [0, 1, 2**64 - 1] | ||
XX128_SEEDS = [0, 1, 2**64 - 1] # same as 64-bit seeds | ||
|
||
|
||
class XXHashDataRecord(TypedDict): | ||
buf: str | ||
xxh32_0x00000000: str | ||
xxh32_0x00000001: str | ||
xxh32_0xFFFFFFFF: str | ||
xxh64_0x00000000: str | ||
xxh64_0x00000001: str | ||
xxh64_0xFFFFFFFFFFFFFFFF: str | ||
xxh3_64_0x00000000: str | ||
xxh3_64_0x00000001: str | ||
xxh3_64_0xFFFFFFFFFFFFFFFF: str | ||
xxh3_128_0x00000000: str | ||
xxh3_128_0x00000001: str | ||
xxh3_128_0xFFFFFFFFFFFFFFFF: str | ||
|
||
|
||
def _load_data(): | ||
with open(_TEST_DATA, "r") as f: | ||
xx32_test_data = f.read() | ||
lines = xx32_test_data.split("\n") | ||
return [ | ||
XXHashDataRecord( | ||
**row, | ||
) | ||
for row in ( | ||
ry.parse_json(line) for line in lines if line.strip() if line.strip() | ||
) | ||
] | ||
|
||
|
||
XXHASH_TEST_DATA = _load_data() |
Oops, something went wrong.