Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "cartographer/mapping/2d/map_limits.h"
00018
00019 #include "gtest/gtest.h"
00020
00021 namespace cartographer {
00022 namespace mapping {
00023 namespace {
00024
00025 TEST(MapLimitsTest, ToProto) {
00026 const MapLimits limits(42., Eigen::Vector2d(3., 0.), CellLimits(2, 3));
00027 const auto proto = ToProto(limits);
00028 EXPECT_EQ(limits.resolution(), proto.resolution());
00029 EXPECT_EQ(limits.max().x(), proto.max().x());
00030 EXPECT_EQ(limits.max().y(), proto.max().y());
00031 EXPECT_EQ(ToProto(limits.cell_limits()).DebugString(),
00032 proto.cell_limits().DebugString());
00033 }
00034
00035 TEST(MapLimitsTest, ProtoConstructor) {
00036 proto::MapLimits limits;
00037 limits.set_resolution(1.);
00038 limits.mutable_max()->set_x(2.);
00039 limits.mutable_max()->set_y(3.);
00040 limits.mutable_cell_limits()->set_num_x_cells(4);
00041 limits.mutable_cell_limits()->set_num_y_cells(5);
00042
00043 const MapLimits native(limits);
00044 EXPECT_EQ(limits.resolution(), native.resolution());
00045 EXPECT_EQ(limits.max().x(), native.max().x());
00046 EXPECT_EQ(limits.max().y(), native.max().y());
00047 EXPECT_EQ(limits.cell_limits().DebugString(),
00048 ToProto(native.cell_limits()).DebugString());
00049 }
00050
00051 TEST(MapLimitsTest, ConstructAndGet) {
00052 const MapLimits limits(42., Eigen::Vector2d(3., 0.), CellLimits(2, 3));
00053
00054 const CellLimits& cell_limits = limits.cell_limits();
00055 EXPECT_EQ(2, cell_limits.num_x_cells);
00056 EXPECT_EQ(3, cell_limits.num_y_cells);
00057
00058 const Eigen::Vector2d& max = limits.max();
00059 EXPECT_EQ(3., max.x());
00060 EXPECT_EQ(0., max.y());
00061
00062 EXPECT_EQ(42., limits.resolution());
00063 }
00064
00065 }
00066 }
00067 }