@@ -26,6 +26,41 @@ def creator(request):
2626 return request .param [0 ], request .param [1 ]
2727
2828
29+ def test_arange ():
30+ n = 10
31+ a = sp .arange (0 , n , 1 , dtype = sp .int32 , device = device )
32+ assert tuple (a .shape ) == (n ,)
33+ assert numpy .allclose (sp .to_numpy (a ), list (range (n )))
34+
35+
36+ def test_arange2 ():
37+ n = 10
38+ a = sp .arange (0 , n , dtype = sp .int32 , device = device )
39+ assert tuple (a .shape ) == (n ,)
40+ assert numpy .allclose (sp .to_numpy (a ), list (range (n )))
41+
42+
43+ def test_arange3 ():
44+ n = 10
45+ a = sp .arange (n , device = device )
46+ assert tuple (a .shape ) == (n ,)
47+ assert numpy .allclose (sp .to_numpy (a ), list (range (n )))
48+
49+
50+ def test_arange_empty ():
51+ n = 10
52+ a = sp .arange (n , 0 , device = device )
53+ assert tuple (a .shape ) == (0 ,)
54+ assert numpy .allclose (sp .to_numpy (a ), list ())
55+
56+
57+ def test_arange_empty2 ():
58+ n = 10
59+ a = sp .arange (0 , n , - 1 , device = device )
60+ assert tuple (a .shape ) == (0 ,)
61+ assert numpy .allclose (sp .to_numpy (a ), list ())
62+
63+
2964def test_create_datatypes (creator , datatype ):
3065 shape = (6 , 4 )
3166 func , expected_value = creator
0 commit comments