(N, dtype)
| 10020 | @pytest.mark.parametrize("N", np.arange(2, 512)) |
| 10021 | @pytest.mark.parametrize("dtype", [np.int32, np.uint32, np.int64, np.uint64]) |
| 10022 | def test_argsort_int(N, dtype): |
| 10023 | rnd = np.random.RandomState(1100710816) |
| 10024 | # (1) random data with min and max values |
| 10025 | minv = np.iinfo(dtype).min |
| 10026 | maxv = np.iinfo(dtype).max |
| 10027 | arr = rnd.randint(low=minv, high=maxv, size=N, dtype=dtype) |
| 10028 | i, j = rnd.choice(N, 2, replace=False) |
| 10029 | arr[i] = minv |
| 10030 | arr[j] = maxv |
| 10031 | assert_arg_sorted(arr, np.argsort(arr, kind='quick')) |
| 10032 | |
| 10033 | # (2) random data with max value at the end of array |
| 10034 | # See: https://github.com/intel/x86-simd-sort/pull/39 |
| 10035 | arr = rnd.randint(low=minv, high=maxv, size=N, dtype=dtype) |
| 10036 | arr[N-1] = maxv |
| 10037 | assert_arg_sorted(arr, np.argsort(arr, kind='quick')) |
| 10038 | |
| 10039 | |
| 10040 | @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") |
nothing calls this directly
no test coverage detected