File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #include " SwitchConfigContainer.h"
2+
3+ #include < gtest/gtest.h>
4+
5+ #include < memory>
6+
7+ using namespace sairedis ;
8+
9+ TEST (SwitchConfigContainer, insert)
10+ {
11+ auto sc = std::make_shared<SwitchConfig>(0 , " " );
12+ auto sc1 = std::make_shared<SwitchConfig>(1 , " " );
13+
14+ auto scc = std::make_shared<SwitchConfigContainer>();
15+
16+ scc->insert (sc);
17+
18+ EXPECT_THROW (scc->insert (sc), std::runtime_error);
19+ EXPECT_THROW (scc->insert (sc1), std::runtime_error);
20+ }
21+
22+ TEST (SwitchConfigContainer, getConfig)
23+ {
24+ auto sc0 = std::make_shared<SwitchConfig>(0 , " 0" );
25+ auto sc1 = std::make_shared<SwitchConfig>(1 , " 1" );
26+
27+ auto scc = std::make_shared<SwitchConfigContainer>();
28+
29+ scc->insert (sc0);
30+ scc->insert (sc1);
31+
32+ EXPECT_EQ (scc->getConfig (7 ), nullptr );
33+
34+ EXPECT_NE (scc->getConfig (1 ), nullptr );
35+ EXPECT_NE (scc->getConfig (0 ), nullptr );
36+ }
You can’t perform that action at this time.
0 commit comments