refactored the tests based on https://github.com/cupy/cupy/pull/2536#issuecomment-539796775
refactored the tests based on https://github.com/cupy/cupy/pull/2536#issuecomment-539796775

cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy