test_helpers.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 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 #ifndef CARTOGRAPHER_IO_TESTING_TEST_HELPERS_H_
00018 #define CARTOGRAPHER_IO_TESTING_TEST_HELPERS_H_
00019 
00020 #include <memory>
00021 
00022 #include "cartographer/io/internal/in_memory_proto_stream.h"
00023 #include "glog/logging.h"
00024 #include "google/protobuf/text_format.h"
00025 
00026 namespace cartographer {
00027 namespace io {
00028 namespace testing {
00029 
00030 template <typename T>
00031 T ProtoFromStringOrDie(const std::string &proto_string) {
00032   T msg;
00033   CHECK(google::protobuf::TextFormat::ParseFromString(proto_string, &msg));
00034   return msg;
00035 }
00036 
00037 std::unique_ptr<InMemoryProtoStreamReader> ProtoReaderFromStrings(
00038     const std::string &header_textpb,
00039     const std::initializer_list<std::string> &data_textpbs);
00040 
00041 }  // namespace testing
00042 }  // namespace io
00043 }  // namespace cartographer
00044 
00045 #endif  // CARTOGRAPHER_IO_TESTING_TEST_HELPERS_H_


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