MCPcopy Create free account
hub / github.com/apache/arrow / TestPathTree

Class TestPathTree

cpp/src/arrow/dataset/subtree_test.cc:59–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57};
58
59struct TestPathTree {
60 FileInfo info;
61 std::vector<TestPathTree> subtrees;
62
63 explicit TestPathTree(std::string file_path)
64 : info(FileInfo::File(std::move(file_path))) {}
65
66 TestPathTree(std::string dir_path, std::vector<TestPathTree> subtrees)
67 : info(FileInfo::Dir(std::move(dir_path))), subtrees(std::move(subtrees)) {}
68
69 TestPathTree(Forest::Ref ref, const std::vector<FileInfo>& infos) : info(infos[ref.i]) {
70 const Forest& forest = *ref.forest;
71
72 int begin = ref.i + 1;
73 int end = begin + ref.num_descendants();
74
75 for (int i = begin; i < end; ++i) {
76 subtrees.emplace_back(forest[i], infos);
77 i += forest[i].num_descendants();
78 }
79 }
80
81 bool operator==(const TestPathTree& other) const {
82 return info == other.info && subtrees == other.subtrees;
83 }
84
85 std::string ToString() const {
86 auto out = "\n" + info.path;
87 if (info.is_dir) out += "/";
88
89 for (const auto& subtree : subtrees) {
90 out += subtree.ToString();
91 }
92 return out;
93 }
94
95 friend std::ostream& operator<<(std::ostream& os, const TestPathTree& tree) {
96 return os << tree.ToString();
97 }
98};
99
100using PT = TestPathTree;
101

Callers

nothing calls this directly

Calls 1

ToStringMethod · 0.45

Tested by

no test coverage detected