MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / main

Function main

tests/test_rect.cpp:163–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161 }
162}
163int main(int argc, char **argv)
164{
165 if (config().parseOptions(argc, argv))
166 {
167 return EXIT_FAILURE;
168 }
169 test_point_within({0, 0, 1, 1}, {0, 0}, true);
170
171 test_point_within({0, 0, 3, 3}, {1, 0}, true);
172 test_point_within({0, 0, 3, 3}, {2, 1}, true);
173 test_point_within({0, 0, 3, 3}, {2, 2}, true);
174 test_point_within({0, 0, 3, 3}, {1, 2}, true);
175
176 test_point_within({0, 0, 1, 1}, {1, 1}, false);
177 test_point_within({0, 0, 1, 1}, {0, 1}, false);
178 test_point_within({0, 0, 1, 1}, {-1, 1}, false);
179 test_point_within({0, 0, 1, 1}, {-1, 0}, false);
180 test_point_within({0, 0, 1, 1}, {-1, -1}, false);
181 test_point_within({0, 0, 1, 1}, {0, -1}, false);
182 test_point_within({0, 0, 1, 1}, {1, -1}, false);
183 test_point_within({0, 0, 1, 1}, {1, 0}, false);
184
185 test_rect_within({0, 0, 1, 1}, {0, 0, 1, 1}, true);
186
187 test_rect_within({0, 0, 1, 1}, {1, 0, 2, 1}, false);
188 test_rect_within({0, 0, 1, 1}, {0, 1, 1, 2}, false);
189 test_rect_within({0, 0, 1, 1}, {-1, 0, 1, 1}, false);
190 test_rect_within({0, 0, 1, 1}, {0, -1, 1, 1}, false);
191
192 test_rect_intersects({0, 0, 1, 1}, {0, 0, 1, 1}, true);
193 test_rect_intersects({0, 0, 1, 1}, {0, 0, 2, 1}, true);
194 test_rect_intersects({0, 0, 1, 1}, {0, 0, 1, 2}, true);
195 test_rect_intersects({0, 0, 1, 1}, {-1, 0, 1, 1}, true);
196 test_rect_intersects({0, 0, 1, 1}, {0, -1, 1, 1}, true);
197
198 test_rect_intersects({0, 0, 1, 1}, {0, 1, 1, 2}, false);
199 test_rect_intersects({0, 0, 1, 1}, {1, 0, 2, 1}, false);
200 test_rect_intersects({0, 0, 1, 1}, {-1, 0, 0, 1}, false);
201 test_rect_intersects({0, 0, 1, 1}, {0, -1, 1, 0}, false);
202 if (!test_rect_compaction())
203 {
204 return EXIT_FAILURE;
205 }
206 return EXIT_SUCCESS;
207}

Callers

nothing calls this directly

Calls 5

test_point_withinFunction · 0.85
test_rect_withinFunction · 0.85
test_rect_intersectsFunction · 0.85
test_rect_compactionFunction · 0.85
parseOptionsMethod · 0.45

Tested by

no test coverage detected