@@ -10,64 +10,64 @@ def test_valid_triangulation_float32():
1010 result = earcut .triangulate_float32 (verts , rings )
1111
1212 assert result .dtype == np .uint32
13- assert result .shape == (3 , )
14- assert np .all (result == np .array ([1 , 2 , 0 ]))
13+ assert result .shape == (3 ,)
14+ assert np .array_equal (result , np .array ([1 , 2 , 0 ]))
1515
1616
1717def test_valid_triangulation_float64 ():
1818 verts = np .array ([[0 , 0 ], [1 , 0 ], [1 , 1 ]], dtype = np .float64 ).reshape (- 1 , 2 )
1919 rings = np .array ([3 ])
2020
21- result = earcut .triangulate_float32 (verts , rings )
21+ result = earcut .triangulate_float64 (verts , rings )
2222
2323 assert result .dtype == np .uint32
24- assert result .shape == (3 , )
25- assert np .all (result == np .array ([1 , 2 , 0 ]))
24+ assert result .shape == (3 ,)
25+ assert np .array_equal (result , np .array ([1 , 2 , 0 ]))
2626
2727
2828def test_valid_triangulation_int32 ():
2929 verts = np .array ([[0 , 0 ], [1 , 0 ], [1 , 1 ]], dtype = np .int32 ).reshape (- 1 , 2 )
3030 rings = np .array ([3 ])
3131
32- result = earcut .triangulate_float32 (verts , rings )
32+ result = earcut .triangulate_int32 (verts , rings )
3333
3434 assert result .dtype == np .uint32
35- assert result .shape == (3 , )
36- assert np .all (result == np .array ([1 , 2 , 0 ]))
35+ assert result .shape == (3 ,)
36+ assert np .array_equal (result , np .array ([1 , 2 , 0 ]))
3737
3838
39- def test_inverted_vertex_order ():
40- verts = np .array (
41- list (reversed ([[0 , 0 ], [1 , 0 ], [1 , 1 ]])), dtype = np .int32 ).reshape (
42- - 1 , 2 )
39+ def test_valid_triangulation_int64 ():
40+ verts = np .array ([[0 , 0 ], [1 , 0 ], [1 , 1 ]], dtype = np .int64 ).reshape (- 1 , 2 )
4341 rings = np .array ([3 ])
4442
45- result = earcut .triangulate_float32 (verts , rings )
43+ result = earcut .triangulate_int64 (verts , rings )
4644
4745 assert result .dtype == np .uint32
48- assert result .shape == (3 , )
49- assert np .all (result == np .array ([1 , 0 , 2 ]))
46+ assert result .shape == (3 ,)
47+ assert np .array_equal (result , np .array ([1 , 2 , 0 ]))
5048
5149
52- def test_no_triangles ():
53- verts = np .array ([[0 , 0 ], [1 , 0 ], [1 , 1 ]], dtype = np .int32 ).reshape (- 1 , 2 )
54- rings = np .array ([2 , 3 ])
50+ def test_inverted_vertex_order ():
51+ verts = np .array (list (reversed ([[0 , 0 ], [1 , 0 ], [1 , 1 ]])), dtype = np .int32 ).reshape (
52+ - 1 , 2
53+ )
54+ rings = np .array ([3 ])
5555
56- result = earcut .triangulate_float32 (verts , rings )
56+ result = earcut .triangulate_int32 (verts , rings )
5757
5858 assert result .dtype == np .uint32
59- assert result .shape == (0 , )
59+ assert result .shape == (3 ,)
60+ assert np .array_equal (result , np .array ([1 , 0 , 2 ]))
6061
6162
62- def test_valid_triangulation_int64 ():
63- verts = np .array ([[0 , 0 ], [1 , 0 ], [1 , 1 ]], dtype = np .int64 ).reshape (- 1 , 2 )
64- rings = np .array ([3 ])
63+ def test_no_triangles ():
64+ verts = np .array ([[0 , 0 ], [1 , 0 ], [1 , 1 ]], dtype = np .int32 ).reshape (- 1 , 2 )
65+ rings = np .array ([2 , 3 ])
6566
66- result = earcut .triangulate_float32 (verts , rings )
67+ result = earcut .triangulate_int32 (verts , rings )
6768
6869 assert result .dtype == np .uint32
69- assert result .shape == (3 , )
70- assert np .all (result == np .array ([1 , 2 , 0 ]))
70+ assert result .shape == (0 ,)
7171
7272
7373def test_end_index_too_large ():
@@ -124,4 +124,4 @@ def test_empty_data():
124124
125125 result = earcut .triangulate_float32 (verts , rings )
126126
127- assert result .shape == (0 , )
127+ assert result .shape == (0 ,)
0 commit comments