forked from ANYbotics/grid_map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEllipseIteratorTest.cpp
60 lines (47 loc) · 1.17 KB
/
EllipseIteratorTest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* EllipseIteratorTest.cpp
*
* Created on: Dec 2, 2015
* Author: Péter Fankhauser
* Institute: ETH Zurich, ANYbotics
*/
#include "grid_map_core/iterators/EllipseIterator.hpp"
#include "grid_map_core/GridMap.hpp"
// Eigen
#include <Eigen/Core>
// gtest
#include <gtest/gtest.h>
// Limits
#include <cfloat>
// Vector
#include <vector>
using namespace std;
using namespace Eigen;
using namespace grid_map;
TEST(EllipseIterator, OneCellWideEllipse)
{
GridMap map( { "types" });
map.setGeometry(Length(8.0, 5.0), 1.0, Position(0.0, 0.0));
EllipseIterator iterator(map, Position(0.0, 0.0), Length(8.0, 1.0));
EXPECT_FALSE(iterator.isPastEnd());
EXPECT_EQ(0, (*iterator)(0));
EXPECT_EQ(2, (*iterator)(1));
++iterator;
EXPECT_FALSE(iterator.isPastEnd());
EXPECT_EQ(1, (*iterator)(0));
EXPECT_EQ(2, (*iterator)(1));
++iterator;
EXPECT_FALSE(iterator.isPastEnd());
EXPECT_EQ(2, (*iterator)(0));
EXPECT_EQ(2, (*iterator)(1));
++iterator;
++iterator;
++iterator;
++iterator;
++iterator;
EXPECT_FALSE(iterator.isPastEnd());
EXPECT_EQ(7, (*iterator)(0));
EXPECT_EQ(2, (*iterator)(1));
++iterator;
EXPECT_TRUE(iterator.isPastEnd());
}