migrating to googletest
This commit is contained in:
parent
05181cd837
commit
6c62f2e25f
|
@ -12,7 +12,7 @@
|
|||
|
||||
static void testIndex(const int expected, const float array[], int size, float value) {
|
||||
ASSERT_EQ(expected, findIndex(array, size, value));
|
||||
assertEquals(expected, findIndex2(array, size, value));
|
||||
ASSERT_EQ(expected, findIndex2(array, size, value));
|
||||
}
|
||||
|
||||
TEST(misc, testFindIndex) {
|
||||
|
@ -77,19 +77,19 @@ TEST(misc, testInterpolate2d) {
|
|||
|
||||
printf("Left size\r\n");
|
||||
result = interpolate2d("t", 0, bins4, values4, size);
|
||||
assertEquals(1, result);
|
||||
ASSERT_EQ(1, result);
|
||||
|
||||
printf("Right size\r\n");
|
||||
result = interpolate2d("t", 10, bins4, values4, size);
|
||||
assertEquals(400, result);
|
||||
ASSERT_EQ(400, result);
|
||||
|
||||
printf("Middle1\r\n");
|
||||
result = interpolate2d("t", 3, bins4, values4, size);
|
||||
assertEquals(30, result);
|
||||
ASSERT_EQ(30, result);
|
||||
|
||||
printf("Middle1\r\n");
|
||||
result = interpolate2d("t", 3.5, bins4, values4, size);
|
||||
assertEquals(215, result);
|
||||
ASSERT_EQ(215, result);
|
||||
}
|
||||
|
||||
TEST(misc, testSetTableValue) {
|
||||
|
@ -102,7 +102,7 @@ TEST(misc, testSetTableValue) {
|
|||
config.cltFuelCorr[i] = 1;
|
||||
}
|
||||
|
||||
assertEquals(1, config.cltFuelCorr[0]);
|
||||
ASSERT_EQ(1, config.cltFuelCorr[0]);
|
||||
|
||||
setCurveValue(config.cltFuelCorrBins, config.cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
|
||||
assertEquals(1.5, config.cltFuelCorr[0]);
|
||||
|
|
|
@ -40,11 +40,11 @@ static void newTestToComfirmInterpolation() {
|
|||
|
||||
|
||||
// let's start by testing corners
|
||||
assertEquals(3, getValue(/*rpm*/200, 2));
|
||||
ASSERT_EQ(3, getValue(/*rpm*/200, 2));
|
||||
assertEqualsM("low rpm high load", 4, getValue(/*rpm*/200, 3));
|
||||
|
||||
assertEquals(10, getValue(/*rpm*/300, 2));
|
||||
assertEquals(200, getValue(/*rpm*/300, 3));
|
||||
ASSERT_EQ(10, getValue(/*rpm*/300, 2));
|
||||
ASSERT_EQ(200, getValue(/*rpm*/300, 3));
|
||||
|
||||
// now testing middles of cell sides
|
||||
assertEqualsM("low rpm middle", 3.5, getValue(/*rpm*/200, 2.5));
|
||||
|
@ -83,32 +83,32 @@ TEST(misc, testInterpolate3d) {
|
|||
printf("*************************************************** testInterpolate3d\r\n");
|
||||
|
||||
printf("*** no interpolation here 1\r\n");
|
||||
assertEquals(2, getValue(100, 2));
|
||||
ASSERT_FLOAT_EQ(2, getValue(100, 2));
|
||||
|
||||
printf("*** no interpolation here 2\r\n");
|
||||
assertEquals(5, getValue(200, 4));
|
||||
ASSERT_FLOAT_EQ(5, getValue(200, 4));
|
||||
|
||||
printf("*** rpm interpolated value expected1\r\n");
|
||||
assertEquals(2.5, getValue(150, 2));
|
||||
ASSERT_FLOAT_EQ(2.5, getValue(150, 2));
|
||||
|
||||
printf("*** rpm interpolated value expected2\r\n");
|
||||
assertEquals(102, getValue(250, 3));
|
||||
ASSERT_FLOAT_EQ(102, getValue(250, 3));
|
||||
|
||||
printf("*** both rpm and maf interpolated value expected\r\n");
|
||||
assertEquals(361, getValue(335.3, 3.551));
|
||||
ASSERT_FLOAT_EQ(361, getValue(335.3, 3.551));
|
||||
|
||||
printf("*** both rpm and maf interpolated value expected 2\r\n");
|
||||
assertEquals(203.6, getValue(410.01, 2.012));
|
||||
ASSERT_FLOAT_EQ(203.6, getValue(410.01, 2.012));
|
||||
|
||||
printf("*** both rpm and maf interpolated value expected 3\r\n");
|
||||
assertEquals(600, getValue(1000000, 1000));
|
||||
ASSERT_FLOAT_EQ(600, getValue(1000000, 1000));
|
||||
|
||||
printf("*** both rpm and maf interpolated value expected 4\r\n");
|
||||
|
||||
assertEquals(4, getValue(410.01, -1));
|
||||
ASSERT_FLOAT_EQ(4, getValue(410.01, -1));
|
||||
|
||||
|
||||
assertEquals(1, getValue(-1, -1));
|
||||
ASSERT_FLOAT_EQ(1, getValue(-1, -1));
|
||||
|
||||
newTestToComfirmInterpolation();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ TEST(misc, testIgnitionPlanning) {
|
|||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("testIgnitionPlanning_AFR", 13.5, eth.engine.engineState.targetAFR);
|
||||
|
||||
assertEquals(IM_BATCH, engineConfiguration->injectionMode);
|
||||
ASSERT_EQ(IM_BATCH, engineConfiguration->injectionMode);
|
||||
}
|
||||
|
||||
TEST(misc, testEngineMath) {
|
||||
|
@ -61,17 +61,17 @@ TEST(misc, testEngineMath) {
|
|||
TEST(misc, testIgnitionMapGenerator) {
|
||||
printf("*************************************************** testIgnitionMapGenerator\r\n");
|
||||
|
||||
assertEquals(35, getTopAdvanceForBore(CS_OPEN, 98, 8, 101.6));
|
||||
assertEquals(33, getTopAdvanceForBore(CS_OPEN, 98, 11, 101.6));
|
||||
ASSERT_EQ(35, getTopAdvanceForBore(CS_OPEN, 98, 8, 101.6));
|
||||
ASSERT_EQ(33, getTopAdvanceForBore(CS_OPEN, 98, 11, 101.6));
|
||||
|
||||
float rpmBin[16];
|
||||
setRpmBin(rpmBin, 16, 800, 7000);
|
||||
assertEquals(650, rpmBin[0]);
|
||||
ASSERT_EQ(650, rpmBin[0]);
|
||||
assertEqualsM("@1", 800, rpmBin[1]);
|
||||
assertEqualsM("@2", 1100, rpmBin[2]);
|
||||
assertEqualsM("rpm@3", 1400, rpmBin[3]);
|
||||
assertEqualsM("rpm@14", 4700, rpmBin[14]);
|
||||
assertEquals(7000, rpmBin[15]);
|
||||
ASSERT_EQ(7000, rpmBin[15]);
|
||||
|
||||
|
||||
assertEquals(22.0, getTopAdvanceForBore(CS_SWIRL_TUMBLE, 89, 9, 101.6));
|
||||
|
|
|
@ -87,7 +87,8 @@ TEST(misc, testFuelMap) {
|
|||
|
||||
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
assertEquals(NAN, getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
float iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_FALSE(cisnan(iat));
|
||||
float iatCorrection = getIatFuelCorrection(-KELV PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("IAT", 2, iatCorrection);
|
||||
engine->sensors.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -176,7 +177,7 @@ TEST(misc, testAngleResolver) {
|
|||
assertEqualsM("index 5", 412.76, ts->eventAngles[6]);
|
||||
assertEqualsM("time 5", 0.5733, ts->wave.getSwitchTime(5));
|
||||
|
||||
assertEquals(4, ts->getTriggerShapeSynchPointIndex());
|
||||
ASSERT_EQ(4, ts->getTriggerShapeSynchPointIndex());
|
||||
|
||||
assertEqualsM("shape size", 10, ts->getSize());
|
||||
|
||||
|
@ -199,17 +200,17 @@ TEST(misc, testAngleResolver) {
|
|||
|
||||
printf("*************************************************** testAngleResolver 0.3\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -53, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertEquals(2, injectionStart.eventIndex);
|
||||
ASSERT_EQ(2, injectionStart.eventIndex);
|
||||
assertEquals(69.24, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 1\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, 0, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertEquals(2, injectionStart.eventIndex);
|
||||
ASSERT_EQ(2, injectionStart.eventIndex);
|
||||
assertEquals(122.24, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 2\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, 56, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertEquals(2, injectionStart.eventIndex);
|
||||
ASSERT_EQ(2, injectionStart.eventIndex);
|
||||
assertEquals(178.24, injectionStart.angleOffset);
|
||||
|
||||
TriggerShape t;
|
||||
|
@ -218,9 +219,9 @@ TEST(misc, testAngleResolver) {
|
|||
|
||||
TEST(misc, testPinHelper) {
|
||||
printf("*************************************************** testPinHelper\r\n");
|
||||
assertEquals(0, getElectricalValue(0, OM_DEFAULT));
|
||||
assertEquals(1, getElectricalValue(1, OM_DEFAULT));
|
||||
ASSERT_EQ(0, getElectricalValue(0, OM_DEFAULT));
|
||||
ASSERT_EQ(1, getElectricalValue(1, OM_DEFAULT));
|
||||
|
||||
assertEquals(0, getElectricalValue(1, OM_INVERTED));
|
||||
assertEquals(1, getElectricalValue(0, OM_INVERTED));
|
||||
ASSERT_EQ(0, getElectricalValue(1, OM_INVERTED));
|
||||
ASSERT_EQ(1, getElectricalValue(0, OM_INVERTED));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue