Refractor test_replace
MODIFY
test/test_replace.cpp
test/test_replace.cpp
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-// Google Test
-#include <gtest/gtest.h>
-#include "test_utils.hpp"
-
// Thrust
#include <thrust/device_vector.h>
#include <thrust/replace.h>
#include <thrust/iterator/discard_iterator.h>
#include <thrust/iterator/retag.h>
-// HIP API
-#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
-#include <hip/hip_runtime_api.h>
-#include <hip/hip_runtime.h>
-
-#define HIP_CHECK(condition) ASSERT_EQ(condition, hipSuccess)
-#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
-
-template< class InputType >
-struct Params
-{
- using input_type = InputType;
-};
-
-template<class Params>
-class ReplaceTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-template<class Params>
-class PrimitiveReplaceTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
+#include "test_header.hpp"
-typedef ::testing::Types<
- Params<thrust::host_vector<short>>,
- Params<thrust::host_vector<int>>,
- Params<thrust::host_vector<long long>>,
- Params<thrust::host_vector<unsigned short>>,
- Params<thrust::host_vector<unsigned int>>,
- Params<thrust::host_vector<unsigned long long>>,
- Params<thrust::host_vector<float>>,
- Params<thrust::host_vector<double>>,
- Params<thrust::device_vector<short>>,
- Params<thrust::device_vector<int>>,
- Params<thrust::device_vector<long long>>,
- Params<thrust::device_vector<unsigned short>>,
- Params<thrust::device_vector<unsigned int>>,
- Params<thrust::device_vector<unsigned long long>>,
- Params<thrust::device_vector<float>>,
- Params<thrust::device_vector<double>>
-> ReplaceTestsParams;
-
-typedef ::testing::Types<
- Params<short>,
- Params<int>,
- Params<long long>,
- Params<unsigned short>,
- Params<unsigned int>,
- Params<unsigned long long>,
- Params<float>,
- Params<double>
-> ReplaceTestsPrimitiveParams;
-
-TYPED_TEST_CASE(ReplaceTests, ReplaceTestsParams);
-TYPED_TEST_CASE(PrimitiveReplaceTests, ReplaceTestsPrimitiveParams);
-
-#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+TESTS_DEFINE(ReplaceTests, FullTestsParams)
+TESTS_DEFINE(PrimitiveReplaceTests, NumericalTestsParams)
TEST(ReplaceTests, UsingHip)
{
@@ -816,4 +754,4 @@ TYPED_TEST(PrimitiveReplaceTests, ReplaceCopyIfStencilToDiscardIteratorRandomDat
}
}
-#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+//#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC

Refractor test_replace