16 #include <gtest/gtest.h> 25 using namespace Eigen;
30 Eigen::Array2i submapTopLeftIndex(3, 1);
31 Eigen::Array2i submapBufferSize(3, 2);
33 Eigen::Array2i submapIndex;
36 types.push_back(
"type");
38 map.
setGeometry(Array2d(8.1, 5.1), 1.0, Vector2d(0.0, 0.0));
40 SubmapIterator iterator(map, submapTopLeftIndex, submapBufferSize);
43 EXPECT_EQ(submapTopLeftIndex(0), (*iterator)(0));
44 EXPECT_EQ(submapTopLeftIndex(1), (*iterator)(1));
50 EXPECT_EQ(3, (*iterator)(0));
51 EXPECT_EQ(2, (*iterator)(1));
57 EXPECT_EQ(4, (*iterator)(0));
58 EXPECT_EQ(1, (*iterator)(1));
64 EXPECT_EQ(4, (*iterator)(0));
65 EXPECT_EQ(2, (*iterator)(1));
71 EXPECT_EQ(5, (*iterator)(0));
72 EXPECT_EQ(1, (*iterator)(1));
78 EXPECT_EQ(5, (*iterator)(0));
79 EXPECT_EQ(2, (*iterator)(1));
85 EXPECT_EQ(5, (*iterator)(0));
86 EXPECT_EQ(2, (*iterator)(1));
93 Eigen::Array2i submapTopLeftIndex(6, 3);
94 Eigen::Array2i submapBufferSize(2, 4);
96 Eigen::Array2i submapIndex;
99 types.push_back(
"type");
104 SubmapIterator iterator(map, submapTopLeftIndex, submapBufferSize);
107 EXPECT_EQ(submapTopLeftIndex(0), (*iterator)(0));
108 EXPECT_EQ(submapTopLeftIndex(1), (*iterator)(1));
114 EXPECT_EQ(6, (*iterator)(0));
115 EXPECT_EQ(4, (*iterator)(1));
121 EXPECT_EQ(6, (*iterator)(0));
122 EXPECT_EQ(0, (*iterator)(1));
128 EXPECT_EQ(6, (*iterator)(0));
129 EXPECT_EQ(1, (*iterator)(1));
135 EXPECT_EQ(7, (*iterator)(0));
136 EXPECT_EQ(3, (*iterator)(1));
142 EXPECT_EQ(7, (*iterator)(0));
143 EXPECT_EQ(4, (*iterator)(1));
149 EXPECT_EQ(7, (*iterator)(0));
150 EXPECT_EQ(0, (*iterator)(1));
156 EXPECT_EQ(7, (*iterator)(0));
157 EXPECT_EQ(1, (*iterator)(1));
163 EXPECT_EQ(7, (*iterator)(0));
164 EXPECT_EQ(1, (*iterator)(1));
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
TEST(SubmapIterator, Simple)
bool move(const Position &position, std::vector< BufferRegion > &newRegions)
const Index & getSubmapIndex() const