From 4167cb5d123240f6ff37d2176f1d444af8b273d3 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 1 Dec 2018 11:36:05 -0500 Subject: [PATCH] unit test refactoring --- unit_tests/main.cpp | 2 +- unit_tests/test_pid_auto.cpp | 11 +++++------ unit_tests/test_pid_auto.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/unit_tests/main.cpp b/unit_tests/main.cpp index 4dff2df687..b022b4b695 100644 --- a/unit_tests/main.cpp +++ b/unit_tests/main.cpp @@ -63,7 +63,7 @@ int main(void) { testMisc(); testDifferentInjectionModes(); - testPidAutoZigZag(); + testPidAuto(); testMissedSpark299(); testSparkReverseOrderBug319(); testFuelSchedulerBug299smallAndLarge(); diff --git a/unit_tests/test_pid_auto.cpp b/unit_tests/test_pid_auto.cpp index 07168bde12..6245fb3304 100644 --- a/unit_tests/test_pid_auto.cpp +++ b/unit_tests/test_pid_auto.cpp @@ -158,10 +158,9 @@ static void testPidAutoZigZagGrowingOsc() { } -static void testPidAutoZigZagZero() { +static void testPidZeroLine() { printf("*************************************************** testPidAutoZigZagGrowingOsc\r\n"); - oscRange = 0; mockTimeMs = 0; PID_AutoTune at; @@ -174,7 +173,7 @@ static void testPidAutoZigZagZero() { startMockMs = mockTimeMs; printf("loop=%d %d\r\n", i, startMockMs); for (; mockTimeMs < CYCLE + startMockMs; mockTimeMs++) { - at.input = zigZagValue(mockTimeMs); + at.input = 0; bool result = at.Runtime(&logging); assertFalseM("should be false#4", result); } @@ -182,11 +181,11 @@ static void testPidAutoZigZagZero() { // nothing happens in this test since we do not allow time play a role } -void testPidAutoZigZag() { - printf("*************************************************** testPidAutoZigZag\r\n"); +void testPidAuto() { + printf("*************************************************** testPidAuto\r\n"); - testPidAutoZigZagZero(); + testPidZeroLine(); testPidAutoZigZagStable(); testPidAutoZigZagGrowingOsc(); diff --git a/unit_tests/test_pid_auto.h b/unit_tests/test_pid_auto.h index 8908f414e9..42ee6cce4f 100644 --- a/unit_tests/test_pid_auto.h +++ b/unit_tests/test_pid_auto.h @@ -8,6 +8,6 @@ #ifndef TEST_PID_AUTO_H_ #define TEST_PID_AUTO_H_ -void testPidAutoZigZag(); +void testPidAuto(); #endif /* TEST_PID_AUTO_H_ */