EllipseIteratorTest.cpp
Go to the documentation of this file.
00001 /*
00002  * EllipseIteratorTest.cpp
00003  *
00004  *  Created on: Dec 2, 2015
00005  *      Author: Péter Fankhauser
00006  *       Institute: ETH Zurich, Autonomous Systems Lab
00007  */
00008 
00009 #include "grid_map_core/iterators/EllipseIterator.hpp"
00010 #include "grid_map_core/GridMap.hpp"
00011 
00012 // Eigen
00013 #include <Eigen/Core>
00014 
00015 // gtest
00016 #include <gtest/gtest.h>
00017 
00018 // Limits
00019 #include <cfloat>
00020 
00021 // Vector
00022 #include <vector>
00023 
00024 using namespace std;
00025 using namespace Eigen;
00026 using namespace grid_map;
00027 
00028 TEST(EllipseIterator, OneCellWideEllipse)
00029 {
00030   GridMap map( { "types" });
00031   map.setGeometry(Length(8.0, 5.0), 1.0, Position(0.0, 0.0));
00032 
00033   EllipseIterator iterator(map, Position(0.0, 0.0), Length(8.0, 1.0));
00034 
00035   EXPECT_FALSE(iterator.isPastEnd());
00036   EXPECT_EQ(0, (*iterator)(0));
00037   EXPECT_EQ(2, (*iterator)(1));
00038 
00039   ++iterator;
00040   EXPECT_FALSE(iterator.isPastEnd());
00041   EXPECT_EQ(1, (*iterator)(0));
00042   EXPECT_EQ(2, (*iterator)(1));
00043 
00044   ++iterator;
00045   EXPECT_FALSE(iterator.isPastEnd());
00046   EXPECT_EQ(2, (*iterator)(0));
00047   EXPECT_EQ(2, (*iterator)(1));
00048 
00049   ++iterator;
00050   ++iterator;
00051   ++iterator;
00052   ++iterator;
00053   ++iterator;
00054   EXPECT_FALSE(iterator.isPastEnd());
00055   EXPECT_EQ(7, (*iterator)(0));
00056   EXPECT_EQ(2, (*iterator)(1));
00057 
00058   ++iterator;
00059   EXPECT_TRUE(iterator.isPastEnd());
00060 }


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Mon Oct 9 2017 03:09:16