MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/coding/coding_tests/move_to_front_tests.cpp:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace
10{
11UNIT_TEST(MoveToFront_Smoke)
12{
13 MoveToFront mtf;
14 for (size_t i = 0; i < 256; ++i)
15 TEST_EQUAL(mtf[i], i, ());
16
17 // Initially 3 should be on the 3rd position.
18 TEST_EQUAL(mtf.Transform(3), 3, ());
19
20 // After the first transform, 3 should be moved to the 0th position.
21 TEST_EQUAL(mtf.Transform(3), 0, ());
22 TEST_EQUAL(mtf.Transform(3), 0, ());
23 TEST_EQUAL(mtf.Transform(3), 0, ());
24
25 TEST_EQUAL(mtf[0], 3, ());
26 TEST_EQUAL(mtf[1], 0, ());
27 TEST_EQUAL(mtf[2], 1, ());
28 TEST_EQUAL(mtf[3], 2, ());
29 for (size_t i = 4; i < 256; ++i)
30 TEST_EQUAL(mtf[i], i, ());
31}
32} // namespace

Callers

nothing calls this directly

Calls 1

TransformMethod · 0.45

Tested by

no test coverage detected