Skip to content

Commit

Permalink
Add a basic test with hypothesis
Browse files Browse the repository at this point in the history
  • Loading branch information
insolor committed Jun 2, 2024
1 parent 606d8aa commit f6c65db
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 1 deletion.
149 changes: 148 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ peclasses = {version = "^0.4.0", source = "dfint"}

[tool.poetry.group.dev.dependencies]
ruff = "^0.4.7"
pytest = "^8.2.1"
hypothesis = "^6.103.0"

[tool.poetry.scripts]
search = "search_offsets.search:app"
Expand Down
Empty file added tests/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions tests/test_patterns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from hypothesis import given
from hypothesis import strategies as st

from search_offsets.patterns import hex_to_bytes


@given(st.integers(0, 255))
def test_hex_to_bytes(byte: int):
assert hex_to_bytes(f"{byte:02X}") == byte.to_bytes(1, "little")

0 comments on commit f6c65db

Please sign in to comment.