Skip to content

Commit

Permalink
Add EventPayloadNetLinkMsg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent 8bf97ed commit 85042f4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unittest/vslib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ tests_SOURCES = main.cpp \
TestContextConfigContainer.cpp \
TestCorePortIndexMap.cpp \
TestCorePortIndexMapContainer.cpp \
TestCorePortIndexMapFileParser.cpp
TestCorePortIndexMapFileParser.cpp \
TestEventPayloadNetLinkMsg.cpp

tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/vslib/libSaiVS.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
Expand Down
47 changes: 47 additions & 0 deletions unittest/vslib/TestEventPayloadNetLinkMsg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "EventPayloadNetLinkMsg.h"

#include <linux/if.h>

#include <gtest/gtest.h>

using namespace saivs;

TEST(EventPayloadNetLinkMsg, ctr)
{
EventPayloadNetLinkMsg ep(0, 1, 2, IFF_UP, "foo");
}

TEST(EventPayloadNetLinkMsg, getSwitchId)
{
EventPayloadNetLinkMsg ep(0, 1, 2, IFF_UP, "foo");

EXPECT_EQ(ep.getSwitchId(), 0);
}

TEST(EventPayloadNetLinkMsg, getNlmsgType)
{
EventPayloadNetLinkMsg ep(0, 1, 2, IFF_UP, "foo");

EXPECT_EQ(ep.getNlmsgType(), 1);
}

TEST(EventPayloadNetLinkMsg, getIfIndex)
{
EventPayloadNetLinkMsg ep(0, 1, 2, IFF_UP, "foo");

EXPECT_EQ(ep.getIfIndex(), 2);
}

TEST(EventPayloadNetLinkMsg, getIfFlags)
{
EventPayloadNetLinkMsg ep(0, 1, 2, IFF_UP, "foo");

EXPECT_EQ(ep.getIfFlags(), IFF_UP);
}

TEST(EventPayloadNetLinkMsg, getIfName)
{
EventPayloadNetLinkMsg ep(0, 1, 2, IFF_UP, "foo");

EXPECT_EQ(ep. getIfName(), "foo");
}

0 comments on commit 85042f4

Please sign in to comment.