| 31 | }; |
| 32 | |
| 33 | TEST(Transform, DeclareUnifiedTest(Basic)) { |
| 34 | const size_t size{256}; |
| 35 | std::vector<float> h_in(size); |
| 36 | std::vector<float> h_out(size); |
| 37 | std::iota(h_in.begin(), h_in.end(), 0); |
| 38 | std::vector<float> h_sol(size); |
| 39 | std::iota(h_sol.begin(), h_sol.end(), 0); |
| 40 | |
| 41 | auto device = TransformDevice(); |
| 42 | HostDeviceVector<float> const in_vec{h_in, device}; |
| 43 | HostDeviceVector<float> out_vec{h_out, device}; |
| 44 | out_vec.Fill(0); |
| 45 | |
| 46 | Transform<>::Init(TestTransformRange<float>{}, |
| 47 | Range{0, static_cast<Range::DifferenceType>(size)}, AllThreadsForTest(), |
| 48 | TransformDevice()) |
| 49 | .Eval(&out_vec, &in_vec); |
| 50 | std::vector<float> res = out_vec.HostVector(); |
| 51 | |
| 52 | ASSERT_TRUE(std::equal(h_sol.begin(), h_sol.end(), res.begin())); |
| 53 | } |
| 54 | |
| 55 | #if !defined(__CUDACC__) |
| 56 | TEST(TransformDeathTest, Exception) { |
nothing calls this directly
no test coverage detected