Commit 370e9115e4888c2f2568f61795c7ee41886e6c65
1 parent
70e77e6a
Fix circular buffer off-by-one bug in test
Showing
1 changed file
with
2 additions
and
1 deletions
FlashMQTests/tst_maintests.cpp
| @@ -228,9 +228,10 @@ void MainTests::test_circbuf_unwrapped_doubling() | @@ -228,9 +228,10 @@ void MainTests::test_circbuf_unwrapped_doubling() | ||
| 228 | { | 228 | { |
| 229 | QCOMPARE(tail[i], i+1); | 229 | QCOMPARE(tail[i], i+1); |
| 230 | } | 230 | } |
| 231 | - QCOMPARE(buf.buf[64], 0); // Vacant place, because of the circulerness. | 231 | + QCOMPARE(buf.buf[63], 0); // Vacant place, because of the circulerness. |
| 232 | 232 | ||
| 233 | MYCASTCOMPARE(buf.head, 63); | 233 | MYCASTCOMPARE(buf.head, 63); |
| 234 | + QCOMPARE(buf.freeSpace(), 0); | ||
| 234 | 235 | ||
| 235 | buf.doubleSize(); | 236 | buf.doubleSize(); |
| 236 | tail = buf.tailPtr(); | 237 | tail = buf.tailPtr(); |