14 #include <gtest/gtest.h> 25 map[
"layer"].setRandom();
28 EXPECT_EQ(iterator.
getData().rows(), 2);
29 EXPECT_EQ(iterator.
getData().cols(), 2);
30 EXPECT_TRUE(iterator.
getData().isApprox(map[
"layer"].block(0, 0, 2, 2)));
33 EXPECT_EQ(iterator.getData().rows(), 3);
34 EXPECT_EQ(iterator.getData().cols(), 2);
35 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(0, 0, 3, 2)));
38 EXPECT_EQ(iterator.getData().rows(), 3);
39 EXPECT_EQ(iterator.getData().cols(), 2);
40 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(1, 0, 3, 2)));
42 for (; !iterator.isPastEnd(); ++iterator) {
43 EXPECT_FALSE(iterator.isPastEnd());
44 if ((*iterator ==
Index(3, 2)).all())
break;
47 EXPECT_EQ(iterator.getData().rows(), 3);
48 EXPECT_EQ(iterator.getData().cols(), 3);
49 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(2, 1, 3, 3)));
51 for (; !iterator.isPastEnd(); ++iterator) {
52 EXPECT_FALSE(iterator.isPastEnd());
53 if ((*iterator ==
Index(7, 4)).all())
break;
56 EXPECT_EQ(iterator.getData().rows(), 2);
57 EXPECT_EQ(iterator.getData().cols(), 2);
58 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(6, 3, 2, 2)));
61 EXPECT_TRUE(iterator.isPastEnd());
69 map[
"layer"].setRandom();
72 EXPECT_EQ(iterator.
getData().rows(), 3);
73 EXPECT_EQ(iterator.
getData().cols(), 3);
74 EXPECT_TRUE(iterator.
getData().isApprox(map[
"layer"].block(0, 0, 3, 3)));
77 EXPECT_EQ(iterator.getData().rows(), 4);
78 EXPECT_EQ(iterator.getData().cols(), 3);
79 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(0, 0, 4, 3)));
82 EXPECT_EQ(iterator.getData().rows(), 5);
83 EXPECT_EQ(iterator.getData().cols(), 3);
84 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(0, 0, 5, 3)));
86 for (; !iterator.isPastEnd(); ++iterator) {
87 EXPECT_FALSE(iterator.isPastEnd());
88 if ((*iterator ==
Index(3, 2)).all())
break;
91 EXPECT_EQ(iterator.getData().rows(), 5);
92 EXPECT_EQ(iterator.getData().cols(), 5);
93 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(1, 0, 5, 5)));
95 for (; !iterator.isPastEnd(); ++iterator) {
96 EXPECT_FALSE(iterator.isPastEnd());
97 if ((*iterator ==
Index(7, 4)).all())
break;
100 EXPECT_EQ(iterator.getData().rows(), 3);
101 EXPECT_EQ(iterator.getData().cols(), 3);
102 EXPECT_TRUE(iterator.getData().isApprox(map[
"layer"].block(5, 2, 3, 3)));
105 EXPECT_TRUE(iterator.isPastEnd());
113 map[
"layer"].setRandom();
116 EXPECT_EQ(iterator.
getData().rows(), 3);
117 EXPECT_EQ(iterator.
getData().cols(), 3);
118 EXPECT_TRUE(iterator.
getData().isApprox(map[
"layer"].block(0, 0, 3, 3)));
120 for (; !iterator.
isPastEnd(); ++iterator) {
122 if ((*iterator ==
Index(3, 2)).all())
break;
125 EXPECT_EQ(iterator.
getData().rows(), 3);
126 EXPECT_EQ(iterator.
getData().cols(), 3);
127 EXPECT_TRUE(iterator.
getData().isApprox(map[
"layer"].block(2, 1, 3, 3)));
129 for (; !iterator.
isPastEnd(); ++iterator) {
131 if ((*iterator ==
Index(6, 3)).all())
break;
134 EXPECT_EQ(iterator.
getData().rows(), 3);
135 EXPECT_EQ(iterator.
getData().cols(), 3);
136 EXPECT_TRUE(iterator.
getData().isApprox(map[
"layer"].block(5, 2, 3, 3)));
139 EXPECT_TRUE(iterator.isPastEnd());
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
TEST(SlidingWindowIterator, WindowSize3Cutoff)
const Matrix getData() const
void add(const std::string &layer, const double value=NAN)