new unit test
This commit is contained in:
parent
58610c565a
commit
5301037f61
|
@ -27,15 +27,13 @@
|
|||
#include "global.h"
|
||||
#include "status_loop.h"
|
||||
#include "HIP9011_logic.h"
|
||||
#include "engine_controller.h"
|
||||
|
||||
#include "adc_inputs.h"
|
||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
||||
#include "wave_analyzer.h"
|
||||
#endif /* EFI_WAVE_ANALYZER */
|
||||
|
||||
// see RUS_EFI_VERSION_TAG in console source code
|
||||
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
|
||||
|
||||
#include "trigger_central.h"
|
||||
#include "engine_state.h"
|
||||
#include "io_pins.h"
|
||||
|
@ -394,11 +392,8 @@ void printOverallStatus(systime_t nowSeconds) {
|
|||
return;
|
||||
}
|
||||
timeOfPreviousPrintVersion = nowSeconds;
|
||||
appendPrintf(&logger, "%s%s%d@%s %s %d%s", RUS_EFI_VERSION_TAG, DELIMETER,
|
||||
getRusEfiVersion(), VCS_VERSION,
|
||||
getConfigurationName(engineConfiguration->engineType),
|
||||
getTimeNowSeconds(),
|
||||
DELIMETER);
|
||||
int seconds = getTimeNowSeconds();
|
||||
printCurrentState(&logger, seconds, getConfigurationName(engineConfiguration->engineType));
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
printOutPin(CRANK1, CONFIGB(triggerInputPins)[0]);
|
||||
printOutPin(CRANK2, CONFIGB(triggerInputPins)[1]);
|
||||
|
|
|
@ -19,4 +19,7 @@ bool getFullLog(void);
|
|||
void setFullLog(int value);
|
||||
void printOverallStatus(systime_t nowSeconds);
|
||||
|
||||
// see RUS_EFI_VERSION_TAG in console source code
|
||||
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
|
||||
|
||||
#endif /* CONSOLE_LOOP_H_ */
|
||||
|
|
|
@ -15,6 +15,13 @@
|
|||
#include "engine_math.h"
|
||||
#include "advance_map.h"
|
||||
#include "aux_valves.h"
|
||||
#if EFI_PROD_CODE
|
||||
#include "svnversion.h"
|
||||
#endif
|
||||
|
||||
#if ! EFI_UNIT_TEST
|
||||
#include "status_loop.h"
|
||||
#endif
|
||||
|
||||
extern fuel_Map3D_t veMap;
|
||||
extern afr_Map3D_t afrMap;
|
||||
|
@ -288,4 +295,15 @@ void StartupFuelPumping::update(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
}
|
||||
|
||||
#if EFI_SIMULATOR
|
||||
#define VCS_VERSION "123"
|
||||
#endif
|
||||
|
||||
void printCurrentState(Logging *logging, int seconds, const char *name) {
|
||||
logging->appendPrintf("%s%s%d@%s %s %d%s", RUS_EFI_VERSION_TAG, DELIMETER,
|
||||
getRusEfiVersion(), VCS_VERSION,
|
||||
name,
|
||||
seconds,
|
||||
DELIMETER);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,4 +35,6 @@ void setMockMafVoltage(float voltage);
|
|||
void setMockIatVoltage(float voltage);
|
||||
void setMockCltVoltage(float voltage);
|
||||
|
||||
void printCurrentState(Logging *logging, int seconds, const char *name);
|
||||
|
||||
#endif /* ENGINE_STATUS_H_ */
|
||||
|
|
|
@ -275,6 +275,19 @@ void initIntermediateLoggingBuffer(void) {
|
|||
intermediateLoggingBufferInited = true;
|
||||
}
|
||||
|
||||
#else
|
||||
/* unit test implementations */
|
||||
void Logging::vappendPrintf(const char *fmt, va_list arg) {
|
||||
|
||||
}
|
||||
|
||||
void Logging::appendPrintf(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#endif /* ! EFI_UNIT_TEST */
|
||||
|
||||
void Logging::baseConstructor() {
|
||||
|
@ -293,6 +306,8 @@ Logging::Logging(char const *name, char *buffer, int bufferSize) {
|
|||
baseConstructor();
|
||||
#if ! EFI_UNIT_TEST
|
||||
initLoggingExt(name, buffer, bufferSize);
|
||||
#else
|
||||
this->buffer = buffer;
|
||||
#endif /* ! EFI_UNIT_TEST */
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ void print(const char *fmt, ...);
|
|||
|
||||
|
||||
#define US_TO_NT_MULTIPLIER 100
|
||||
#define VCS_VERSION "321"
|
||||
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
|
||||
|
||||
#define ALWAYS_INLINE INLINE
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "malfunction_central.h"
|
||||
#include "cli_registry.h"
|
||||
#include "unit_test_framework.h"
|
||||
#include "engine_controller.h"
|
||||
|
||||
#include "nmea.h"
|
||||
#include "efilib2.h"
|
||||
|
@ -486,5 +487,16 @@ void testMenuTree(void) {
|
|||
|
||||
tree.back();
|
||||
assertTrue(tree.current == &miTopLevel1);
|
||||
|
||||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 776655;
|
||||
}
|
||||
|
||||
TEST(util, datalogging) {
|
||||
char LOGGING_BUFFER[1000];
|
||||
Logging logger("settings control", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
|
||||
|
||||
printCurrentState(&logger, 239, "CUSTOM_ENGINE");
|
||||
ASSERT_STREQ("rusEfiVersion,776655@321 CUSTOM_ENGINE 239,", LOGGING_BUFFER);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue