Skip to content

Commit 357d505

Browse files
committed
Improved round_to_nearest tests
1 parent a61d221 commit 357d505

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/processors/test_round_to_nearest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ceil_to_nearest,
55
floor_to_nearest,
66
round_to_nearest,
7+
trunc_to_nearest
78
)
89

910

@@ -24,3 +25,15 @@ def test_round_to_nearest(compare_numba_vs_python):
2425
compare_numba_vs_python(ceil_to_nearest, w_in, 1.5)
2526
== np.array([-1.5, -1.5, 0.0, 0.0, 0.0, 0.0, 1.5, 1.5, 1.5, 1.5, 3.0])
2627
)
28+
29+
assert np.all(
30+
compare_numba_vs_python(trunc_to_nearest, w_in, 1.5)
31+
== np.array([-1.5, -1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, 1.5])
32+
)
33+
34+
w_in = np.nan
35+
assert np.isnan(compare_numba_vs_python(round_to_nearest, w_in, 1.5))
36+
assert np.isnan(compare_numba_vs_python(floor_to_nearest, w_in, 1.5))
37+
assert np.isnan(compare_numba_vs_python(ceil_to_nearest, w_in, 1.5))
38+
assert np.isnan(compare_numba_vs_python(trunc_to_nearest, w_in, 1.5))
39+

0 commit comments

Comments
 (0)