Commit 3ae40e66 authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud
Browse files

Now test case for distributed container works.

parent 08a56c4e
......@@ -51,6 +51,7 @@ private:
dtkDistributedContainer<T> *c;
typedef typename QVector<T>::const_iterator const_iterator;
const_iterator i;
qlonglong m_index;
};
// /////////////////////////////////////////////////////////////////
......
......@@ -19,7 +19,7 @@
// dtkDistributedLocalIterator implementation
// /////////////////////////////////////////////////////////////////
template<typename T> dtkDistributedLocalIterator<T>::dtkDistributedLocalIterator(dtkDistributedContainer<T> *container) : c(container), i(c->m_array.constBegin())
template<typename T> dtkDistributedLocalIterator<T>::dtkDistributedLocalIterator(dtkDistributedContainer<T> *container) : c(container), i(c->m_array.constBegin()), m_index(0)
{
};
......@@ -32,11 +32,13 @@ template<typename T> dtkDistributedLocalIterator<T>::~dtkDistributedLocalIterato
template <typename T> void dtkDistributedLocalIterator<T>::toBack(void)
{
i = c->m_array.constEnd();
m_index = c->m_array.size()-1;
};
template <typename T> void dtkDistributedLocalIterator<T>::toFront(void)
{
i = c->m_array.constBegin();
m_index = 0;
};
template <typename T> bool dtkDistributedLocalIterator<T>::hasNext(void)
......@@ -51,11 +53,13 @@ template <typename T> bool dtkDistributedLocalIterator<T>::hasPrevious(void)
template <typename T> const T& dtkDistributedLocalIterator<T>::next(void)
{
++m_index;
return (*i++);
};
template <typename T> const T& dtkDistributedLocalIterator<T>::previous(void)
{
--m_index;
return *(--i);
};
......@@ -73,12 +77,12 @@ template <typename T> const T& dtkDistributedLocalIterator<T>::peekPrevious(void
template <typename T> qlonglong dtkDistributedLocalIterator<T>::localIndex(void) const
{
return 0;
return m_index;
};
template <typename T> qlonglong dtkDistributedLocalIterator<T>::globalIndex(void) const
{
return 0;
return m_index;
};
......
......@@ -27,7 +27,7 @@ void dtkDistributedContainerTestCase::init(void)
void dtkDistributedContainerTestCase::test(void)
{
qlonglong N = 1000;
qlonglong N = 10;
dtkDistributedContainer<qlonglong> c;
c.resize(N);
......@@ -37,8 +37,8 @@ void dtkDistributedContainerTestCase::test(void)
dtkDistributedLocalIterator<qlonglong> *it = c.localIterator();
while(it->hasNext()) {
c.set(it->globalIndex(), it->localIndex());
it->next();
c.set(it->localIndex(), it->globalIndex());
qDebug() << it->next();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment