#include #include template struct TestMin { void operator()(void) { // 2 < 3 T two(2), three(3); ASSERT_EQUAL(two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two,three)); ASSERT_EQUAL(two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two,three,thrust::less())); ASSERT_EQUAL(two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (three,two)); ASSERT_EQUAL(two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (three,two,thrust::less())); ASSERT_EQUAL(three, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two,three,thrust::greater())); ASSERT_EQUAL(three, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (three,two,thrust::greater())); typedef key_value KV; KV two_and_two(two,two); KV two_and_three(two,three); // the first element breaks ties ASSERT_EQUAL_QUIET(two_and_two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_two, two_and_three)); ASSERT_EQUAL_QUIET(two_and_three, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_three, two_and_two)); ASSERT_EQUAL_QUIET(two_and_two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_two, two_and_three, thrust::less())); ASSERT_EQUAL_QUIET(two_and_three, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_three, two_and_two, thrust::less())); ASSERT_EQUAL_QUIET(two_and_two, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_two, two_and_three, thrust::greater())); ASSERT_EQUAL_QUIET(two_and_three, thrust::min THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_three, two_and_two, thrust::greater())); } }; SimpleUnitTest TestMinInstance; template struct TestMax { void operator()(void) { // 2 < 3 T two(2), three(3); ASSERT_EQUAL(three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two,three)); ASSERT_EQUAL(three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two,three,thrust::less())); ASSERT_EQUAL(three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (three,two)); ASSERT_EQUAL(three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (three,two,thrust::less())); ASSERT_EQUAL(two, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two,three,thrust::greater())); ASSERT_EQUAL(two, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (three,two,thrust::greater())); typedef key_value KV; KV two_and_two(two,two); KV two_and_three(two,three); // the first element breaks ties ASSERT_EQUAL_QUIET(two_and_two, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_two, two_and_three)); ASSERT_EQUAL_QUIET(two_and_three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_three, two_and_two)); ASSERT_EQUAL_QUIET(two_and_two, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_two, two_and_three, thrust::less())); ASSERT_EQUAL_QUIET(two_and_three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_three, two_and_two, thrust::less())); ASSERT_EQUAL_QUIET(two_and_two, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_two, two_and_three, thrust::greater())); ASSERT_EQUAL_QUIET(two_and_three, thrust::max THRUST_PREVENT_MACRO_SUBSTITUTION (two_and_three, two_and_two, thrust::greater())); } }; SimpleUnitTest TestMaxInstance;