Update advance, is_sorted_until, is_sorted, merge_by_key, sort_variable tests
MODIFY
test/CMakeLists.txt
test/CMakeLists.txt
@@ -113,6 +113,7 @@ add_hipthrust_test("thrust.hip.sort" test_sort.cpp)
add_hipthrust_test("thrust.hip.sort_by_key" test_sort_by_key.cpp)
add_hipthrust_test("thrust.hip.sort_by_key_variable_bits" test_sort_by_key_variable_bits.cpp)
add_hipthrust_test("thrust.hip.sort_permutation_iterator" test_sort_permutation_iterator.cpp)
+add_hipthrust_test("thrust.hip.sort_variables" test_sort_variables.cpp)
add_hipthrust_test("thrust.hip.swap_ranges" test_swap_ranges.cpp)
add_hipthrust_test("thrust.hip.tabulate" test_tabulate.cpp)
add_hipthrust_test("thrust.hip.transform" test_transform.cpp)

MODIFY
test/test_advance.cpp
test/test_advance.cpp
-// Google Test
-#include <gtest/gtest.h>
-
+// MIT License
+//
+// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+// Thrust
#include <thrust/advance.h>
#include <thrust/sequence.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
-
-#include "test_utils.hpp"
-#include "test_assertions.hpp"
+#include "test_header.hpp"
-template<class InputType>
-struct Params
-{
- using input_type = InputType;
-};
-
-template<class Params> class AdvanceVectorTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-typedef ::testing::Types<
- Params<thrust::device_vector<short>>,
- Params<thrust::device_vector<int>>,
- Params<thrust::host_vector<short>>,
- Params<thrust::host_vector<int>>
-> VectorParams;
-
-TYPED_TEST_CASE(AdvanceVectorTests, VectorParams);
-
-#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+TESTS_DEFINE(AdvanceVectorTests, VectorSignedIntegerTestsParams);
// TODO expand this with other iterator types (forward, bidirectional, etc.)
@@ -63,5 +54,3 @@ TYPED_TEST(AdvanceVectorTests, TestAdvance)
ASSERT_EQ(*i, T(10));
}
-
-#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
\ No newline at end of file

MODIFY
test/test_is_sorted.cpp
test/test_is_sorted.cpp
// MIT License
//
-// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
+// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-// Google Test
-#include <gtest/gtest.h>
-
+// Thrust
#include <thrust/sort.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
-#include "test_utils.hpp"
-#include "test_assertions.hpp"
-
-#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+#include "test_header.hpp"
-template<class InputType> struct Params
-{
- using input_type = InputType;
-};
-
-template<class Params> class IsSortedTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-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>>
-> TestParams;
-
-TYPED_TEST_CASE(IsSortedTests, TestParams);
-
-template<class Params> class IsSortedVectorTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-typedef ::testing::Types<
- Params<thrust::device_vector<short>>,
- Params<thrust::device_vector<int>>,
- Params<thrust::host_vector<short>>,
- Params<thrust::host_vector<int>>
-> VectorParams;
-
-TYPED_TEST_CASE(IsSortedVectorTests, VectorParams);
+TESTS_DEFINE(IsSortedTests, FullTestsParams);
+TESTS_DEFINE(IsSortedVectorTests, VectorSignedIntegerTestsParams);
TYPED_TEST(IsSortedVectorTests, TestIsSortedSimple)
{
@@ -190,5 +135,3 @@ TEST(IsSortedTests, TestIsSortedDispatchImplicit)
ASSERT_EQ(13, vec.front());
}
-
-#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC

MODIFY
test/test_is_sorted_until.cpp
test/test_is_sorted_until.cpp
// MIT License
//
-// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
+// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-// Google Test
-#include <gtest/gtest.h>
-
+// Thrust
#include <thrust/sort.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
-#include "test_utils.hpp"
-#include "test_assertions.hpp"
-
-template<class InputType> struct Params
-{
- using input_type = InputType;
-};
+#include "test_header.hpp"
-template<class Params> class IsSortedUntilTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-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>>
-> TestParams;
-
-TYPED_TEST_CASE(IsSortedUntilTests, TestParams);
-
-template<class Params> class IsSortedUntilVectorTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-typedef ::testing::Types<
- Params<thrust::device_vector<short>>,
- Params<thrust::device_vector<int>>,
- Params<thrust::host_vector<short>>,
- Params<thrust::host_vector<int>>
-> VectorParams;
-
-TYPED_TEST_CASE(IsSortedUntilVectorTests, VectorParams);
-
-#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+TESTS_DEFINE(IsSortedUntilTests, FullTestsParams);
+TESTS_DEFINE(IsSortedUntilVectorTests, VectorSignedIntegerTestsParams);
TYPED_TEST(IsSortedUntilVectorTests, TestIsSortedUntilSimple)
{
@@ -213,5 +158,3 @@ TEST(IsSortedUntilTests, TestIsSortedUntilImplicit)
ASSERT_EQ(13, vec.front());
}
-
-#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC

MODIFY
test/test_merge_by_key.cpp
test/test_merge_by_key.cpp
// MIT License
//
-// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
+// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// 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/host_vector.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 MergeByKeyTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
+#include "test_header.hpp"
-template<class Params>
-class PrimitiveMergeByKeyTests : public ::testing::Test
-{
-public:
- using input_type = typename Params::input_type;
-};
-
-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>>
-> MergeByKeyTestsParams;
-
-typedef ::testing::Types<
- Params<short>,
- Params<int>,
- Params<long long>,
- Params<unsigned short>,
- Params<unsigned int>,
- Params<unsigned long long>,
- Params<float>,
- Params<double>
-> MergeByKeyTestsPrimitiveParams;
-
-TYPED_TEST_CASE(MergeByKeyTests, MergeByKeyTestsParams);
-TYPED_TEST_CASE(PrimitiveMergeByKeyTests, MergeByKeyTestsPrimitiveParams);
-
-#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+TESTS_DEFINE(MergeByKeyTests, FullTestsParams);
+TESTS_DEFINE(PrimitiveMergeByKeyTests, NumericalTestsParams);
TEST(MergeByKeyTests, UsingHip)
{
@@ -429,5 +367,3 @@ TYPED_TEST(PrimitiveMergeByKeyTests, MergeByKeyDescending)
}
}
}
-
-#endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC

Update advance, is_sorted_until, is_sorted, merge_by_key, sort_variable tests