Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
apeforest committed Sep 5, 2019
1 parent 982c031 commit 574bc64
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/python/unittest/test_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,25 @@ def test_op(op, num_inputs, mutated_inputs, **kwargs):
{'rescale_grad': 0.1, 'lr': 0.01, 'wd': 1e-3})


def test_large_int_rounding():
large_integer = 50000001

a = mx.nd.array([large_integer], dtype='int32')
assert np.all(a == large_integer)

a = mx.nd.array([large_integer], dtype='int32').floor()
assert np.all(a == large_integer)

a = mx.nd.array([large_integer], dtype='int32').round()
assert np.all(a == large_integer)

a = mx.nd.array([large_integer], dtype='int32').ceil()
assert np.all(a == large_integer)

a = mx.nd.array([large_integer], dtype='int32').trunc()
assert np.all(a == large_integer)


if __name__ == '__main__':
import nose
nose.runmodule()

0 comments on commit 574bc64

Please sign in to comment.