forked from valhalla/valhalla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreetnames_factory.cc
41 lines (31 loc) · 1.22 KB
/
streetnames_factory.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
40
41
#include "baldr/streetnames_factory.h"
#include "baldr/streetnames.h"
#include "baldr/streetnames_us.h"
#include <memory>
#include <vector>
#include "test.h"
using namespace valhalla::baldr;
namespace {
void TryCreate(const std::string& country_code,
const std::vector<std::pair<std::string, bool>>& names,
const std::string& expected) {
std::unique_ptr<StreetNames> street_names = StreetNamesFactory::Create(country_code, names);
auto& value = *street_names.get();
std::string rtti(typeid(value).name());
EXPECT_EQ(rtti, expected) << "Incorrect object type";
}
TEST(StreetnamesFactory, Create) {
// US - should be StreetNamesUs
TryCreate("US", {{"Main Street", false}}, "N8valhalla5baldr13StreetNamesUsE");
TryCreate("US", {{"Hershey Road", false}, {"PA 743 North", true}},
"N8valhalla5baldr13StreetNamesUsE");
// DE - should be default StreetNames
TryCreate("DE", {{"Mittelstraße", false}}, "N8valhalla5baldr11StreetNamesE");
TryCreate("DE", {{"Unter den Linden", false}, {"B 2", true}, {"B 5", true}},
"N8valhalla5baldr11StreetNamesE");
}
} // namespace
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}