forked from valhalla/valhalla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
factory.cc
36 lines (29 loc) · 891 Bytes
/
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
#include "proto/options.pb.h"
#include "sif/autocost.h"
#include "sif/bicyclecost.h"
#include "sif/costfactory.h"
#include "sif/pedestriancost.h"
#include "test.h"
using namespace std;
using namespace valhalla;
using namespace valhalla::sif;
namespace {
TEST(Factory, Register) {
Options options;
const rapidjson::Document doc;
sif::ParseCosting(doc, "/costing_options", options);
CostFactory factory;
options.set_costing_type(Costing::auto_);
auto car = factory.Create(options);
options.set_costing_type(Costing::bicycle);
auto bike = factory.Create(options);
options.set_costing_type(Costing::multimodal);
EXPECT_THROW(factory.Create(options), std::runtime_error);
auto truck = factory.Create(Costing::truck);
}
// TODO: add many more tests!
} // namespace
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}