Skip to content

Commit 0d31e32

Browse files
committed
test: use MAX_MESSAGE_LENGTH constant in reverse interface tests
1 parent 873c8b0 commit 0d31e32

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_reverse_interface.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ std::condition_variable g_connection_condition;
4343
class TestableReverseInterface : public control::ReverseInterface
4444
{
4545
public:
46+
using control::ReverseInterface::MAX_MESSAGE_LENGTH;
47+
4648
TestableReverseInterface(const control::ReverseInterfaceConfig& config) : control::ReverseInterface(config)
4749
{
4850
}
@@ -85,11 +87,13 @@ class ReverseInterfaceTest : public ::testing::Test
8587

8688
void readMessage(int32_t& read_timeout, vector6int32_t& pos, int32_t& control_mode)
8789
{
90+
constexpr size_t MAX_MESSAGE_LENGTH = TestableReverseInterface::MAX_MESSAGE_LENGTH;
91+
8892
// Read message
89-
uint8_t buf[sizeof(int32_t) * 8];
93+
uint8_t buf[sizeof(int32_t) * MAX_MESSAGE_LENGTH];
9094
uint8_t* b_pos = buf;
9195
size_t read = 0;
92-
size_t remainder = sizeof(int32_t) * 8;
96+
size_t remainder = sizeof(int32_t) * MAX_MESSAGE_LENGTH;
9397
while (remainder > 0)
9498
{
9599
if (!TCPSocket::read(b_pos, remainder, read))

0 commit comments

Comments
 (0)