20 using std::ostringstream;
56 QCOMPARE(c.
size(), 0U);
59 QCOMPARE(c.
count(), 1);
62 QCOMPARE(c2.count(), 2);
65 QCOMPARE(c3.count(), 2);
66 QCOMPARE(c3[0]+c3[1], 3.0);
68 std::vector<coordT> vc;
72 QCOMPARE(c4[0]+c4[1], 7.0);
85 QCOMPARE(c.
data()[1], 3.0);
90 QCOMPARE((
size_t)vc.size(), c.
size());
91 for(
int k= (
int)vc.size(); k--; ){
92 QCOMPARE(vc[k], c[k]);
94 QList<coordT> qc= c.toQList();
95 QCOMPARE(qc.count(), c.
count());
96 for(
int k= qc.count(); k--; ){
97 QCOMPARE(qc[k], c[k]);
100 c4= std::vector<double>(2, 0.0);
101 QCOMPARE(c4.
back(), 0.0);
113 QCOMPARE(c.
at(1), -3.0);
114 QCOMPARE(c.
back(), -3.0);
115 QCOMPARE(c.
front(), 1.0);
118 QCOMPARE(c.
first(), 1.0);
120 QCOMPARE(c.
first(), 2.0);
121 QCOMPARE(c.
last(), -2.0);
131 QCOMPARE(c2.
count(), 1);
135 QCOMPARE(c3.
value(-1, -1.0), -1.0);
136 QCOMPARE(c3.
value(3, 4.0), 4.0);
137 QCOMPARE(c.
value(2, 4.0), 3.0);
144 QCOMPARE(c.
size(), 0u);
145 QCOMPARE(c.
count(), 0);
148 QCOMPARE(c.
size(), 2u);
149 QCOMPARE(c.
count(), 2);
169 QCOMPARE(c3.
count(), 2);
170 QCOMPARE(c3[0], 0.0);
171 QCOMPARE(c3[1], 1.0);
173 QCOMPARE(c3.
count(), 4);
174 QCOMPARE(c3[2], 0.0);
175 QCOMPARE(c3[3], 1.0);
177 QCOMPARE(c3[4], 1.0);
179 QCOMPARE(c3.
count(), 6);
180 QCOMPARE(c3[5], 5.0);
200 QCOMPARE(*(i+1), 3.0);
202 QCOMPARE(*(i-1), 1.0);
204 QVERIFY(i==c.
begin());
209 QVERIFY(i>=c.
begin());
210 QVERIFY(i+1<=c.
end());
211 QVERIFY(i+1>c.
begin());
215 QCOMPARE(i3[1], 3.0);
231 QCOMPARE(i[1], -3.0);
239 QCOMPARE(*(i+1), 3.0);
241 QCOMPARE(*(i-1), 1.0);
243 QVERIFY(i==c.
begin());
248 QVERIFY(i>=c.
begin());
249 QVERIFY(i+1<=c.
end());
250 QVERIFY(i+1>c.
begin());
293 QCOMPARE(i.
next(), 1.0);
295 QCOMPARE(i.
next(), 3.0);
298 QCOMPARE(i.
next(), 1.0);
342 QCOMPARE(i.
next(), 1.0);
344 QCOMPARE(i.
next(), 3.0);
347 QCOMPARE(i.
next(), 1.0);
353 QCOMPARE((i.
next()= 1.0), 1.0);
356 QCOMPARE(c.
count(), 1);
358 QCOMPARE(c.
count(), 1);
362 QCOMPARE(c.
count(), 3);
371 QCOMPARE(c.
count(), 3);
374 QCOMPARE(c.
count(), 3);
377 QCOMPARE(c.
count(), 3);
379 QCOMPARE(c.
count(), 4);
380 QCOMPARE(i.
value(), 0.0);
383 QCOMPARE(c.
count(), 4);
391 QCOMPARE(i.
value(), 1.0);
409 QCOMPARE(c.
count(), 0);
412 QCOMPARE(c.
count(), 0);
413 coordT c2[4]= { 0.0, 1.0, 2.0, 3.0};
415 QCOMPARE(c.
count(), 4);
422 QCOMPARE(c.
count(), 0);
428 QCOMPARE(c.
count(), 2);
430 QCOMPARE(c.
count(), 1);
433 QCOMPARE(c.
count(), 2);
435 QCOMPARE(c.
count(), 3);
441 QCOMPARE(c.
count(), 5);
444 QCOMPARE(c.
count(), 5);
447 QCOMPARE(c.
count(), 4);
450 QCOMPARE(c.
count(), 5);
453 QCOMPARE(c.
count(), 6);
456 QCOMPARE(c.
count(), 5);
459 QCOMPARE(c.
count(), 4);
462 QCOMPARE(c.
count(), 3);
463 QCOMPARE(c.
last(), 2.0);
465 QCOMPARE(c.
count(), 3);
470 QCOMPARE(c.
count(), 2);
473 QCOMPARE(c.
count(), 1);
484 c << 1.0 << 3.0 << 1.0;
488 QCOMPARE(c.
count(1.0), 2);
489 QCOMPARE(c.
count(3.0), 1);
490 QCOMPARE(c.
count(0.0), 0);
493 QCOMPARE(c.
indexOf(1.0, -1), 2);
494 QCOMPARE(c.
indexOf(3.0, -1), -1);
495 QCOMPARE(c.
indexOf(3.0, -2), 1);
496 QCOMPARE(c.
indexOf(1.0, -3), 0);
497 QCOMPARE(c.
indexOf(1.0, -4), 0);
498 QCOMPARE(c.
indexOf(1.0, 1), 2);
499 QCOMPARE(c.
indexOf(3.0, 2), -1);
500 QCOMPARE(c.
indexOf(1.0, 2), 2);
501 QCOMPARE(c.
indexOf(1.0, 3), -1);
502 QCOMPARE(c.
indexOf(1.0, 4), -1);
516 QCOMPARE(c.
count(), 2);
518 QCOMPARE(c.
count(), 2);
520 QCOMPARE(c.
count(), 0);
522 QCOMPARE(c.
count(), 0);
529 c << 1.0 << 2.0 << 3.0;
531 os <<
"Coordinates 1-2-3\n" << c;
533 QString s= QString::fromStdString(os.str());
534 QCOMPARE(s.count(
"2"), 2);
539 #include "moc/Coordinates_test.moc" iterator erase(iterator idx)
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
void push_front(const coordT &c)
bool findNext(const coordT &t)
void replace(countT idx, const coordT &c)
coordT & peekPrevious() const
void setValue(const coordT &t) const
const coordT & peekNext() const
countT lastIndexOf(const coordT &t, countT from=-1) const
coordT & peekNext() const
void t_mutable_coord_iterator()
const_iterator constBegin() const
bool findNext(const coordT &t)
void removeAt(countT idx)
void insert(countT before, const coordT &c)
coordT value(countT idx, const coordT &defaultValue) const
void swap(countT idx, countT other)
bool findPrevious(const coordT &t)
void prepend(const coordT &c)
void removeAll(const coordT &t)
const_iterator constEnd() const
void push_back(const coordT &c)
bool findPrevious(const coordT &t)
bool contains(const coordT &t) const
void add_Coordinates_test()
countT indexOf(const coordT &t, countT from=0) const
coordT takeAt(countT idx)
void move(countT from, countT to)
void insert(const coordT &t)
std::vector< coordT > toStdVector() const
const coordT & peekPrevious() const
const coordT & previous()
void append(int pointDimension, coordT *c)
Coordinates mid(countT idx, countT length=-1) const