#include <gtest/gtest.h>
#include "doorkeeper/components/tilecoords.hpp"

TEST(increment, tilecoords) {
	typedef dk::TileCoords<2> tcoords2;
	typedef dk::TileCoords<2>::coords coords2;
	typedef dk::TileCoords<5> tcoords5;
	typedef dk::TileCoords<5>::coords coords5;

	{
		const coords2 max_coords(150, 200);
		tcoords2 test(max_coords);
		EXPECT_EQ(tcoords2(coords2(0), max_coords), test);

		for (auto z = coords2(0).x(); z <= max_coords.x(); ++z) {
			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);
	}

	{
		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);
	}
}
