rusefi/unit_tests/test-framework/test_executor.h

32 lines
704 B
C
Raw Normal View History

/*
2024-04-30 13:05:13 -07:00
* @file test_executor.h
2024-04-30 13:07:05 -07:00
* implementation of ExecutorInterface used by unit tests
*
* Created on: Jan 9, 2019
2020-01-07 21:02:40 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
*/
2020-04-01 18:32:21 -07:00
#pragma once
#include "scheduler.h"
#include "event_queue.h"
2024-07-11 17:03:13 -07:00
class TestExecutor : public Scheduler {
public:
2020-07-31 14:41:29 -07:00
~TestExecutor();
2024-07-11 17:03:13 -07:00
void schedule(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
void cancel(scheduling_s* scheduling) override;
void clear();
int executeAll(efitimeus_t nowUs);
int size();
scheduling_s * getHead();
scheduling_s * getForUnitTest(int index);
2024-07-11 17:03:13 -07:00
void setMockExecutor(Scheduler* exec);
private:
EventQueue schedulingQueue;
2024-07-11 17:03:13 -07:00
Scheduler* m_mockExecutor = nullptr;
};