MCPcopy Create free account
hub / github.com/dmlc/xgboost / TEST

Function TEST

tests/cpp/common/test_transform_range.cc:33–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33TEST(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__)
56TEST(TransformDeathTest, Exception) {

Callers

nothing calls this directly

Calls 9

TransformDeviceFunction · 0.85
InitFunction · 0.85
AllThreadsForTestFunction · 0.85
CPUFunction · 0.85
RangeClass · 0.50
beginMethod · 0.45
endMethod · 0.45
FillMethod · 0.45
EvalMethod · 0.45

Tested by

no test coverage detected