mirror of
https://github.com/espressif/openthread.git
synced 2026-09-10 11:10:08 +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:
@@ -62,7 +62,7 @@ void VerifyMulticastAddressList(const Ip6::Netif &aNetif, Ip6::Address aAddresse
|
||||
|
||||
for (uint8_t i = 0; i < aLength; i++)
|
||||
{
|
||||
VerifyOrQuit(aNetif.IsMulticastSubscribed(aAddresses[i]), "IsMulticastSubscribed() failed");
|
||||
VerifyOrQuit(aNetif.IsMulticastSubscribed(aAddresses[i]));
|
||||
}
|
||||
|
||||
for (const Ip6::NetifMulticastAddress *addr = aNetif.GetMulticastAddresses(); addr; addr = addr->GetNext())
|
||||
@@ -148,7 +148,7 @@ void TestNetifMulticastAddresses(void)
|
||||
VerifyMulticastAddressList(netif, &addresses[5], 1);
|
||||
|
||||
IgnoreError(address.FromString(kTestAddress2));
|
||||
SuccessOrQuit(netif.SubscribeExternalMulticast(address), "SubscribeExternalMulticast() failed");
|
||||
SuccessOrQuit(netif.SubscribeExternalMulticast(address));
|
||||
VerifyMulticastAddressList(netif, &addresses[5], 2);
|
||||
|
||||
netif.SubscribeAllNodesMulticast();
|
||||
@@ -164,7 +164,7 @@ void TestNetifMulticastAddresses(void)
|
||||
VerifyMulticastAddressList(netif, &addresses[0], 7);
|
||||
|
||||
IgnoreError(address.FromString(kTestAddress3));
|
||||
SuccessOrQuit(netif.SubscribeExternalMulticast(address), "SubscribeExternalMulticast() failed");
|
||||
SuccessOrQuit(netif.SubscribeExternalMulticast(address));
|
||||
VerifyMulticastAddressList(netif, &addresses[0], 8);
|
||||
|
||||
IgnoreError(address.FromString(kTestAddress1)); // same as netifAddress (internal)
|
||||
|
||||
Reference in New Issue
Block a user