@@ -931,3 +931,47 @@ void remvoe_test() {
931931 thrust::remove (host_data.begin (), host_data.begin () + N, 1 );
932932 thrust::remove (device_data.begin (), device_data.begin () + N, 1 );
933933}
934+
935+ struct greater_than_four {
936+ __host__ __device__ bool operator ()(int x) const { return x > 4 ; }
937+ };
938+
939+ void find_if_test () {
940+ const int N = 4 ;
941+ int data[4 ] = {0 ,5 , 3 , 7 };
942+ thrust::device_vector<int > device_data (data, data + N);
943+ thrust::host_vector<int > host_data (data, data + N);
944+
945+ // CHECK:oneapi::dpl::find_if(oneapi::dpl::execution::seq, data, data+3, greater_than_four());
946+ // CHECK-NEXT:oneapi::dpl::find_if(oneapi::dpl::execution::make_device_policy(q_ct1), device_data.begin(), device_data.end(), greater_than_four());
947+ // CHECK-NEXT:oneapi::dpl::find_if(oneapi::dpl::execution::seq, host_data.begin(), host_data.end(), greater_than_four());
948+ // CHECK-NEXT:oneapi::dpl::find_if(oneapi::dpl::execution::seq, data, data+3, greater_than_four());
949+ // CHECK-NEXT:oneapi::dpl::find_if(oneapi::dpl::execution::make_device_policy(q_ct1), device_data.begin(), device_data.end(), greater_than_four());
950+ // CHECK-NEXT:oneapi::dpl::find_if(oneapi::dpl::execution::seq, host_data.begin(), host_data.end(), greater_than_four());
951+ thrust::find_if (data, data+3 , greater_than_four ());
952+ thrust::find_if (device_data.begin (), device_data.end (), greater_than_four ());
953+ thrust::find_if (host_data.begin (), host_data.end (), greater_than_four ());
954+ thrust::find_if (thrust::host, data, data+3 , greater_than_four ());
955+ thrust::find_if (thrust::device, device_data.begin (), device_data.end (), greater_than_four ());
956+ thrust::find_if (thrust::host, host_data.begin (), host_data.end (), greater_than_four ());
957+ }
958+
959+ void find_if_not_test () {
960+ const int N = 4 ;
961+ int data[4 ] = {0 ,5 , 3 , 7 };
962+ thrust::device_vector<int > device_data (data, data + N);
963+ thrust::host_vector<int > host_data (data, data + N);
964+
965+ // CHECK:oneapi::dpl::find_if_not(oneapi::dpl::execution::seq, data, data+3, greater_than_four());
966+ // CHECK-NEXT:oneapi::dpl::find_if_not(oneapi::dpl::execution::make_device_policy(q_ct1), device_data.begin(), device_data.end(), greater_than_four());
967+ // CHECK-NEXT:oneapi::dpl::find_if_not(oneapi::dpl::execution::seq, host_data.begin(), host_data.end(), greater_than_four());
968+ // CHECK-NEXT:oneapi::dpl::find_if_not(oneapi::dpl::execution::seq, data, data+3, greater_than_four());
969+ // CHECK-NEXT:oneapi::dpl::find_if_not(oneapi::dpl::execution::make_device_policy(q_ct1), device_data.begin(), device_data.end(), greater_than_four());
970+ // CHECK-NEXT:oneapi::dpl::find_if_not(oneapi::dpl::execution::seq, host_data.begin(), host_data.end(), greater_than_four());
971+ thrust::find_if_not (data, data+3 , greater_than_four ());
972+ thrust::find_if_not (device_data.begin (), device_data.end (), greater_than_four ());
973+ thrust::find_if_not (host_data.begin (), host_data.end (), greater_than_four ());
974+ thrust::find_if_not (thrust::host, data, data+3 , greater_than_four ());
975+ thrust::find_if_not (thrust::device, device_data.begin (), device_data.end (), greater_than_four ());
976+ thrust::find_if_not (thrust::host, host_data.begin (), host_data.end (), greater_than_four ());
977+ }
0 commit comments