mirror of https://github.com/FOME-Tech/fome-fw.git
improve test
This commit is contained in:
parent
5c156ebada
commit
aeb5c8e8d6
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fuel_math.h"
|
#include "fuel_math.h"
|
||||||
|
#include "maf_airmass.h"
|
||||||
#include "trigger_structure.h"
|
#include "trigger_structure.h"
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
#include "engine_math.h"
|
#include "engine_math.h"
|
||||||
|
@ -14,18 +15,25 @@
|
||||||
#include "efi_gpio.h"
|
#include "efi_gpio.h"
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
|
#include "mocks.h"
|
||||||
|
|
||||||
|
using ::testing::FloatNear;
|
||||||
|
|
||||||
TEST(misc, testMafFuelMath) {
|
TEST(misc, testMafFuelMath) {
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||||
extern fuel_Map3D_t veMap;
|
|
||||||
veMap.setAll(75);
|
|
||||||
|
|
||||||
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
||||||
engineConfiguration->injector.flow = 200;
|
engineConfiguration->injector.flow = 200;
|
||||||
|
|
||||||
setAfrMap(config->afrTable, 13);
|
setAfrMap(config->afrTable, 13);
|
||||||
|
|
||||||
auto airmass = getRealMafAirmass(200, 6000 PASS_ENGINE_PARAMETER_SUFFIX);
|
MockVp3d veTable;
|
||||||
|
// Ensure that the correct cell is read from the VE table
|
||||||
|
EXPECT_CALL(veTable, getValue(6000, FloatNear(70.9814f, EPS4D)))
|
||||||
|
.WillOnce(Return(75.0f));
|
||||||
|
|
||||||
|
MafAirmass dut(veTable);
|
||||||
|
INJECT_ENGINE_REFERENCE(&dut);
|
||||||
|
|
||||||
|
auto airmass = dut.getAirmassImpl(200, 6000);
|
||||||
|
|
||||||
// Check results
|
// Check results
|
||||||
EXPECT_NEAR(0.277777f * 0.75f, airmass.CylinderAirmass, EPS4D);
|
EXPECT_NEAR(0.277777f * 0.75f, airmass.CylinderAirmass, EPS4D);
|
||||||
|
|
Loading…
Reference in New Issue