AutoExpandble_map_utest.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 
3 #include "Map_test.h"
4 
5 bool test_expansion_by_cell_update(const DiscretePoint2D& Cell_coor, MapParams expected_param) {
6  GridMap map(std::shared_ptr<GridCellFactory>(new TinyBaseCellFactory), {1,1,1});
7 
8  map.update_cell(Cell_coor, {0.5, 0.5});
9  MapParams param(map.height(), map.width(), map.map_center_x(), map.map_center_y());
10 
11  return param == expected_param;
12 }
13 
14 TEST(AutoExpandbleMapBaseTests, Expand_Right) {
15  EXPECT_TRUE(test_expansion_by_cell_update({2,0}, {1,4,0,0}));
16 }
17 
18 TEST(AutoExpandbleMapBaseTests, Expand_Top) {
19  EXPECT_TRUE(test_expansion_by_cell_update({0,2}, {4,1,0,0}));
20 }
21 
22 TEST(AutoExpandbleMapBaseTests, Expand_Left) {
23  EXPECT_TRUE(test_expansion_by_cell_update({-2,0}, {1,4,3,0}));
24 }
25 
26 TEST(AutoExpandbleMapBaseTests, Expand_Down) {
27  EXPECT_TRUE(test_expansion_by_cell_update({0,-2}, {4,1,0,3}));
28 }
29 
30 TEST(AutoExpandbleMapBaseTests, Expand_Right_Top) {
31  EXPECT_TRUE(test_expansion_by_cell_update({2,2}, {4,4,0,0}));
32 }
33 
34 TEST(AutoExpandbleMapBaseTests, Expand_Right_Down) {
35  EXPECT_TRUE(test_expansion_by_cell_update({2,-2}, {4,4,0,3}));
36 }
37 
38 TEST(AutoExpandbleMapBaseTests, Expand_Left_Top) {
39  EXPECT_TRUE(test_expansion_by_cell_update({-2,2}, {4,4,3,0}));
40 }
41 
42 TEST(AutoExpandbleMapBaseTests, Expand_Left_Down) {
43  EXPECT_TRUE(test_expansion_by_cell_update({-2,-2}, {4,4,3,3}));
44 }
45 
46 TEST(AutoExpandbleMapBaseTests, NoExpand) {
47  EXPECT_TRUE(test_expansion_by_cell_update({0,0}, {1,1,0,0}));
48 }
49 
50 TEST(AutoExpandbleMapBaseTests, CheckCellsValue) {
51  GridMap map(std::shared_ptr<GridCellFactory>(new TinyBaseCellFactory), {1,1,1});
52  map.update_cell({5, 5}, {0.5, 0.5});
53  bool not_change = test_CellValueNotChange(map);
54  EXPECT_TRUE(not_change);
55 }
56 
57 int main (int argc, char *argv[]) {
58  ::testing::InitGoogleTest(&argc, argv);
59  return RUN_ALL_TESTS();
60 }
bool param(const std::string &param_name, T &param_val, const T &default_val)
An occupancy grid implementation.
Definition: grid_map.h:22
A strategy creates cells of the base tiny model (BaseTinyCell).
void update_cell(const DiscretePoint2D &cell_coord, const Occupancy &new_value, double quality=1.0)
Definition: grid_map.h:76
int main(int argc, char *argv[])
TEST(AutoExpandbleMapBaseTests, Expand_Right)
bool test_CellValueNotChange(GridMap map)
Definition: Map_test.h:26
bool test_expansion_by_cell_update(const DiscretePoint2D &Cell_coor, MapParams expected_param)
Defines a point with integer coordinates on a plane.


tiny_slam
Author(s):
autogenerated on Mon Jun 10 2019 15:30:57