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

Function TestXRangeImpl

util/generic/xrange_ut.cpp:10–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9Y_UNIT_TEST_SUITE(XRange) {
10 void TestXRangeImpl(size_t begin, size_t end) {
11 size_t count = 0;
12 size_t sum = 0;
13 size_t first = 42;
14 bool firstInited = false;
15 size_t last = 0;
16
17 for (auto i : xrange(begin, end)) {
18 ++count;
19 sum += i;
20 last = i;
21 if (!firstInited) {
22 first = i;
23 firstInited = true;
24 }
25 }
26
27 UNIT_ASSERT_VALUES_EQUAL(count, end - begin);
28 UNIT_ASSERT_VALUES_EQUAL(first, begin);
29 UNIT_ASSERT_VALUES_EQUAL(last, end - 1);
30 UNIT_ASSERT_VALUES_EQUAL(sum, count * (first + last) / 2);
31 }
32
33 void TestSteppedXRangeImpl(int begin, int end, int step, const TVector<int>& expected) {
34 size_t expInd = 0;

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 1

xrangeFunction · 0.85

Tested by

no test coverage detected