MCPcopy Create free account
hub / github.com/catboost/catboost / TestSkip

Method TestSkip

util/folder/iterator_ut.cpp:137–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 }
136
137 inline void TestSkip() {
138 TDirHier hier;
139
140 const TString dir = "tmpdir";
141 const TDirHier::TPath path = {dir, 1};
142
143 hier.Add(path);
144 hier.AddDir(dir + LOCSLASH_C + "dir1");
145 hier.AddDir(dir + LOCSLASH_C + "dir1" + LOCSLASH_C + "dir2");
146 //
147 // Without skip
148 //
149 {
150 TDirIterator di(dir);
151
152 UNIT_ASSERT(di.Next());
153 UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
154 UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir2");
155 UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir2");
156 UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
157 UNIT_ASSERT(di.Next());
158 UNIT_ASSERT_EQUAL(di.Next(), nullptr);
159 }
160 //
161 // With skip
162 //
163 {
164 TDirIterator di(dir);
165
166 UNIT_ASSERT(di.Next());
167 auto ent = di.Next();
168 UNIT_ASSERT_EQUAL(TStringBuf(ent->fts_name), "dir1");
169 di.Skip(ent);
170 UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
171 UNIT_ASSERT(di.Next());
172 UNIT_ASSERT_EQUAL(di.Next(), nullptr);
173 }
174 }
175
176 inline void TestSort() {
177 TDirHier dh;

Callers

nothing calls this directly

Calls 4

AddDirMethod · 0.80
AddMethod · 0.45
NextMethod · 0.45
SkipMethod · 0.45

Tested by

no test coverage detected