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

Function TEST

tests/cpp/data/test_file_iterator.cc:16–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15namespace xgboost::data {
16TEST(FileIterator, Basic) {
17 auto check_n_features = [](FileIterator *iter) {
18 size_t n_features = 0;
19 iter->Reset();
20 while (iter->Next()) {
21 auto proxy = MakeProxy(iter->Proxy());
22 auto csr = std::any_cast<std::shared_ptr<CSRArrayAdapter>>(proxy->Adapter());
23 n_features = std::max(n_features, csr->NumColumns());
24 }
25 ASSERT_EQ(n_features, 5);
26 };
27
28 common::TemporaryDirectory tmpdir;
29 {
30 auto zpath = tmpdir.Str() + "/0-based.svm";
31 CreateBigTestData(zpath, 3 * 64, true);
32 zpath += "?indexing_mode=0&format=libsvm";
33 FileIterator iter{zpath, 0, 1};
34 check_n_features(&iter);
35 }
36
37 {
38 auto opath = tmpdir.Str() + "/1-based.svm";
39 CreateBigTestData(opath, 3 * 64, false);
40 opath += "?indexing_mode=1&format=libsvm";
41 FileIterator iter{opath, 0, 1};
42 check_n_features(&iter);
43 }
44}
45} // namespace xgboost::data

Callers

nothing calls this directly

Calls 8

MakeProxyFunction · 0.85
CreateBigTestDataFunction · 0.85
AdapterMethod · 0.80
ResetMethod · 0.45
NextMethod · 0.45
ProxyMethod · 0.45
NumColumnsMethod · 0.45
StrMethod · 0.45

Tested by

no test coverage detected