| 9 | namespace |
| 10 | { |
| 11 | UNIT_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 |