EngineTestHelper progress
This commit is contained in:
parent
9fdf74bc18
commit
bec88bf8c8
|
@ -216,7 +216,8 @@ scheduling_s * EventQueue::getHead() {
|
|||
return head;
|
||||
}
|
||||
|
||||
scheduling_s *EventQueue::getForUnitText(int index) {
|
||||
// todo: reduce code duplication with another 'getElementAtIndexForUnitText'
|
||||
scheduling_s *EventQueue::getElementAtIndexForUnitText(int index) {
|
||||
scheduling_s * current;
|
||||
|
||||
LL_FOREACH2(head, current, nextScheduling_s)
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
efitime_t getNextEventTime(efitime_t nowUs) const;
|
||||
void clear(void);
|
||||
int size(void) const;
|
||||
scheduling_s *getForUnitText(int index);
|
||||
scheduling_s *getElementAtIndexForUnitText(int index);
|
||||
void setLateDelay(int value);
|
||||
scheduling_s * getHead();
|
||||
void assertListIsSorted() const;
|
||||
|
|
|
@ -170,6 +170,35 @@ scheduling_s * EngineTestHelper::assertEvent5(const char *msg, int index, void *
|
|||
return event;
|
||||
}
|
||||
|
||||
// todo: reduce code duplication with another 'getElementAtIndexForUnitText'
|
||||
static AngleBasedEvent * getElementAtIndexForUnitText(int index, Engine *engine) {
|
||||
AngleBasedEvent * current;
|
||||
|
||||
LL_FOREACH2(engine->ignitionEventsHead, current, nextToothEvent)
|
||||
{
|
||||
if (index == 0)
|
||||
return current;
|
||||
index--;
|
||||
}
|
||||
#if EFI_UNIT_TEST
|
||||
firmwareError(OBD_PCM_Processor_Fault, "getForUnitText: null");
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AngleBasedEvent * EngineTestHelper::assertTriggerEvent(const char *msg,
|
||||
int index, AngleBasedEvent *expected,
|
||||
void *callback,
|
||||
int triggerEventIndex, angle_t angleOffsetFromTriggerEvent) {
|
||||
AngleBasedEvent * event = getElementAtIndexForUnitText(index, &engine);
|
||||
|
||||
assertEqualsM4(msg, " callback up/down", (void*)event->action.getCallback() == (void*) callback, 1);
|
||||
|
||||
assertEqualsM4(msg, " trigger", triggerEventIndex, event->position.triggerEventIndex);
|
||||
assertEqualsM4(msg, " angle", angleOffsetFromTriggerEvent, event->position.angleOffsetFromTriggerEvent);
|
||||
return event;
|
||||
}
|
||||
|
||||
scheduling_s * EngineTestHelper::assertScheduling(const char *msg, int index, scheduling_s *expected, void *callback, efitime_t expectedTimestamp) {
|
||||
scheduling_s * actual = assertEvent5(msg, index, callback, expectedTimestamp);
|
||||
return actual;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* @file engine_test_helper.h
|
||||
*
|
||||
* @date Jun 26, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
#ifndef ENGINE_TEST_HELPER_H_
|
||||
#define ENGINE_TEST_HELPER_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "engine.h"
|
||||
#include "trigger_central.h"
|
||||
|
@ -48,6 +48,9 @@ public:
|
|||
|
||||
scheduling_s * assertEvent5(const char *msg, int index, void *callback, efitime_t expectedTimestamp);
|
||||
scheduling_s * assertScheduling(const char *msg, int index, scheduling_s *expected, void *callback, efitime_t expectedTimestamp);
|
||||
|
||||
AngleBasedEvent * assertTriggerEvent(const char *msg, int index, AngleBasedEvent *expected, void *callback, int triggerEventIndex, angle_t angleOffsetFromTriggerEvent);
|
||||
|
||||
void assertEvent(const char *msg, int index, void *callback, efitime_t momentX, InjectionEvent *event);
|
||||
void assertInjectorUpEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex);
|
||||
void assertInjectorDownEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex);
|
||||
|
@ -63,9 +66,5 @@ public:
|
|||
persistent_config_s persistentConfig;
|
||||
};
|
||||
|
||||
|
||||
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injMode = IM_BATCH);
|
||||
void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e injectionMode,
|
||||
trigger_type_e trigger);
|
||||
|
||||
#endif /* ENGINE_TEST_HELPER_H_ */
|
||||
void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e injectionMode, trigger_type_e trigger);
|
||||
|
|
|
@ -30,7 +30,7 @@ int TestExecutor::size() {
|
|||
}
|
||||
|
||||
scheduling_s* TestExecutor::getForUnitTest(int index) {
|
||||
return schedulingQueue.getForUnitText(index);
|
||||
return schedulingQueue.getElementAtIndexForUnitText(index);
|
||||
}
|
||||
|
||||
void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) {
|
||||
|
|
Loading…
Reference in New Issue