@@ -213,33 +213,42 @@ struct TestPairGet
213
213
};
214
214
SimpleUnitTest<TestPairGet, BuiltinNumericTypes> TestPairGetInstance;
215
215
216
+ using PairConstVolatileTypes =
217
+ unittest::type_list<thrust::pair<int , float >, thrust::pair<int , float > const ,
218
+ thrust::pair<int , float > const volatile >;
216
219
217
- void TestPairTupleSize (void )
220
+ template <typename Pair>
221
+ struct TestPairTupleSize
218
222
{
219
- int result = thrust::tuple_size< thrust::pair<int ,int > >::value;
220
- ASSERT_EQUAL (2 , result);
221
-
222
- // test const pair
223
- int const_result = thrust::tuple_size< thrust::pair<int ,int > const >::value;
224
- ASSERT_EQUAL (2 , const_result);
223
+ void operator ()()
224
+ {
225
+ ASSERT_EQUAL (2 , static_cast <int >(thrust::tuple_size<Pair>::value));
226
+ }
225
227
};
226
- DECLARE_UNITTEST ( TestPairTupleSize) ;
228
+ SimpleUnitTest< TestPairTupleSize, PairConstVolatileTypes> TestPairTupleSizeInstance ;
227
229
228
230
229
231
void TestPairTupleElement (void )
230
232
{
231
- typedef thrust::tuple_element<0 , thrust::pair<int , float > >::type type0;
232
- typedef thrust::tuple_element<1 , thrust::pair<int , float > >::type type1;
233
-
234
- ASSERT_EQUAL_QUIET (typeid (int ), typeid (type0));
235
- ASSERT_EQUAL_QUIET (typeid (float ), typeid (type1));
236
-
237
- // test const pair
238
- typedef thrust::tuple_element<0 , thrust::pair<int , float > const >::type const_type0;
239
- typedef thrust::tuple_element<1 , thrust::pair<int , float > const >::type const_type1;
240
-
241
- ASSERT_EQUAL_QUIET (typeid (int const ), typeid (const_type0));
242
- ASSERT_EQUAL_QUIET (typeid (float const ), typeid (const_type1));
233
+ using type0 = thrust::tuple_element<0 , thrust::pair<int , float > >::type;
234
+ using type1 = thrust::tuple_element<1 , thrust::pair<int , float > >::type;
235
+ static_assert (std::is_same<int , type0>::value," " );
236
+ static_assert (std::is_same<float , type1>::value," " );
237
+
238
+ using c_type0 = thrust::tuple_element<0 , thrust::pair<int , float > const >::type;
239
+ using c_type1 = thrust::tuple_element<1 , thrust::pair<int , float > const >::type;
240
+ static_assert (std::is_same<int const , c_type0>::value," " );
241
+ static_assert (std::is_same<float const , c_type1>::value," " );
242
+
243
+ using v_type0 = thrust::tuple_element<0 , thrust::pair<int , float > volatile >::type;
244
+ using v_type1 = thrust::tuple_element<1 , thrust::pair<int , float > volatile >::type;
245
+ static_assert (std::is_same<int volatile , v_type0>::value," " );
246
+ static_assert (std::is_same<float volatile , v_type1>::value," " );
247
+
248
+ using cv_type0 = thrust::tuple_element<0 , thrust::pair<int , float > const volatile >::type;
249
+ using cv_type1 = thrust::tuple_element<1 , thrust::pair<int , float > const volatile >::type;
250
+ static_assert (std::is_same<int const volatile , cv_type0>::value," " );
251
+ static_assert (std::is_same<float const volatile , cv_type1>::value," " );
243
252
};
244
253
DECLARE_UNITTEST (TestPairTupleElement);
245
254
0 commit comments