2015-08-16 18:33:44 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "doorkeeper/components/tileiterator.hpp"
|
2015-08-17 22:03:27 +00:00
|
|
|
#include "doorkeeper/components/pixelconv.hpp"
|
2015-08-16 18:33:44 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <boost/iterator/counting_iterator.hpp>
|
|
|
|
#include <limits>
|
|
|
|
|
2015-08-17 11:36:47 +00:00
|
|
|
TEST(tileiterator, increment) {
|
2015-08-16 18:33:44 +00:00
|
|
|
typedef dk::TileIterator<int, 7> tileit7;
|
|
|
|
typedef dk::Vector<7> coords7;
|
|
|
|
|
|
|
|
using boost::counting_iterator;
|
|
|
|
|
|
|
|
std::vector<int> data(counting_iterator<int>(0), counting_iterator<int>(100000));
|
2015-08-17 22:03:27 +00:00
|
|
|
dk::PixelConvSquare<7> pixconv(coords7(16));
|
2015-08-16 18:33:44 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
const coords7 max_coords(99, 999, 2, 2, 2, 2, 2);
|
2015-08-17 22:03:27 +00:00
|
|
|
tileit7 it(&data, pixconv, max_coords);
|
2015-08-16 18:33:44 +00:00
|
|
|
|
2015-08-18 22:15:31 +00:00
|
|
|
for (std::size_t z = 0; z < data.size() - 1; ++z) {
|
|
|
|
EXPECT_EQ(data[z], it->data());
|
2015-08-16 18:33:44 +00:00
|
|
|
++it;
|
|
|
|
}
|
|
|
|
|
2015-08-18 22:15:31 +00:00
|
|
|
EXPECT_EQ(data[data.size() - 1], it->data());
|
|
|
|
EXPECT_EQ(coords7(99, 999, 0, 0, 0, 0, 0), it->block_position());
|
2015-08-16 18:33:44 +00:00
|
|
|
}
|
|
|
|
}
|