Skip to content

Commit

Permalink
adapt test to using signed instead of unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
m0dB authored and m0dB committed Nov 12, 2024
1 parent 432326a commit b4b0153
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/test/fifotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,19 @@ TEST_P(FifoTest, flushReadTest) {

ASSERT_EQ(0, fifo.readAvailable());
ASSERT_EQ(100, fifo.write(data.data(), 100));
ASSERT_EQ((param.offset + 50) % param.expectedBufferSize,
fifo.flushReadData(50));
ASSERT_EQ((param.offset + 100) % param.expectedBufferSize,
fifo.flushReadData(1000000));

int expected;
expected = (param.offset + 50) % param.expectedBufferSize;
if (expected < 0) {
expected += param.expectedBufferSize;
}
ASSERT_EQ(expected, fifo.flushReadData(50));

expected = (param.offset + 100) % param.expectedBufferSize;
if (expected < 0) {
expected += param.expectedBufferSize;
}
ASSERT_EQ(expected, fifo.flushReadData(1000000));
ASSERT_EQ(param.expectedBufferSize, fifo.write(data.data(), 1000000));
ASSERT_EQ(param.expectedBufferSize, fifo.readAvailable());
}
Expand Down

0 comments on commit b4b0153

Please sign in to comment.