rusefi-1/unit_tests/main.cpp

133 lines
2.4 KiB
C++
Raw Normal View History

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_accel_enrichment.h"
#include "test_interpolation_3d.h"
#include "test_find_index.h"
#include "test_speed_density.h"
#include "test_fuel_map.h"
#include "fuel_math.h"
#include "test_logic_expression.h"
2017-09-14 18:00:28 -07:00
#include "test_pid_auto.h"
2015-07-10 06:01:56 -07:00
#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 "test_util.h"
#include "map_resize.h"
#include "engine_math.h"
#include "test_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;
2018-11-25 19:20:57 -08:00
testMisc();
2018-12-08 08:08:41 -08:00
/**
* PID
*/
2018-12-01 08:36:05 -08:00
testPidAuto();
2019-01-08 19:10:54 -08:00
2017-06-25 22:49:11 -07:00
testLogicExpressions(); // fsio
2015-07-10 06:01:56 -07:00
testGpsParser();
testFuelMap();
testEngineMath();
testIgnitionPlanning();
2019-01-08 19:10:54 -08:00
2018-12-08 08:08:41 -08:00
/**
* Data structures and general methods
*/
testFindIndex();
testInterpolate3d();
testInterpolate2d();
testSetTableValue();
2019-01-06 04:37:29 -08:00
2018-12-08 08:08:41 -08:00
testFLStack();
2015-07-10 06:01:56 -07:00
testSignalExecutor();
2018-12-08 12:08:02 -08:00
testPwmGenerator();
2015-07-10 06:01:56 -07:00
2018-12-08 08:08:41 -08:00
/**
* Business logic tests
*/
2015-07-10 06:01:56 -07:00
testMalfunctionCentral();
testConsoleLogic();
testAngleResolver();
testPinHelper();
testMenuTree();
testMafLookup();
2015-12-24 11:02:03 -08:00
testIgnitionMapGenerator();
2015-07-10 06:01:56 -07:00
testMafFuelMath();
testTriggerDecoder();
2019-01-03 17:14:23 -08:00
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
//::testing::GTEST_FLAG(filter) = "hip*";
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
}