MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / TEST

Function TEST

grid_map_core/test/PolygonIteratorTest.cpp:29–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27using namespace grid_map;
28
29TEST(PolygonIterator, FullCover)
30{
31 vector<string> types;
32 types.push_back("type");
33 GridMap map(types);
34 map.setGeometry(Length(8.0, 5.0), 1.0, Position(0.0, 0.0)); // bufferSize(8, 5)
35
36 Polygon polygon;
37 polygon.addVertex(Position(-100.0, 100.0));
38 polygon.addVertex(Position(100.0, 100.0));
39 polygon.addVertex(Position(100.0, -100.0));
40 polygon.addVertex(Position(-100.0, -100.0));
41
42 PolygonIterator iterator(map, polygon);
43
44 EXPECT_FALSE(iterator.isPastEnd());
45 EXPECT_EQ(0, (*iterator)(0));
46 EXPECT_EQ(0, (*iterator)(1));
47
48 ++iterator;
49 EXPECT_FALSE(iterator.isPastEnd());
50 EXPECT_EQ(0, (*iterator)(0));
51 EXPECT_EQ(1, (*iterator)(1));
52
53 ++iterator;
54 EXPECT_FALSE(iterator.isPastEnd());
55 EXPECT_EQ(0, (*iterator)(0));
56 EXPECT_EQ(2, (*iterator)(1));
57
58 for (int i = 0; i < 37; ++i) ++iterator;
59
60 EXPECT_FALSE(iterator.isPastEnd());
61 EXPECT_EQ(7, (*iterator)(0));
62 EXPECT_EQ(4, (*iterator)(1));
63
64 ++iterator;
65 EXPECT_TRUE(iterator.isPastEnd());
66}
67
68TEST(PolygonIterator, Outside)
69{

Callers

nothing calls this directly

Calls 4

setGeometryMethod · 0.80
addVertexMethod · 0.80
moveMethod · 0.80
isPastEndMethod · 0.45

Tested by

no test coverage detected