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

Function CheckIterationAfterCut

util/generic/intrlist_ut.cpp:204–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204static void CheckIterationAfterCut(const TMyList& l, const TMyList& l2, size_t N, size_t M) {
205 size_t c = 0;
206 for (TMyList::TConstIterator it = l.Begin(); it != l.End(); ++it) {
207 ++c;
208
209 UNIT_ASSERT_EQUAL(*it, (int)c);
210 }
211
212 UNIT_ASSERT_EQUAL(c, M);
213
214 for (TMyList::TConstIterator it = l2.Begin(); it != l2.End(); ++it) {
215 ++c;
216
217 UNIT_ASSERT_EQUAL(*it, (int)c);
218 }
219
220 UNIT_ASSERT_EQUAL(c, N);
221
222 for (TMyList::TConstIterator it = l2.End(); it != l2.Begin(); --c) {
223 --it;
224
225 UNIT_ASSERT_EQUAL(*it, (int)c);
226 }
227
228 UNIT_ASSERT_EQUAL(c, M);
229
230 for (TMyList::TConstIterator it = l.End(); it != l.Begin(); --c) {
231 --it;
232
233 UNIT_ASSERT_EQUAL(*it, (int)c);
234 }
235
236 UNIT_ASSERT_EQUAL(c, 0);
237}
238
239static void TestCutFront(int N, int M) {
240 TMyList l(N);

Callers 2

TestCutFrontFunction · 0.85
TestCutBackFunction · 0.85

Calls 2

BeginMethod · 0.45
EndMethod · 0.45

Tested by 2

TestCutFrontFunction · 0.68
TestCutBackFunction · 0.68