Skip to content

Commit

Permalink
[tests] fix verification in test_routing_manager.cpp (openthread#9548)
Browse files Browse the repository at this point in the history
Some equation checks accidentally became non-zero checks due to
typo. Such tests may fail in certain build configurations when the
heap allocation is zero after initialization of the test.
  • Loading branch information
superwhd authored Oct 19, 2023
1 parent 1b59c97 commit 6ff2778
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/unit/test_routing_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ void TestOmrSelection(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestOmrSelection");
FinalizeTest();
Expand Down Expand Up @@ -1474,7 +1474,7 @@ void TestDefaultRoute(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestDefaultRoute");

Expand Down Expand Up @@ -1640,7 +1640,7 @@ void TestAdvNonUlaRoute(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestAdvNonUlaRoute");

Expand Down Expand Up @@ -1779,7 +1779,7 @@ void TestLocalOnLinkPrefixDeprecation(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestLocalOnLinkPrefixDeprecation");

Expand Down Expand Up @@ -1931,7 +1931,7 @@ void TestDomainPrefixAsOmr(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestDomainPrefixAsOmr");
FinalizeTest();
Expand Down Expand Up @@ -2440,7 +2440,7 @@ void TestExtPanIdChange(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestExtPanIdChange");
FinalizeTest();
Expand Down Expand Up @@ -2593,7 +2593,7 @@ void TestRouterNsProbe(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestRouterNsProbe");
FinalizeTest();
Expand Down Expand Up @@ -2812,7 +2812,7 @@ void TestConflictingPrefix(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
VerifyOrQuit(heapAllocations = sHeapAllocatedPtrs.GetLength());
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());

Log("End of TestConflictingPrefix");

Expand Down

0 comments on commit 6ff2778

Please sign in to comment.