From bd885eefaac5bdef0a721f6efc6a31f8cbb986e8 Mon Sep 17 00:00:00 2001 From: zjswhhh Date: Mon, 24 Jan 2022 09:42:51 +0000 Subject: [PATCH] add unit test --- test/LinkManagerStateMachineTest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/LinkManagerStateMachineTest.cpp b/test/LinkManagerStateMachineTest.cpp index dcd416ae..2e691b4d 100644 --- a/test/LinkManagerStateMachineTest.cpp +++ b/test/LinkManagerStateMachineTest.cpp @@ -1053,4 +1053,17 @@ TEST_F(LinkManagerStateMachineTest, MuxStandbyDefaultRouteStateOK) VALIDATE_STATE(Standby, Standby, Up); } +TEST_F(LinkManagerStateMachineTest, PostPckLossMetricsEvent) +{ + setMuxStandby(); + + EXPECT_EQ(mDbInterfacePtr->mPostLinkProberMetricsInvokeCount, 0); + postLinkProberEvent(link_prober::LinkProberState::Unknown); + + EXPECT_EQ(mDbInterfacePtr->mPostLinkProberMetricsInvokeCount, 1); + postLinkProberEvent(link_prober::LinkProberState::Active); + + EXPECT_EQ(mDbInterfacePtr->mPostLinkProberMetricsInvokeCount, 2); +} + } /* namespace test */