configuration_files_test.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <string>
18 #include <vector>
19 
20 #include "cartographer/common/config.h"
24 #include "gtest/gtest.h"
25 
26 namespace cartographer_ros {
27 namespace {
28 
29 TEST(ConfigurationFilesTest, ValidateMapBuilderOptions) {
30  const string kCode = R"text(
31  include "map_builder.lua"
32  MAP_BUILDER.use_trajectory_builder_2d = true
33  return MAP_BUILDER)text";
34  EXPECT_NO_FATAL_FAILURE({
35  auto file_resolver = ::cartographer::common::make_unique<
37  std::vector<string>{string(::cartographer::common::kSourceDirectory) +
38  "/configuration_files"});
39  ::cartographer::common::LuaParameterDictionary lua_parameter_dictionary(
40  kCode, std::move(file_resolver));
41  ::cartographer::mapping::CreateMapBuilderOptions(&lua_parameter_dictionary);
42  });
43 }
44 
45 TEST(ConfigurationFilesTest, ValidateTrajectoryBuilderOptions) {
46  const string kCode = R"text(
47  include "trajectory_builder.lua"
48  TRAJECTORY_BUILDER.trajectory_builder_2d.use_imu_data = false
49  return TRAJECTORY_BUILDER)text";
50  EXPECT_NO_FATAL_FAILURE({
51  auto file_resolver = ::cartographer::common::make_unique<
53  std::vector<string>{string(::cartographer::common::kSourceDirectory) +
54  "/configuration_files"});
55  ::cartographer::common::LuaParameterDictionary lua_parameter_dictionary(
56  kCode, std::move(file_resolver));
58  &lua_parameter_dictionary);
59  });
60 }
61 
62 } // namespace
63 } // namespace cartographer_ros
proto::MapBuilderOptions CreateMapBuilderOptions(common::LuaParameterDictionary *const parameter_dictionary)
Definition: map_builder.cc:38
proto::TrajectoryBuilderOptions CreateTrajectoryBuilderOptions(common::LuaParameterDictionary *const parameter_dictionary)
_Unique_if< T >::_Single_object make_unique(Args &&...args)
Definition: make_unique.h:46


cartographer
Author(s):
autogenerated on Mon Jun 10 2019 12:51:38