rusefi-1/unit_tests/main.cpp

140 lines
2.7 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_sensors.h"
#include "test_speed_density.h"
#include "test_fuel_map.h"
#include "fuel_math.h"
#include "test_fuelCut.h"
2015-07-10 06:01:56 -07:00
#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"
2018-03-04 13:13:23 -08:00
#include "test_startOfCrankingPrimingPulse.h"
#include "test_fasterEngineSpinningUp.h"
2015-07-10 06:01:56 -07:00
#include "test_util.h"
#include "map_resize.h"
#include "engine_math.h"
#include "test_engine_math.h"
#include "test_trigger_decoder.h"
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
int main(void) {
2017-03-03 21:23:31 -08:00
// printTriggerDebug = true;
2017-11-06 19:33:06 -08:00
testDifferentInjectionModes();
2017-09-14 18:00:28 -07:00
testPidAutoZigZag();
2016-11-07 19:02:21 -08:00
testMissedSpark299();
2016-10-31 18:02:36 -07:00
testSparkReverseOrderBug319();
2016-09-03 10:02:55 -07:00
testFuelSchedulerBug299smallAndLarge();
2016-09-03 11:01:47 -07:00
testFuelSchedulerBug299smallAndMedium();
2017-06-25 22:49:11 -07:00
testLogicExpressions(); // fsio
2015-07-10 06:01:56 -07:00
testOverflow64Counter();
testInterpolate3d();
testFindIndex();
2018-03-04 13:13:23 -08:00
testPlainCrankingWithoutAdvancedFeatures();
testStartOfCrankingPrimingPulse();
testFasterEngineSpinningUp();
2015-07-10 06:01:56 -07:00
testInterpolate2d();
testGpsParser();
testMisc();
testFuelMap();
testFuelCut();
2015-07-10 06:01:56 -07:00
testEngineMath();
testIgnitionPlanning();
testSensors();
testCyclicBuffer();
testCrc();
testSignalExecutor();
testHistogram();
testMalfunctionCentral();
testConsoleLogic();
testAngleResolver();
testPinHelper();
testSetTableValue();
testAccelEnrichment();
testSpeedDensity();
testFLStack();
testMenuTree();
testMafLookup();
2015-12-24 11:02:03 -08:00
testIgnitionMapGenerator();
2015-07-10 06:01:56 -07:00
testMafFuelMath();
testPidController();
testTriggerDecoder();
// resizeMap();
2018-01-20 21:12:50 -08:00
printf("Success 20180120\r\n");
2015-07-10 06:01:56 -07:00
printAllTriggers();
2018-01-20 21:12:50 -08:00
// printConvertedTable();
2015-07-10 06:01:56 -07:00
return EXIT_SUCCESS;
}
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
}