Tests for SumTrapezoids method in VAbstractDetail class
--HG-- branch : feature
This commit is contained in:
parent
e8570f9812
commit
56d655f2ff
|
@ -32,6 +32,8 @@
|
|||
#include <QPointF>
|
||||
#include <QVector>
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
TST_VAbstractDetail::TST_VAbstractDetail(QObject *parent)
|
||||
:AbstractTest(parent)
|
||||
|
@ -51,6 +53,15 @@ void TST_VAbstractDetail::EquidistantRemoveLoop() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_VAbstractDetail::SumTrapezoids() const
|
||||
{
|
||||
Case3();
|
||||
Case4();
|
||||
Case5();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void TST_VAbstractDetail::Case1() const
|
||||
{
|
||||
const QVector<QPointF> points = InputPointsCase1(); // Input points.
|
||||
|
@ -78,6 +89,33 @@ void TST_VAbstractDetail::Case2() const
|
|||
Comparison(ekv, ekvOrig);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_VAbstractDetail::Case3() const
|
||||
{
|
||||
const QVector<QPointF> points = InputPointsCase3(); // Input points.
|
||||
|
||||
const qreal result = VAbstractDetail::SumTrapezoids(points);
|
||||
QVERIFY(result < 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_VAbstractDetail::Case4() const
|
||||
{
|
||||
const QVector<QPointF> points = InputPointsCase4(); // Input points.
|
||||
|
||||
const qreal result = VAbstractDetail::SumTrapezoids(points);
|
||||
QVERIFY(result > 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_VAbstractDetail::Case5() const
|
||||
{
|
||||
const QVector<QPointF> points = InputPointsCase5(); // Input points.
|
||||
|
||||
const qreal result = VAbstractDetail::SumTrapezoids(points);
|
||||
QVERIFY(result == 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> TST_VAbstractDetail::InputPointsCase1() const
|
||||
{
|
||||
|
@ -324,3 +362,37 @@ QVector<QPointF> TST_VAbstractDetail::OutputPointsCase2() const
|
|||
|
||||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> TST_VAbstractDetail::InputPointsCase3() const
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
|
||||
points += QPointF(35, 35);
|
||||
points += QPointF(50, 50);
|
||||
points += QPointF(15, 50);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> TST_VAbstractDetail::InputPointsCase4() const
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
|
||||
points += QPointF(15, 15);
|
||||
points += QPointF(15, 50);
|
||||
points += QPointF(50, 50);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> TST_VAbstractDetail::InputPointsCase5() const
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
|
||||
points += QPointF(35, 35);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
|
|
@ -41,10 +41,14 @@ signals:
|
|||
|
||||
private slots:
|
||||
void EquidistantRemoveLoop() const;
|
||||
void SumTrapezoids() const;
|
||||
|
||||
private:
|
||||
void Case1() const;
|
||||
void Case2() const;
|
||||
void Case3() const;
|
||||
void Case4() const;
|
||||
void Case5() const;
|
||||
|
||||
QVector<QPointF> InputPointsCase1() const;
|
||||
QVector<QPointF> OutputPointsCase1() const;
|
||||
|
@ -52,6 +56,10 @@ private:
|
|||
QVector<QPointF> InputPointsCase2() const;
|
||||
QVector<QPointF> OutputPointsCase2() const;
|
||||
|
||||
QVector<QPointF> InputPointsCase3() const;
|
||||
QVector<QPointF> InputPointsCase4() const;
|
||||
QVector<QPointF> InputPointsCase5() const;
|
||||
|
||||
};
|
||||
|
||||
#endif // TST_VABSTRACTDETAIL_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user