#include #include #include void ArrayViewTest(dmlc::array_view view, int base) { int cnt = base; for (int v : view) { CHECK_EQ(v, cnt); ++cnt; } } TEST(ArrayView, Basic) { std::vector vec{0, 1, 2}; ArrayViewTest(vec, 0); int arr[] = {1, 2, 3}; ArrayViewTest(dmlc::array_view(arr, arr + 3), 1); dmlc::array_view a = vec; CHECK_EQ(a.size(), vec.size()); }