unittest/vslib/TestSwitchNvdaMBF2H536C.cpp (32 lines of code) (raw):

#include "SwitchNvdaMBF2H536C.h" #include "meta/sai_serialize.h" #include <gtest/gtest.h> #include <memory> using namespace saivs; TEST(SwitchNvdaMBF2H536C, ctr) { auto sc = std::make_shared<SwitchConfig>(0, ""); auto signal = std::make_shared<Signal>(); auto eventQueue = std::make_shared<EventQueue>(signal); // TODO: Should the switch type be changed when new API is available? sc->m_saiSwitchType = SAI_SWITCH_TYPE_NPU; sc->m_switchType = SAI_VS_SWITCH_TYPE_NVDA_MBF2H536C; sc->m_bootType = SAI_VS_BOOT_TYPE_COLD; sc->m_useTapDevice = false; sc->m_laneMap = LaneMap::getDefaultLaneMap(0); sc->m_eventQueue = eventQueue; auto scc = std::make_shared<SwitchConfigContainer>(); scc->insert(sc); SwitchNvdaMBF2H536C sw( 0x2100000000, std::make_shared<RealObjectIdManager>(0, scc), sc); SwitchNvdaMBF2H536C sw2( 0x2100000000, std::make_shared<RealObjectIdManager>(0, scc), sc, nullptr); sai_attribute_t attr; attr.id = SAI_SWITCH_ATTR_INIT_SWITCH; attr.value.booldata = true; EXPECT_EQ(sw.initialize_default_objects(1, &attr), SAI_STATUS_SUCCESS); }