@@ -0,0 +1,2345 @@
+import unittest%0A%0Afrom cupy import testing%0A%0A%0A@testing.gpu%0Aclass TestMayShareMemory(unittest.TestCase):%0A%0A    @testing.numpy_cupy_equal()%0A    def test_different_arrays(self, xp):%0A        a = xp.array(%5B1, 2, 3%5D)%0A        b = xp.array(%5B1, 2, 3%5D)%0A        assert xp.may_share_memory(a, b) is False%0A%0A    @testing.numpy_cupy_equal()%0A    def test_same_array(self, xp):%0A        a = xp.array(%5B1, 2, 3%5D)%0A        assert xp.may_share_memory(a, a) is True%0A%0A    @testing.numpy_cupy_equal()%0A    def test_zero_size(self, xp):%0A        a = xp.array(%5B%5D)%0A        assert xp.may_share_memory(a, a) is False%0A%0A    @testing.numpy_cupy_equal()%0A    def test_shares_memory(self, xp):%0A        x = xp.arange(12)%0A        a = x%5B0:7%5D%0A        b = x%5B6:12%5D%0A        assert xp.may_share_memory(a, b) is True%0A%0A    @testing.numpy_cupy_equal()%0A    def test_cover(self, xp):%0A        x = xp.arange(12)%0A        a = x%5B1:10%5D%0A        b = x%5B4:6%5D%0A        assert xp.may_share_memory(a, b) is True%0A%0A    @testing.numpy_cupy_equal()%0A    def test_away(self, xp):%0A        x = xp.arange(12)%0A        a = x%5B1:6%5D%0A        b = x%5B8:11%5D%0A        assert xp.may_share_memory(a, b) is False%0A%0A    @testing.numpy_cupy_equal()%0A    def test_touch_edge_true(self, xp):%0A        x = xp.arange(12)%0A        a = x%5B1:10%5D%0A        b = x%5B7:10%5D%0A        assert xp.may_share_memory(a, b) is True%0A%0A    @testing.numpy_cupy_equal()%0A    def test_touch_edge_false(self, xp):%0A        x = xp.arange(12)%0A        a = x%5B1:7%5D%0A        b = x%5B7:10%5D%0A        assert xp.may_share_memory(a, b) is False%0A%0A    @testing.numpy_cupy_equal()%0A    def test_combination(self, xp):%0A        size = 4%0A%0A        slices = %5B%5D%0A        for start in range(0, size + 1):%0A            for end in range(start, size + 1):%0A                for step in range(-2, 2):%0A                    if step != 0:%0A                        slices.append(slice(start, end, step))%0A%0A        memory = xp.empty(size * size)%0A        arrays = %5B%5D%0A%0A        array_1d = memory%5B5:5+size%5D%0A        for s in slices:%0A            arrays.append(array_1d%5Bs%5D)%0A%0A        array_2d = memory.reshape(size, size)%0A        for s1 in slices:%0A            for s2 in slices:%0A                arrays.append(array_2d%5Bs1, s2%5D)%0A%0A        result = %5B%5D%0A%0A        for array1 in arrays:%0A            for array2 in arrays:%0A                ret = xp.may_share_memory(array1, array2)%0A                result.append(ret)%0A%0A        return result%0A

Add tests