Ejemplo n.º 1
0
void Coordinates_test::
t_element()
{
    Coordinates c;
    c << 1.0 << -2.0;
    c.at(1)= -3;
    QCOMPARE(c.at(1), -3.0);
    QCOMPARE(c.back(), -3.0);
    QCOMPARE(c.front(), 1.0);
    c[1]= -2.0;
    QCOMPARE(c[1],-2.0);
    QCOMPARE(c.first(), 1.0);
    c.first()= 2.0;
    QCOMPARE(c.first(), 2.0);
    QCOMPARE(c.last(), -2.0);
    c.last()= 0.0;
    QCOMPARE(c.first()+c.last(), 2.0);
    coordT *c4= &c.first();
    const coordT *c5= &c.first();
    QCOMPARE(c4, c5);
    coordT *c6= &c.last();
    const coordT *c7= &c.last();
    QCOMPARE(c6, c7);
    Coordinates c2= c.mid(1);
    QCOMPARE(c2.count(), 1);
    c << 3.0;
    Coordinates c3= c.mid(1,1);
    QCOMPARE(c2, c3);
    QCOMPARE(c3.value(-1, -1.0), -1.0);
    QCOMPARE(c3.value(3, 4.0), 4.0);
    QCOMPARE(c.value(2, 4.0), 3.0);
}//t_element
Ejemplo n.º 2
0
	bool MatchArrayIterator::setPosition(Coordinates const& pos)
    {
        Coordinates inPos = pos;
        if (pos.back() != 0) {
            return false;
        }
        inPos.pop_back();
        return inputIterator->setPosition(inPos);
    }