Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 37 lines (29 sloc) 1.116 kB
71d0b74 @wnbell separated zip_iterator unit tests into several files
wnbell authored
1 #include <unittest/unittest.h>
2 #include <thrust/iterator/zip_iterator.h>
3 #include <thrust/sort.h>
4
5 template <typename T>
6 struct TestZipIteratorStableSort
7 {
8 void operator()(const size_t n)
9 {
c284c9e @wnbell mark certain zip_iterator tests as KNOWN_FAILUREs on VS2005 w/ debugg…
wnbell authored
10 #if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) && (_MSC_VER == 1400) && defined(_DEBUG)
11 // fails on msvc80 SP1 in debug mode
12 KNOWN_FAILURE;
13 #else
dfbaadb @jaredhoberock Eliminate instances of "using namespace thrust" at global scope, whic…
jaredhoberock authored
14 using namespace thrust;
15
16 host_vector<T> h1 = unittest::random_integers<T>(n);
17 host_vector<T> h2 = unittest::random_integers<T>(n);
18
19 device_vector<T> d1 = h1;
20 device_vector<T> d2 = h2;
21
22 // sort on host
23 stable_sort( make_zip_iterator(make_tuple(h1.begin(), h2.begin())),
24 make_zip_iterator(make_tuple(h1.end(), h2.end())) );
71d0b74 @wnbell separated zip_iterator unit tests into several files
wnbell authored
25
dfbaadb @jaredhoberock Eliminate instances of "using namespace thrust" at global scope, whic…
jaredhoberock authored
26 // sort on device
27 stable_sort( make_zip_iterator(make_tuple(d1.begin(), d2.begin())),
28 make_zip_iterator(make_tuple(d1.end(), d2.end())) );
71d0b74 @wnbell separated zip_iterator unit tests into several files
wnbell authored
29
dfbaadb @jaredhoberock Eliminate instances of "using namespace thrust" at global scope, whic…
jaredhoberock authored
30 ASSERT_EQUAL_QUIET(h1, d1);
31 ASSERT_EQUAL_QUIET(h2, d2);
c284c9e @wnbell mark certain zip_iterator tests as KNOWN_FAILUREs on VS2005 w/ debugg…
wnbell authored
32 #endif
71d0b74 @wnbell separated zip_iterator unit tests into several files
wnbell authored
33 }
34 };
df98bcc @wnbell reduce memory consumption of TestZipIteratorStableSort and TestZipIte…
wnbell authored
35 VariableUnitTest<TestZipIteratorStableSort, unittest::type_list<char,short,int> > TestZipIteratorStableSortInstance;
71d0b74 @wnbell separated zip_iterator unit tests into several files
wnbell authored
36
Something went wrong with that request. Please try again.