diff --git a/tests/test_buffer.py b/tests/test_buffer.py index 1ac6a2db..219bf4ad 100644 --- a/tests/test_buffer.py +++ b/tests/test_buffer.py @@ -824,6 +824,18 @@ def test_SimpleArray_SimpleArrayPlex_type_switch(self): self.assertEqual( str(type(arrayplex_int32_2)), "") + def test_sort(self): + narr = np.random.randint(0, 100, 20, dtype='int32') + sarr = modmesh.SimpleArrayInt32(array=narr); + args = sarr.argsort() + for i in range(1, len(args)): + self.assertLessEqual(sarr[args[i]], sarr[args[i]]) + + sarr.sort() + for i in range(1, len(args)): + self.assertLessEqual(sarr[i - 1], sarr[i]) + + class SimpleArrayCalculatorsTC(unittest.TestCase): @@ -1068,5 +1080,7 @@ def test_construct(self): for it in range(6): ct[it] = it + 10 self.assertEqual(list(it + 10 for it in range(6)), list(ct)) + + # vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4: