Skip to content

Commit 22e04ea

Browse files
committed
reproduce the issue as appeared in boostorg#774. the issue arises when there's equal keys (values that are compared against) in the array
1 parent 9189a76 commit 22e04ea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/test_sort.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ BOOST_AUTO_TEST_CASE(sort_int2)
340340
host[size/4] = int2_(20.f, 0.f);
341341
host[(size*3)/4] = int2_(9.f, 0.f);
342342
host[size-3] = int2_(-10.0f, 0.f);
343+
host[size/2+1] = int2_(-10.0f, -1.f);
343344

344345
boost::compute::vector<int2_> vector(size, context);
345346
boost::compute::copy(host.begin(), host.end(), vector.begin(), queue);
@@ -356,9 +357,11 @@ BOOST_AUTO_TEST_CASE(sort_int2)
356357
);
357358
boost::compute::copy(vector.begin(), vector.end(), host.begin(), queue);
358359
BOOST_CHECK_CLOSE(host[0][0], -10.f, 0.1);
360+
BOOST_CHECK_CLOSE(host[1][0], -10.f, 0.1);
359361
BOOST_CHECK_CLOSE(host[(size - 3)][0], 9.f, 0.1);
360362
BOOST_CHECK_CLOSE(host[(size - 2)][0], 20.f, 0.1);
361363
BOOST_CHECK_CLOSE(host[(size - 1)][0], 100.f, 0.1);
364+
BOOST_CHECK_NE(host[0], host[1]);
362365
}
363366

364367
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)