more googletest to unit tests
This commit is contained in:
rusefi 2019-02-28 20:31:48 -05:00
parent d1753b4860
commit ec6bde7c26
3 changed files with 6 additions and 8 deletions

View File

@ -68,7 +68,7 @@ TEST(misc, testFuelMap) {
printf("*************************************************** getRunningFuel 1\r\n");
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
float baseFuel = getBaseTableFuel(5, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
assertEqualsM("base fuel", 5.3679, getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX));
ASSERT_NEAR(5.3679, getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX), EPS4D) << "base fuel";
printf("*************************************************** setting IAT table\r\n");
for (int i = 0; i < IAT_CURVE_SIZE; i++) {

View File

@ -9,8 +9,6 @@
#include "maf2map.h"
#define round_2d(x) efiRound(x, 0.01)
// todo: this should be improved to use relative 6 digit precision not just digits after decimal point
#define ASSERT_FLOAT_EQ(x, y) ASSERT_DOUBLE_EQ(round_2d(x), round_2d(y))
TEST(maf2map, util) {

View File

@ -179,13 +179,13 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
IgnitionEventList *ecl = &engine->ignitionEvents;
ASSERT_EQ( 1, ecl->isReady) << "ford inline ignition events size";
ASSERT_EQ( 0, ecl->elements[0].dwellPosition.eventIndex) << "event index";
assertEqualsM("angle offset#1", 7.8621, ecl->elements[0].dwellPosition.angleOffset);
ASSERT_NEAR(7.8621, ecl->elements[0].dwellPosition.angleOffset, EPS4D) << "angle offset#1";
ASSERT_EQ( 10, ecl->elements[5].dwellPosition.eventIndex) << "event index";
assertEqualsM("angle offset#2", 7.8621, ecl->elements[5].dwellPosition.angleOffset);
ASSERT_NEAR(7.8621, ecl->elements[5].dwellPosition.angleOffset, EPS4D) << "angle offset#2";
assertEqualsM("running dwell", 0.5, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX));
ASSERT_FLOAT_EQ(0.5, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell";
}
TEST(misc, testFordAspire) {
@ -709,7 +709,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 25);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("fuel#2", 12.5, engine->injectionDuration);
ASSERT_FLOAT_EQ(12.5, engine->injectionDuration) << "fuel#2_0";
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
@ -993,7 +993,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 35);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("Lfuel#2", 17.5, engine->injectionDuration);
ASSERT_FLOAT_EQ(17.5, engine->injectionDuration) << "Lfuel#2_1";
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));