@@ -26,6 +26,41 @@ def creator(request):
26
26
return request .param [0 ], request .param [1 ]
27
27
28
28
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
+
29
64
def test_create_datatypes (creator , datatype ):
30
65
shape = (6 , 4 )
31
66
func , expected_value = creator
0 commit comments