Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor unit test cleanups #23723

Merged
merged 2 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/support/tests/TestBytesToHex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ void TestHexToBytesAndUint(nlTestSuite * inSuite, void * inContext)
NL_TEST_ASSERT(inSuite, test16Out == test16OutExpected);
}

#if CHIP_PROGRESS_LOGGING

ENFORCE_FORMAT(3, 0) void AccumulateLogLineCallback(const char * module, uint8_t category, const char * msg, va_list args)
{
(void) module;
Expand Down Expand Up @@ -427,13 +429,15 @@ void TestLogBufferAsHex(nlTestSuite * inSuite, void * inContext)
}
}

#endif

const nlTest sTests[] = {
NL_TEST_DEF("TestBytesToHexNotNullTerminated", TestBytesToHexNotNullTerminated), //
NL_TEST_DEF("TestBytesToHexNullTerminated", TestBytesToHexNullTerminated), //
NL_TEST_DEF("TestBytesToHexErrors", TestBytesToHexErrors), //
NL_TEST_DEF("TestBytesToHexUint64", TestBytesToHexUint64), //
NL_TEST_DEF("TestHexToBytesAndUint", TestHexToBytesAndUint), //
#ifdef CHIP_PROGRESS_LOGGING
#if CHIP_PROGRESS_LOGGING
NL_TEST_DEF("TestLogBufferAsHex", TestLogBufferAsHex), //
#endif
NL_TEST_SENTINEL() //
Expand Down
13 changes: 5 additions & 8 deletions src/transport/raw/tests/NetworkTestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,13 @@ class LoopbackTransport : public Transport::Base
{
mDelegate->OnMessageDropped();
}
}
else
{
System::PacketBufferHandle receivedMessage = msgBuf.CloneData();
mPendingMessageQueue.push(PendingMessageItem(address, std::move(receivedMessage)));
mSystemLayer->ScheduleWork(OnMessageReceived, this);

return CHIP_NO_ERROR;
}

return CHIP_NO_ERROR;
System::PacketBufferHandle receivedMessage = msgBuf.CloneData();
mPendingMessageQueue.push(PendingMessageItem(address, std::move(receivedMessage)));
return mSystemLayer->ScheduleWork(OnMessageReceived, this);
}

bool CanSendToPeer(const Transport::PeerAddress & address) override { return true; }
Expand All @@ -158,7 +156,6 @@ class LoopbackTransport : public Transport::Base

System::Layer * mSystemLayer = nullptr;
std::queue<PendingMessageItem> mPendingMessageQueue;
Transport::PeerAddress mTxAddress;
uint32_t mNumMessagesToDrop = 0;
uint32_t mDroppedMessageCount = 0;
uint32_t mSentMessageCount = 0;
Expand Down