From b4b01534acdca4c6d82d0952ce9a398a2554eea3 Mon Sep 17 00:00:00 2001 From: m0dB Date: Tue, 12 Nov 2024 19:32:50 +0100 Subject: [PATCH] adapt test to using signed instead of unsigned --- src/test/fifotest.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/test/fifotest.cpp b/src/test/fifotest.cpp index c4e17507270..23dbc696adf 100644 --- a/src/test/fifotest.cpp +++ b/src/test/fifotest.cpp @@ -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()); }