1 #include <gtest/gtest.h> 5 #include "../../../src/utils/data_generation/map_primitives.h" 14 auto str = std::string{};
16 std::istream& txt_stream = cecum_mp.
to_stream();
17 auto buf = std::string{};
18 while (txt_stream.good()) {
19 std::getline(txt_stream, buf);
26 std::string result = pattern;
27 std::replace(result.begin(), result.end(),
29 std::replace(result.begin(), result.end(),
41 const std::string Map_Pattern =
"1";
43 ASSERT_EQ(1, cecum_mp.width());
44 ASSERT_EQ(1, cecum_mp.height());
45 ASSERT_EQ(1, cecum_mp.free_space().size());
46 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
52 const std::string Map_Pattern =
"1" 55 ASSERT_EQ(1, cecum_mp.width());
56 ASSERT_EQ(2, cecum_mp.height());
57 ASSERT_EQ(1, cecum_mp.free_space().size());
58 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
64 const std::string Map_Pattern =
"111";
66 ASSERT_EQ(3, cecum_mp.width());
67 ASSERT_EQ(1, cecum_mp.height());
68 ASSERT_EQ(1, cecum_mp.free_space().size());
69 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
75 const std::string Map_Pattern =
"111";
77 ASSERT_EQ(3, cecum_mp.width());
78 ASSERT_EQ(1, cecum_mp.height());
79 ASSERT_EQ(1, cecum_mp.free_space().size());
80 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
86 const std::string Map_Pattern =
"1";
88 ASSERT_EQ(1, cecum_mp.width());
89 ASSERT_EQ(1, cecum_mp.height());
90 ASSERT_EQ(1, cecum_mp.free_space().size());
91 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
97 const std::string Map_Pattern =
"1" 101 ASSERT_EQ(1, cecum_mp.width());
102 ASSERT_EQ(3, cecum_mp.height());
103 ASSERT_EQ(1, cecum_mp.free_space().size());
104 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
110 const std::string Map_Pattern =
"1" 114 ASSERT_EQ(1, cecum_mp.width());
115 ASSERT_EQ(3, cecum_mp.height());
116 ASSERT_EQ(1, cecum_mp.free_space().size());
117 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
123 const std::string Map_Pattern =
"11111";
125 ASSERT_EQ(5, cecum_mp.width());
126 ASSERT_EQ(1, cecum_mp.height());
127 ASSERT_EQ(1, cecum_mp.free_space().size());
128 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
137 const std::string Map_Pattern =
"11" 141 ASSERT_EQ(2, cecum_mp.width());
142 ASSERT_EQ(3, cecum_mp.height());
143 ASSERT_EQ(1, cecum_mp.free_space().size());
144 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
150 const std::string Map_Pattern =
"11" 155 ASSERT_EQ(2, cecum_mp.width());
156 ASSERT_EQ(4, cecum_mp.height());
157 ASSERT_EQ(1, cecum_mp.free_space().size());
158 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
164 const std::string Map_Pattern =
"1111" 167 ASSERT_EQ(4, cecum_mp.width());
168 ASSERT_EQ(2, cecum_mp.height());
169 ASSERT_EQ(1, cecum_mp.free_space().size());
170 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
176 const std::string Map_Pattern =
"11111" 179 ASSERT_EQ(5, cecum_mp.width());
180 ASSERT_EQ(2, cecum_mp.height());
181 ASSERT_EQ(1, cecum_mp.free_space().size());
182 ASSERT_EQ(0, cecum_mp.free_space()[0].area());
191 const std::string Map_Pattern =
"11111" 196 ASSERT_EQ(5, cecum_mp.width());
197 ASSERT_EQ(4, cecum_mp.height());
198 ASSERT_EQ(1, cecum_mp.free_space().size());
199 ASSERT_EQ(
Rectangle(-3, 0, 1, 4), cecum_mp.free_space()[0]);
205 const std::string Map_Pattern =
"100001" 209 ASSERT_EQ(6, cecum_mp.width());
210 ASSERT_EQ(3, cecum_mp.height());
211 ASSERT_EQ(1, cecum_mp.free_space().size());
212 ASSERT_EQ(
Rectangle(-1, 1, 1, 5), cecum_mp.free_space()[0]);
218 const std::string Map_Pattern =
"111111" 223 ASSERT_EQ(6, cecum_mp.width());
224 ASSERT_EQ(4, cecum_mp.height());
225 ASSERT_EQ(1, cecum_mp.free_space().size());
226 ASSERT_EQ(
Rectangle(-2, 0, 1, 6), cecum_mp.free_space()[0]);
232 const std::string Map_Pattern =
"1111111" 238 ASSERT_EQ(7, cecum_mp.width());
239 ASSERT_EQ(5, cecum_mp.height());
240 ASSERT_EQ(1, cecum_mp.free_space().size());
241 ASSERT_EQ(
Rectangle(-3, 0, 0, 6), cecum_mp.free_space()[0]);
246 int main (
int argc,
char *argv[]) {
247 ::testing::InitGoogleTest(&argc, argv);
248 return RUN_ALL_TESTS();
int main(int argc, char *argv[])
TEST_F(CecumTextRasterMapPrimitiveTest, singlePixelTop)