Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <iostream>
00009 #include <gtest/gtest.h>
00010 #include "semanticmodel/miniatureoccupancygrid.hh"
00011
00012 using semanticmodel::MiniatureOccupancyGrid;
00013
00014 TEST(MiniOG, constructor)
00015 {
00016 MiniatureOccupancyGrid og;
00017 EXPECT_DOUBLE_EQ(0.05, og._scale);
00018
00019 EXPECT_EQ(0, og.grid.size());
00020 }
00021
00022 TEST(MiniOG, getOnZero)
00023 {
00024 MiniatureOccupancyGrid og;
00025 for (double i = 0 ; i < 100.0 ; i += 0.5)
00026 {
00027 for (double j = 0 ; j < 100.0 ; j += 0.5)
00028 {
00029 EXPECT_EQ(og.get(i, j), MiniatureOccupancyGrid::EMPTY);
00030 }
00031 }
00032 }
00033
00034 TEST(MiniOG, set)
00035 {
00036 MiniatureOccupancyGrid og;
00037 og.set(19.5, 20.5, MiniatureOccupancyGrid::OCCUPIED);
00038 EXPECT_EQ(og.get(19.5, 20.5), MiniatureOccupancyGrid::OCCUPIED);
00039 for (double i = 0 ; i < 19.0 ; i += 0.1)
00040 {
00041 EXPECT_EQ(og.grid.at((int)i).size(), 0);
00042 }
00043 EXPECT_EQ(og.grid.at(19).size(), 21);
00044 for (double i = 0 ; i < 19 ; i += 0.1)
00045 {
00046 for (double j = 0 ; j < 20 ; j += 0.1)
00047 {
00048 EXPECT_EQ(og.get(i, j), MiniatureOccupancyGrid::EMPTY);
00049 }
00050 }
00051 }
00052
00053 int main(int argc, char* argv[])
00054 {
00055 testing::InitGoogleTest(&argc, argv);
00056 return RUN_ALL_TESTS();
00057 }