configuration_files_test.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 #include "cartographer/common/config.h"
00021 #include "cartographer/common/configuration_file_resolver.h"
00022 #include "cartographer/common/lua_parameter_dictionary.h"
00023 #include "cartographer/mapping/map_builder.h"
00024 #include "gtest/gtest.h"
00025 
00026 namespace cartographer {
00027 namespace {
00028 
00029 TEST(ConfigurationFilesTest, ValidateMapBuilderOptions) {
00030   const std::string kCode = R"text(
00031       include "map_builder.lua"
00032       MAP_BUILDER.use_trajectory_builder_2d = true
00033       return MAP_BUILDER)text";
00034   EXPECT_NO_FATAL_FAILURE({
00035     auto file_resolver =
00036         ::absl::make_unique< ::cartographer::common::ConfigurationFileResolver>(
00037             std::vector<std::string>{
00038                 std::string(::cartographer::common::kSourceDirectory) +
00039                 "/configuration_files"});
00040     ::cartographer::common::LuaParameterDictionary lua_parameter_dictionary(
00041         kCode, std::move(file_resolver));
00042     ::cartographer::mapping::CreateMapBuilderOptions(&lua_parameter_dictionary);
00043   });
00044 }
00045 
00046 TEST(ConfigurationFilesTest, ValidateTrajectoryBuilderOptions) {
00047   const std::string kCode = R"text(
00048       include "trajectory_builder.lua"
00049       TRAJECTORY_BUILDER.trajectory_builder_2d.use_imu_data = false
00050       return TRAJECTORY_BUILDER)text";
00051   EXPECT_NO_FATAL_FAILURE({
00052     auto file_resolver =
00053         ::absl::make_unique< ::cartographer::common::ConfigurationFileResolver>(
00054             std::vector<std::string>{
00055                 std::string(::cartographer::common::kSourceDirectory) +
00056                 "/configuration_files"});
00057     ::cartographer::common::LuaParameterDictionary lua_parameter_dictionary(
00058         kCode, std::move(file_resolver));
00059     ::cartographer::mapping::CreateTrajectoryBuilderOptions(
00060         &lua_parameter_dictionary);
00061   });
00062 }
00063 
00064 }  // namespace
00065 }  // namespace cartographer


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35