-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
132 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#include "LaneMapContainer.h" | ||
|
||
#include <gtest/gtest.h> | ||
|
||
using namespace saivs; | ||
|
||
TEST(LaneMapContainer, insert) | ||
{ | ||
auto map = std::make_shared<LaneMap>(0); | ||
|
||
std::vector<uint32_t> ok{1}; | ||
|
||
EXPECT_EQ(map->add("foo", ok), true); | ||
|
||
LaneMapContainer lmc; | ||
|
||
EXPECT_EQ(lmc.insert(map), true); | ||
|
||
EXPECT_EQ(lmc.size(), 1); | ||
|
||
EXPECT_EQ(lmc.insert(map), false); | ||
} | ||
|
||
TEST(LaneMapContainer, remove) | ||
{ | ||
auto map = std::make_shared<LaneMap>(0); | ||
|
||
std::vector<uint32_t> ok{1}; | ||
|
||
EXPECT_EQ(map->add("foo", ok), true); | ||
|
||
LaneMapContainer lmc; | ||
|
||
lmc.insert(map); | ||
|
||
EXPECT_EQ(lmc.size(), 1); | ||
|
||
EXPECT_TRUE(lmc.remove(0)); | ||
|
||
EXPECT_EQ(lmc.size(), 0); | ||
|
||
EXPECT_FALSE(lmc.remove(0)); | ||
} | ||
|
||
TEST(LaneMapContainer, getLaneMap) | ||
{ | ||
auto map = std::make_shared<LaneMap>(0); | ||
|
||
std::vector<uint32_t> ok{1}; | ||
|
||
EXPECT_EQ(map->add("foo", ok), true); | ||
|
||
LaneMapContainer lmc; | ||
|
||
EXPECT_EQ(lmc.insert(map), true); | ||
|
||
EXPECT_NE(lmc.getLaneMap(0), nullptr); | ||
|
||
EXPECT_EQ(lmc.getLaneMap(1), nullptr); | ||
} | ||
|
||
TEST(LaneMapContainer, clear) | ||
{ | ||
auto map = std::make_shared<LaneMap>(0); | ||
|
||
std::vector<uint32_t> ok{1}; | ||
|
||
EXPECT_EQ(map->add("foo", ok), true); | ||
|
||
LaneMapContainer lmc; | ||
|
||
EXPECT_EQ(lmc.insert(map), true); | ||
|
||
EXPECT_EQ(lmc.size(), 1); | ||
|
||
lmc.clear(); | ||
|
||
EXPECT_EQ(lmc.size(), 0); | ||
} | ||
|
||
TEST(LaneMapContainer, hasLaneMap) | ||
{ | ||
LaneMapContainer lmc; | ||
|
||
EXPECT_FALSE(lmc.hasLaneMap(0)); | ||
} | ||
|
||
TEST(LaneMapContainer, removeEmptyLaneMaps) | ||
{ | ||
LaneMapContainer lmc; | ||
|
||
EXPECT_FALSE(lmc.hasLaneMap(0)); | ||
|
||
auto map1 = std::make_shared<LaneMap>(0); | ||
auto map2 = std::make_shared<LaneMap>(1); | ||
|
||
std::vector<uint32_t> ok{1}; | ||
|
||
EXPECT_EQ(map1->add("foo", ok), true); | ||
|
||
EXPECT_TRUE(lmc.insert(map1)); | ||
|
||
EXPECT_TRUE(lmc.insert(map2)); | ||
|
||
EXPECT_EQ(lmc.size(), 2); | ||
|
||
lmc.removeEmptyLaneMaps(); | ||
|
||
EXPECT_EQ(lmc.size(), 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters