Skip to content

Commit 926ea8d

Browse files
committed
The great Thrust index type fix, part 4: verify count.
1 parent 306bec0 commit 926ea8d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

testing/count.cu

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,22 @@ void TestCountDispatchImplicit()
116116
}
117117
DECLARE_UNITTEST(TestCountDispatchImplicit);
118118

119+
void TestCountWithBigIndexesHelper(int magnitude)
120+
{
121+
thrust::counting_iterator<long long> begin(1);
122+
thrust::counting_iterator<long long> end = begin + (1ll << magnitude);
123+
ASSERT_EQUAL(thrust::distance(begin, end), 1ll << magnitude);
124+
125+
long long result = thrust::count(thrust::device, begin, end, (1ll << magnitude) - 17);
126+
127+
ASSERT_EQUAL(result, 1);
128+
}
129+
130+
void TestCountWithBigIndexes()
131+
{
132+
TestCountWithBigIndexesHelper(30);
133+
TestCountWithBigIndexesHelper(31);
134+
TestCountWithBigIndexesHelper(32);
135+
TestCountWithBigIndexesHelper(33);
136+
}
137+
DECLARE_UNITTEST(TestCountWithBigIndexes);

0 commit comments

Comments
 (0)