forked from valhalla/valhalla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaneconnectivity.cc
39 lines (29 loc) · 1.09 KB
/
laneconnectivity.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "baldr/laneconnectivity.h"
#include <string>
#include "test.h"
using namespace std;
using namespace valhalla::baldr;
namespace {
void TryTestLaneConnectivity(const std::string& lanes) {
EXPECT_EQ(LaneConnectivityLanes(lanes).to_string(), lanes);
}
TEST(LaneConnectivity, TestLaneConnectivity) {
TryTestLaneConnectivity("1");
TryTestLaneConnectivity("1|1");
TryTestLaneConnectivity("1|2");
TryTestLaneConnectivity("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15");
EXPECT_THROW(LaneConnectivityLanes("1|16").to_string(), std::out_of_range);
EXPECT_THROW(LaneConnectivityLanes("1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1").to_string(),
std::out_of_range);
EXPECT_THROW(LaneConnectivityLanes("|1|").to_string(), std::invalid_argument);
EXPECT_THROW(LaneConnectivityLanes("|").to_string(), std::invalid_argument);
EXPECT_THROW(LaneConnectivityLanes("||").to_string(), std::invalid_argument);
}
TEST(LaneConnectivity, SizeOf) {
EXPECT_EQ(sizeof(LaneConnectivity), 24);
}
} // namespace
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}