2015-07-29 23:18:19 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "doorkeeper/components/tilecoords.hpp"
|
|
|
|
|
|
|
|
TEST(increment, tilecoords) {
|
|
|
|
typedef dk::TileCoords<2> tcoords2;
|
|
|
|
typedef dk::TileCoords<2>::coords coords2;
|
2015-07-30 00:04:02 +00:00
|
|
|
typedef dk::TileCoords<5> tcoords5;
|
|
|
|
typedef dk::TileCoords<5>::coords coords5;
|
2015-07-29 23:18:19 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
const coords2 max_coords(150, 200);
|
|
|
|
tcoords2 test(max_coords);
|
|
|
|
EXPECT_EQ(tcoords2(coords2(0), max_coords), test);
|
|
|
|
|
2015-07-30 00:04:02 +00:00
|
|
|
for (auto z = coords2(0).x(); z <= max_coords.x(); ++z) {
|
2015-07-29 23:18:19 +00:00
|
|
|
EXPECT_EQ(tcoords2(coords2(z, 0), max_coords), test);
|
|
|
|
++test;
|
|
|
|
}
|
|
|
|
auto test_old = test++;
|
|
|
|
EXPECT_EQ(tcoords2(coords2(1, 1), max_coords), test);
|
|
|
|
EXPECT_EQ(tcoords2(coords2(0, 1), max_coords), test_old);
|
|
|
|
}
|
2015-07-30 00:04:02 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
const coords5 max_coords(3);
|
|
|
|
tcoords5 test(max_coords);
|
|
|
|
for (int z = 0; z < 4 * 4 * 4 * 4 * 4 - 1; ++z) {
|
|
|
|
++test;
|
|
|
|
}
|
|
|
|
EXPECT_EQ(tcoords5(max_coords, max_coords), test);
|
|
|
|
}
|
2015-07-29 23:18:19 +00:00
|
|
|
}
|