mirror of
https://github.com/espressif/openthread.git
synced 2026-09-16 06:00:13 +00:00
[test] enhance {Verify/Success}OrQuit() and their use in unit test (#6764)
This commit updates `VerifyOrQuit()` and `SuccessOrQuit()` macros to include the failed condition in the error message that is printed on a failure (in addition to function name and line number where the error happened). This commit also changes the second parameter (`aMessage`) to in these macros to be optional. This commit also updates unit tests to remove the second `aMessage` string in cases where the failure can be inferred from the condition itself.
This commit is contained in:
@@ -70,12 +70,12 @@ void VerifyEntry(EntryPool &aPool, const Entry &aEntry, bool aInitWithInstance)
|
||||
uint16_t index;
|
||||
const EntryPool &constPool = const_cast<const EntryPool &>(aPool);
|
||||
|
||||
VerifyOrQuit(aPool.IsPoolEntry(aEntry), "Pool::IsPoolEntry() failed");
|
||||
VerifyOrQuit(aPool.IsPoolEntry(aEntry));
|
||||
VerifyOrQuit(!aPool.IsPoolEntry(sNonPoolEntry), "Pool::IsPoolEntry() succeeded for non-pool entry");
|
||||
|
||||
index = aPool.GetIndexOf(aEntry);
|
||||
VerifyOrQuit(&aPool.GetEntryAt(index) == &aEntry, "Pool::GetEntryAt() failed");
|
||||
VerifyOrQuit(&constPool.GetEntryAt(index) == &aEntry, "Pool::GetEntryAt() failed");
|
||||
VerifyOrQuit(&aPool.GetEntryAt(index) == &aEntry);
|
||||
VerifyOrQuit(&constPool.GetEntryAt(index) == &aEntry);
|
||||
|
||||
VerifyOrQuit(aEntry.IsInitializedWithInstance() == aInitWithInstance, "Pool did not correctly Init() entry");
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void TestPool(EntryPool &aPool, bool aInitWithInstance)
|
||||
{
|
||||
Entry *entries[kPoolSize];
|
||||
|
||||
VerifyOrQuit(aPool.GetSize() == kPoolSize, "Pool::GetSize() failed");
|
||||
VerifyOrQuit(aPool.GetSize() == kPoolSize);
|
||||
|
||||
for (Entry *&entry : entries)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user