-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into vector-like
- Loading branch information
Showing
5 changed files
with
47 additions
and
0 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.cache/ | ||
/*.egg-info/ | ||
__pycache__/ | ||
.hypothesis/ |
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pytest~=3.8 | ||
hypothesis |
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
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,18 @@ | ||
from ppb_vector import Vector2 | ||
import hypothesis.strategies as st | ||
|
||
vectors = lambda: st.builds( | ||
Vector2, | ||
st.floats(min_value=-1e300, max_value=1e300), | ||
st.floats(min_value=-1e300, max_value=1e300) | ||
) | ||
|
||
@st.composite | ||
def units(draw, elements=st.floats(min_value=0, max_value=360)): | ||
angle = draw(elements) | ||
return Vector2(1, 0).rotate(angle) | ||
|
||
|
||
def angle_isclose(x, y, epsilon = 6.5e-5): | ||
d = (x - y) % 360 | ||
return (d < epsilon) or (d > 360 - epsilon) |