improve test

This commit is contained in:
Matthew Kennedy 2020-07-23 01:24:02 -07:00
parent 5c156ebada
commit aeb5c8e8d6
1 changed files with 13 additions and 5 deletions

View File

@ -6,6 +6,7 @@
*/
#include "fuel_math.h"
#include "maf_airmass.h"
#include "trigger_structure.h"
#include "allsensors.h"
#include "engine_math.h"
@ -14,18 +15,25 @@
#include "efi_gpio.h"
#include "advance_map.h"
#include "sensor.h"
#include "mocks.h"
using ::testing::FloatNear;
TEST(misc, testMafFuelMath) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
extern fuel_Map3D_t veMap;
veMap.setAll(75);
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
engineConfiguration->injector.flow = 200;
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
EXPECT_NEAR(0.277777f * 0.75f, airmass.CylinderAirmass, EPS4D);