Cleanup
Some reformatting and changing to using instead of typedef.
MODIFY
test/test_zip_iterator.cpp
test/test_zip_iterator.cpp
@@ -55,25 +55,54 @@ public:
using input_type = typename Params::input_type;
};
+typedef ::testing::Types<
+ Params<int>,
+ Params<unsigned int>,
+ Params<float>
+> ZipIteratorTests32BitParams;
+
+TYPED_TEST_CASE(ZipIterator32BitTests, ZipIteratorTests32BitParams);
+
template<class Params> class ZipIteratorVectorTests : public ::testing::Test
{
public:
using input_type = typename Params::input_type;
};
+typedef ::testing::Types<
+ Params<short>,
+ Params<int>,
+ Params<long long>,
+ Params<unsigned short>,
+ Params<unsigned int>,
+ Params<unsigned long long>,
+ Params<float>,
+ Params<double>
+> ZipIteratorTestsVectorParams;
+
+TYPED_TEST_CASE(ZipIteratorVectorTests, ZipIteratorTestsVectorParams);
+
template<class Params> class ZipIteratorNumericTests : public ::testing::Test
{
public:
using input_type = typename Params::input_type;
};
+typedef ::testing::Types<
+ Params<char>,
+ Params<signed char>,
+ Params<unsigned char>,
+ Params<short>,
+ Params<unsigned short>,
+ Params<int>,
+ Params<unsigned int>,
+ Params<long>,
+ Params<unsigned long>,
+ Params<long long>,
+ Params<unsigned long long>,
+ Params<float>
+> ZipIteratorTestsNumericParams;
-typedef ::testing::Types<Params<int>, Params<unsigned int>, Params<float> > ZipIteratorTests32BitParams;
-typedef ::testing::Types<Params<short>, Params<int>, Params<long long>, Params<unsigned short>, Params<unsigned int>, Params<unsigned long long>, Params<float>, Params<double> > ZipIteratorTestsVectorParams;
-typedef ::testing::Types<Params<char>, Params<signed char>, Params<unsigned char>, Params<short>, Params<unsigned short>, Params<int>, Params<unsigned int>, Params<long>, Params<unsigned long>, Params<long long>, Params<unsigned long long>, Params<float> > ZipIteratorTestsNumericParams;
-
-TYPED_TEST_CASE(ZipIterator32BitTests, ZipIteratorTests32BitParams);
-TYPED_TEST_CASE(ZipIteratorVectorTests, ZipIteratorTestsVectorParams);
TYPED_TEST_CASE(ZipIteratorNumericTests, ZipIteratorTestsNumericParams);
TEST(ZipIterator32BitTests, UsingHip)
@@ -98,12 +127,12 @@ TYPED_TEST(ZipIteratorVectorTests, TestZipIteratorManipulation)
sequence(
v2.begin(), v2.end());
- typedef tuple<typename thrust::device_vector<T>::iterator, typename thrust::device_vector<T>::iterator> IteratorTuple;
+ using IteratorTuple = tuple<typename thrust::device_vector<T>::iterator, typename thrust::device_vector<T>::iterator>;
IteratorTuple t = make_tuple(
v0.begin(), v1.begin());
- typedef zip_iterator<IteratorTuple> ZipIterator;
+ using ZipIterator = zip_iterator<IteratorTuple>;
// test construction
ZipIterator iter0 = make_zip_iterator(t);
@@ -168,16 +197,16 @@ TYPED_TEST(ZipIteratorVectorTests, TestZipIteratorReference)
using namespace thrust;
// test host types
- typedef typename host_vector<T>::iterator Iterator1;
- typedef typename host_vector<T>::const_iterator Iterator2;
- typedef tuple<Iterator1, Iterator2> IteratorTuple1;
- typedef zip_iterator<IteratorTuple1> ZipIterator1;
+ using Iterator1 = typename host_vector<T>::iterator;
+ using Iterator2 = typename host_vector<T>::const_iterator;
+ using IteratorTuple1 = tuple<Iterator1, Iterator2>;
+ using ZipIterator1 = zip_iterator<IteratorTuple1>;
- typedef typename iterator_reference<ZipIterator1>::type zip_iterator_reference_type1;
+ using zip_iterator_reference_type1 = typename iterator_reference<ZipIterator1>::type;
host_vector<T> h_variable(1);
- typedef tuple<T&, const T&> reference_type1;
+ using reference_type1 = tuple<T&, const T&>;
reference_type1 ref1(
*h_variable.begin(), *h_variable.cbegin());
@@ -190,16 +219,16 @@ TYPED_TEST(ZipIteratorVectorTests, TestZipIteratorReference)
// test device types
- typedef typename device_vector<T>::iterator Iterator3;
- typedef typename device_vector<T>::const_iterator Iterator4;
- typedef tuple<Iterator3, Iterator4> IteratorTuple2;
- typedef zip_iterator<IteratorTuple2> ZipIterator2;
+ using Iterator3 = typename device_vector<T>::iterator;
+ using Iterator4 = typename device_vector<T>::const_iterator;
+ using IteratorTuple2 = tuple<Iterator3, Iterator4>;
+ using ZipIterator2 = zip_iterator<IteratorTuple2>;
- typedef typename iterator_reference<ZipIterator2>::type zip_iterator_reference_type2;
+ using zip_iterator_reference_type2 = typename iterator_reference<ZipIterator2>::type;
device_vector<T> d_variable(1);
- typedef tuple<device_reference<T>, device_reference<const T> > reference_type2;
+ using reference_type2 = tuple<device_reference<T>, device_reference<const T> >;
reference_type2 ref2(
*d_variable.begin(), *d_variable.cbegin());
@@ -219,12 +248,12 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorTraversal)
#if 0
// test host types
- typedef typename host_vector<T>::iterator Iterator1;
- typedef typename host_vector<T>::const_iterator Iterator2;
- typedef tuple<Iterator1, Iterator2> IteratorTuple1;
- typedef zip_iterator<IteratorTuple1> ZipIterator1;
+ using Iterator1 = typename host_vector<T>::iterator;
+ using Iterator2 = typename host_vector<T>::const_iterator;
+ using IteratorTuple1 = tuple<Iterator1, Iterator2>;
+ using ZipIterator1 = zip_iterator<IteratorTuple1>;
- typedef typename iterator_traversal<ZipIterator1>::type zip_iterator_traversal_type1;
+ using zip_iterator_traversal_type1 = typename iterator_traversal<ZipIterator1>::type;
ASSERT_EQ(true,
(detail::is_convertible<zip_iterator_traversal_type1, random_access_traversal_tag>::value));
@@ -232,12 +261,12 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorTraversal)
#if 0
// test device types
- typedef typename device_vector<T>::iterator Iterator3;
- typedef typename device_vector<T>::const_iterator Iterator4;
- typedef tuple<Iterator3,Iterator4> IteratorTuple2;
- typedef zip_iterator<IteratorTuple2> ZipIterator2;
+ using Iterator3 = typename device_vector<T>::iterator;
+ using Iterator4 = typename device_vector<T>::const_iterator;
+ using IteratorTuple2 = tuple<Iterator3,Iterator4>;
+ using ZipIterator2 = zip_iterator<IteratorTuple2>;
- typedef typename iterator_traversal<ZipIterator2>::type zip_iterator_traversal_type2;
+ using zip_iterator_traversal_type2 = typename iterator_traversal<ZipIterator2>::type;
ASSERT_EQ(true,
(detail::is_convertible<zip_iterator_traversal_type2, thrust::random_access_traversal_tag>::value));
@@ -253,12 +282,12 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorSystem)
#if 0
// test host types
- typedef typename host_vector<T>::iterator Iterator1;
- typedef typename host_vector<T>::const_iterator Iterator2;
- typedef tuple<Iterator1,Iterator2> IteratorTuple1;
- typedef zip_iterator<IteratorTuple1> ZipIterator1;
+ using Iterator1 = typename host_vector<T>::iterator;
+ using Iterator2 = typename host_vector<T>::const_iterator;
+ using IteratorTuple1 = tuple<Iterator1,Iterator2>;
+ using ZipIterator1 = zip_iterator<IteratorTuple1>;
- typedef typename iterator_system<ZipIterator1>::type zip_iterator_system_type1;
+ using zip_iterator_system_type1 = typename iterator_system<ZipIterator1>::type;
#endif
// ASSERT_EQ(true, (detail::is_same<zip_iterator_system_type1, experimental::space::host>::value) );
@@ -266,12 +295,12 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorSystem)
#if 0
// test device types
- typedef typename device_vector<T>::iterator Iterator3;
- typedef typename device_vector<T>::const_iterator Iterator4;
- typedef tuple<Iterator3,Iterator4> IteratorTuple2;
- typedef zip_iterator<IteratorTuple1> ZipIterator2;
+ using Iterator3 = typename device_vector<T>::iterator;
+ using Iterator4 = typename device_vector<T>::const_iterator;
+ using IteratorTuple2 = tuple<Iterator3,Iterator4>;
+ using ZipIterator2 = zip_iterator<IteratorTuple1>;
- typedef typename iterator_system<ZipIterator2>::type zip_iterator_system_type2;
+ using zip_iterator_system_type2 = typename iterator_system<ZipIterator2>::type;
#endif
//ASSERT_EQUAL(true, (detail::is_convertible<zip_iterator_system_type2, experimental::space::device>::value) );
@@ -279,12 +308,12 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorSystem)
#if 0
// test any
- typedef counting_iterator<T> Iterator5;
- typedef counting_iterator<const T> Iterator6;
- typedef tuple<Iterator5, Iterator6> IteratorTuple3;
- typedef zip_iterator<IteratorTuple3> ZipIterator3;
+ using Iterator5 = counting_iterator<T>;
+ using Iterator6 = counting_iterator<const T>;
+ using IteratorTuple3 = tuple<Iterator5, Iterator6>;
+ using ZipIterator3 = zip_iterator<IteratorTuple3>;
- typedef typename iterator_system<ZipIterator3>::type zip_iterator_system_type3;
+ using zip_iterator_system_type3 = typename iterator_system<ZipIterator3>::type;
#endif
//ASSERT_EQ(true, (detail::is_convertible<zip_iterator_system_type3, thrust::experimental::space::any>::value) );
@@ -292,10 +321,10 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorSystem)
#if 0
// test host/any
- typedef tuple<Iterator1, Iterator5> IteratorTuple4;
- typedef zip_iterator<IteratorTuple4> ZipIterator4;
+ using IteratorTuple4 = tuple<Iterator1, Iterator5>;
+ using ZipIterator4 = zip_iterator<IteratorTuple4>;
- typedef typename iterator_system<ZipIterator4>::type zip_iterator_system_type4;
+ using zip_iterator_system_type4 = typename iterator_system<ZipIterator4>::type;
#endif
// ASSERT_EQ(true, (detail::is_convertible<zip_iterator_system_type4, thrust::host_system_tag>::value) );
@@ -303,10 +332,10 @@ TYPED_TEST(ZipIteratorNumericTests, TestZipIteratorSystem)
#if 0
// test any/host
-typedef tuple<Iterator5, Iterator1> IteratorTuple5;
-typedef zip_iterator<IteratorTuple5> ZipIterator5;
+using IteratorTuple5 = tuple<Iterator5, Iterator1>;
+using ZipIterator5 = zip_iterator<IteratorTuple5>;
-typedef typename iterator_system<ZipIterator5>::type zip_iterator_system_type5;
+using zip_iterator_system_type5 = typename iterator_system<ZipIterator5>::type;
#endif
//ASSERT_EQ(true, (detail::is_convertible<zip_iterator_system_type5, thrust::host_system_tag>::value) );
@@ -314,10 +343,10 @@ typedef typename iterator_system<ZipIterator5>::type zip_iterator_system_type5;
#if 0
// test device/any
-typedef tuple<Iterator3, Iterator5> IteratorTuple6;
-typedef zip_iterator<IteratorTuple6> ZipIterator6;
+using IteratorTuple6 = tuple<Iterator3, Iterator5>;
+using ZipIterator6 = zip_iterator<IteratorTuple6>;
-typedef typename iterator_system<ZipIterator6>::type zip_iterator_system_type6;
+using zip_iterator_system_type6 = typename iterator_system<ZipIterator6>::type;
#endif
//ASSERT_EQ(true, (detail::is_convertible<zip_iterator_system_type6, thrust::device_system_tag>::value) );
@@ -325,10 +354,10 @@ typedef typename iterator_system<ZipIterator6>::type zip_iterator_system_type6;
#if 0
// test any/device
-typedef tuple<Iterator5, Iterator3> IteratorTuple7;
-typedef zip_iterator<IteratorTuple7> ZipIterator7;
+using IteratorTuple7 = tuple<Iterator5, Iterator3>;
+using ZipIterator7 = zip_iterator<IteratorTuple7>;
-typedef typename iterator_system<ZipIterator7>::type zip_iterator_system_type7;
+using zip_iterator_system_type7 = typename iterator_system<ZipIterator7>::type;
#endif
// ASSERT_EQ(true, (detail::is_convertible<zip_iterator_system_type7, thrust::device_system_tag>::value) );
@@ -450,13 +479,13 @@ TEST(ZipIterator32BitTests, TestZipIteratorCopyAoSToSoA)
const size_t n = 1;
- typedef tuple<int, int> structure;
- typedef host_vector<structure> host_array_of_structures;
- typedef device_vector<structure> device_array_of_structures;
+ using structure = tuple<int, int>;
+ using host_array_of_structures = host_vector<structure>;
+ using device_array_of_structures = device_vector<structure>;
- typedef zip_iterator<tuple<host_vector<int>::iterator, host_vector<int>::iterator> > host_structure_of_arrays;
+ using host_structure_of_arrays = zip_iterator<tuple<host_vector<int>::iterator, host_vector<int>::iterator> >;
- typedef zip_iterator<tuple<device_vector<int>::iterator, device_vector<int>::iterator> > device_structure_of_arrays;
+ using device_structure_of_arrays = zip_iterator<tuple<device_vector<int>::iterator, device_vector<int>::iterator> >;
host_array_of_structures h_aos(
n, make_tuple(
@@ -516,12 +545,12 @@ TEST(ZipIterator32BitTests, TestZipIteratorCopySoAToAoS)
const size_t n = 1;
- typedef tuple<int, int> structure;
- typedef host_vector<structure> host_array_of_structures;
- typedef device_vector<structure> device_array_of_structures;
+ using structure = tuple<int, int>;
+ using host_array_of_structures = host_vector<structure>;
+ using device_array_of_structures = device_vector<structure>;
- typedef zip_iterator<tuple<host_vector<int>::iterator, host_vector<int>::iterator> > host_structure_of_arrays;
- typedef zip_iterator<tuple<device_vector<int>::iterator, device_vector<int>::iterator> > device_structure_of_arrays;
+ using host_structure_of_arrays = zip_iterator<tuple<host_vector<int>::iterator, host_vector<int>::iterator> >;
+ using device_structure_of_arrays = zip_iterator<tuple<device_vector<int>::iterator, device_vector<int>::iterator> >;
host_vector<int> h_field0(
n, 7), h_field1(

Cleanup

Some reformatting and changing to using instead of typedef.