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 {
27 namespace {
28 
29 TEST(ConfigurationFilesTest, ValidateMapBuilderOptions) {
30  const std::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<std::string>{
38  std::string(::cartographer::common::kSourceDirectory) +
39  "/configuration_files"});
40  ::cartographer::common::LuaParameterDictionary lua_parameter_dictionary(
41  kCode, std::move(file_resolver));
42  ::cartographer::mapping::CreateMapBuilderOptions(&lua_parameter_dictionary);
43  });
44 }
45 
46 TEST(ConfigurationFilesTest, ValidateTrajectoryBuilderOptions) {
47  const std::string kCode = R"text(
48  include "trajectory_builder.lua"
49  TRAJECTORY_BUILDER.trajectory_builder_2d.use_imu_data = false
50  return TRAJECTORY_BUILDER)text";
51  EXPECT_NO_FATAL_FAILURE({
52  auto file_resolver = ::cartographer::common::make_unique<
54  std::vector<std::string>{
55  std::string(::cartographer::common::kSourceDirectory) +
56  "/configuration_files"});
57  ::cartographer::common::LuaParameterDictionary lua_parameter_dictionary(
58  kCode, std::move(file_resolver));
60  &lua_parameter_dictionary);
61  });
62 }
63 
64 } // namespace
65 } // namespace cartographer
_Unique_if< T >::_Single_object make_unique(Args &&... args)
Definition: make_unique.h:46
proto::MapBuilderOptions CreateMapBuilderOptions(common::LuaParameterDictionary *const parameter_dictionary)
Definition: map_builder.cc:57
proto::TrajectoryBuilderOptions CreateTrajectoryBuilderOptions(common::LuaParameterDictionary *const parameter_dictionary)
TEST(TrajectoryConnectivityStateTest, UnknownTrajectory)


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58