From 574bc64e196184a4024fbf1ff5e4370b35d8b4c7 Mon Sep 17 00:00:00 2001 From: Lin Yuan Date: Thu, 5 Sep 2019 14:29:50 -0700 Subject: [PATCH] add test --- tests/python/unittest/test_ndarray.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/python/unittest/test_ndarray.py b/tests/python/unittest/test_ndarray.py index a05b3eae0e44..7091abf7308a 100644 --- a/tests/python/unittest/test_ndarray.py +++ b/tests/python/unittest/test_ndarray.py @@ -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()