#include "testcorrecteurkp.h"
#include "correcteurkp.h"
TestCorrecteurKp::TestCorrecteurKp(QObject *parent)
: QObject{parent}
{
}
void TestCorrecteurKp::process_data()
{
QTest::addColumn<double>("consigne");
QTest::addColumn<double>("Kp");
QTest::addColumn<double>("input");
QTest::addColumn<double>("output");
QTest::newRow("") << 100.0 << 1.0 << 100.0 << 0.0 ;
QTest::newRow("") << 100.0 << 1.0 << 80.0 << 20.0 ;
QTest::newRow("") << 100.0 << 1.0 << 120.0 << -20.0 ;
QTest::newRow("") << 80.0 << 1.0 << 80.0 << 0.0 ;
QTest::newRow("") << 80.0 << 1.0 << 70.0 << 10.0 ;
QTest::newRow("") << 80.0 << 1.0 << 90.0 << -10.0 ;
}
void TestCorrecteurKp::process()
{
QFETCH(double, consigne);
QFETCH(double, Kp);
QFETCH(double, input);
QFETCH(double, output);
QCOMPARE(CorrecteurKp(consigne,Kp).process(input), output);
}