Byrjaði á kóðum fyrir part 3 en lenti í veseni með test kóðann
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <unity.h>
|
||||
|
||||
//#include "p_controller.h"
|
||||
#include "pi_controller.h"
|
||||
|
||||
static const double KP = 2.0;
|
||||
static const double KI = 1.0;
|
||||
static const double T = 0.1;
|
||||
static const double TOL = 1e-4; // Tolerance
|
||||
|
||||
void test_positive_error()
|
||||
{
|
||||
PI_controller controller(KP, KI, T);
|
||||
|
||||
double output = controller.update(10.0, 8.0);
|
||||
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOL, 4.4, output);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
RUN_TEST(test_positive_error);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
Reference in New Issue
Block a user