Create CUnitQueue with queue size of 4 units. The size of 4 is chosen on purpose, because CUnitQueue::getNextAvailUnit(..) has the following condition `if (m_iCount * 10 > m_iSize * 9)`. With m_iSize = 4 it will be false up until m_iCount becomes 4. And there was an issue in getNextAvailUnit(..) in taking the very last element of the queue (it was skipped).
| 15 | /// And there was an issue in getNextAvailUnit(..) in taking |
| 16 | /// the very last element of the queue (it was skipped). |
| 17 | TEST(CUnitQueue, Increase) |
| 18 | { |
| 19 | srt::TestInit srtinit; |
| 20 | const int buffer_size_pkts = 4; |
| 21 | CUnitQueue unit_queue(buffer_size_pkts, 1500); |
| 22 | |
| 23 | vector<CUnit*> taken_units; |
| 24 | for (int i = 0; i < 5 * buffer_size_pkts; ++i) |
| 25 | { |
| 26 | CUnit* unit = unit_queue.getNextAvailUnit(); |
| 27 | ASSERT_NE(unit, nullptr); |
| 28 | unit_queue.makeUnitTaken(unit); |
| 29 | taken_units.push_back(unit); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | /// Create CUnitQueue with queue size of 4 units. |
| 34 | /// Then after requesting the 5th unit, free the previous |
nothing calls this directly
no test coverage detected