1 #include <gtest/gtest.h> 5 #include "../mock_grid_cell.h" 7 #include "../../../src/core/maps/lazy_tiled_grid_map.h" 12 :
map{std::make_shared<MockGridCell>(), {1, 1, 1}}
13 ,
data{
true, {0.5, 0.5}, {-1, -1}, 0} {}
21 MapInfo(
int w_,
int h_,
int o_x,
int o_y) :
w{w_}, h{h_}, origin{o_x, o_y} {}
26 return (
w == that.
w) && (h == that.
h) && (origin == that.
origin);
34 stream <<
"w: " << mi.
w <<
", h: " << mi.
h;
35 return stream <<
", origin: ("<< mi.
origin.
x <<
", " << mi.
origin.
y <<
")";
39 static constexpr
int Lim = 50;
40 for (
int i = -Lim; i != Lim; ++i) {
41 for (
int j = -Lim; j != Lim; ++j) {
42 map.
update({i, j}, {
true, {(double)Lim * i + j, 0}, {0, 0}, 0});
47 for (
int i = -Lim; i != Lim; ++i) {
48 for (
int j = -Lim; j != Lim; ++j) {
49 ASSERT_EQ((
map[{i, j}]), ((
double)Lim * i + j));
50 ASSERT_EQ((map_copy[{i, j}]), ((
double)Lim * i + j));
57 static constexpr
int Lim = 50;
58 for (
int i = -Lim; i != Lim; ++i) {
59 for (
int j = -Lim; j != Lim; ++j) {
60 map.
update({i, j}, {
true, {(double)Lim * i + j, 0}, {0, 0}, 0});
64 for (
int i = -Lim; i != Lim; ++i) {
65 for (
int j = -Lim; j != Lim; ++j) {
66 map_copy.
update({i, j}, {
true, {(double)2*Lim * i + j, 0}, {0, 0}, 0});
70 for (
int i = -Lim; i != Lim; ++i) {
71 for (
int j = -Lim; j != Lim; ++j) {
72 ASSERT_EQ((
map[{i, j}]), ((
double)Lim * i + j));
73 ASSERT_EQ((map_copy[{i, j}]), ((
double)2*Lim * i + j));
80 int main (
int argc,
char *argv[]) {
81 ::testing::InitGoogleTest(&argc, argv);
82 return RUN_ALL_TESTS();
UnboundedLazyTiledGridMap map
AreaOccupancyObservation data
MapInfo(int w_, int h_, int o_x, int o_y)
TEST_F(UnboundedLazyTiledGridMapTest, readMapCopy)
void update(const Coord &area_id, const AreaOccupancyObservation &aoo) override
Updates area with a given observation.
std::ostream & operator<<(std::ostream &stream, const MapInfo &mi)
bool operator==(const MapInfo &that) const
TFSIMD_FORCE_INLINE const tfScalar & w() const
int main(int argc, char *argv[])
virtual int height() const
DiscretePoint2D origin() const override
MapInfo(const GridMap &map)
virtual int width() const
UnboundedLazyTiledGridMapTest()