Skip to content

Commit

Permalink
test(vec): test for rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
nkemnitz authored and dodamih committed Aug 1, 2023
1 parent 2b3dc9f commit 16053c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/unit/geometry/test_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
some_int = 42

vec3d = Vec3D(1.0, 2.0, 3.0)
vec3d_fp1 = Vec3D(0.1, 0.6 / 3.0, 0.1 + 0.2)
vec3d_fp2 = Vec3D(0.1, 0.2, 0.3)
vec3d_neg = Vec3D(-1.0, -2.0, -3.0)
vec3d_lg = Vec3D(1.5, 2.5, 3.5)
vec3d_mx = Vec3D(0.5, 2.5, 3.0)
Expand Down Expand Up @@ -172,6 +174,10 @@ def test_neg():
assert vec3d == -vec3d_neg


def test_round():
assert round(vec3d_fp1, 8) == vec3d_fp2


@pytest.mark.parametrize(
"arg1, arg2, fname, dtype",
[
Expand Down Expand Up @@ -346,6 +352,7 @@ def test_inference_return_int3d(x: Vec3D[int]):
some_int * intvec3d,
some_int // intvec3d,
some_int % intvec3d,
round(intvec3d),
]:

test_inference_return_int3d(x)
Expand Down Expand Up @@ -402,5 +409,6 @@ def test_inference_return_vec3d(x: Vec3D):
some_float // intvec3d,
some_float / intvec3d,
some_float % intvec3d,
round(vec3d),
]:
test_inference_return_vec3d(y)

0 comments on commit 16053c4

Please sign in to comment.