2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file main.cpp
|
|
|
|
* @file First step towards unit-testing rusEfi algorithms
|
|
|
|
*
|
2018-07-28 09:42:37 -07:00
|
|
|
* @author Andrey Belomutskiy (c) 2012-2018
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2017-01-02 12:03:26 -08:00
|
|
|
|
2018-09-16 20:10:06 -07:00
|
|
|
#include <stdlib.h>
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-09-16 19:39:46 -07:00
|
|
|
#include "global.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
#include "test_interpolation_3d.h"
|
|
|
|
#include "test_find_index.h"
|
|
|
|
|
|
|
|
#include "engine_configuration.h"
|
|
|
|
|
|
|
|
#include "test_idle_controller.h"
|
2018-01-20 21:12:50 -08:00
|
|
|
#include "afm2mapConverter.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
#include "test_signal_executor.h"
|
|
|
|
#include "trigger_central.h"
|
|
|
|
#include "map_resize.h"
|
|
|
|
#include "engine_math.h"
|
|
|
|
#include "test_trigger_decoder.h"
|
2019-01-03 17:14:23 -08:00
|
|
|
#include "gtest/gtest.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2016-08-29 20:02:15 -07:00
|
|
|
typedef int32_t msg_t;
|
|
|
|
|
2018-01-23 18:56:26 -08:00
|
|
|
#include "hal_streams.h"
|
2016-08-29 20:02:15 -07:00
|
|
|
#include "memstreams.h"
|
|
|
|
|
2018-03-04 13:30:03 -08:00
|
|
|
int timeNowUs = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
efitimeus_t getTimeNowUs(void) {
|
2018-03-04 13:30:03 -08:00
|
|
|
return timeNowUs;
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
efitick_t getTimeNowNt(void) {
|
|
|
|
return getTimeNowUs() * US_TO_NT_MULTIPLIER;
|
|
|
|
}
|
|
|
|
|
2018-03-04 18:32:48 -08:00
|
|
|
LoggingWithStorage sharedLogger("main");
|
|
|
|
|
2016-09-04 22:03:25 -07:00
|
|
|
extern int revolutionCounterSinceBootForUnitTest;
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
int getRevolutionCounter(void) {
|
2016-09-04 22:03:25 -07:00
|
|
|
return revolutionCounterSinceBootForUnitTest;
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
2017-03-03 21:23:31 -08:00
|
|
|
extern bool printTriggerDebug;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-01-03 17:14:23 -08:00
|
|
|
GTEST_API_ int main(int argc, char **argv) {
|
2017-03-03 21:23:31 -08:00
|
|
|
// printTriggerDebug = true;
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
// resizeMap();
|
2019-01-03 04:57:34 -08:00
|
|
|
printf("Success 20190103\r\n");
|
2015-07-10 06:01:56 -07:00
|
|
|
printAllTriggers();
|
2018-01-20 21:12:50 -08:00
|
|
|
// printConvertedTable();
|
2019-01-03 17:14:23 -08:00
|
|
|
testing::InitGoogleTest(&argc, argv);
|
2019-01-08 18:40:21 -08:00
|
|
|
// uncomment if you only want to run selected tests
|
2019-01-14 05:57:08 -08:00
|
|
|
//::testing::GTEST_FLAG(filter) = "*testFasterEngineSpinningUp*";
|
2019-01-03 17:14:23 -08:00
|
|
|
return RUN_ALL_TESTS();
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void print(const char *format, ...) {
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, format);
|
|
|
|
vprintf(format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void initLogging(LoggingWithStorage *logging, const char *name) {
|
|
|
|
}
|
|
|
|
|
2016-10-31 18:02:36 -07:00
|
|
|
void scheduleMsg(Logging *logging, const char *format, ...) {
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, format);
|
|
|
|
vprintf(format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
printf("\r\n");
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|