Fix some of the broken tables tests
This commit is contained in:
parent
27630dfaf0
commit
efb84d4449
|
@ -33,23 +33,24 @@ void setup_FuelTable(void)
|
||||||
int tempYAxis[16] = {100, 96, 90, 86, 76, 70, 66, 60, 56, 50, 46, 40, 36, 30, 26, 16};
|
int tempYAxis[16] = {100, 96, 90, 86, 76, 70, 66, 60, 56, 50, 46, 40, 36, 30, 26, 16};
|
||||||
for (byte x = 0; x< fuelTable.ySize; x++) { fuelTable.axisY[x] = tempYAxis[x]; }
|
for (byte x = 0; x< fuelTable.ySize; x++) { fuelTable.axisY[x] = tempYAxis[x]; }
|
||||||
|
|
||||||
//Go through the 8 rows and add the column values
|
|
||||||
byte tempRow1[16] = {109, 111, 112, 113, 114, 114, 114, 115, 115, 115, 114, 114, 113, 112, 111, 111};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[0][x] = pgm_read_byte_near(tempRow1 + x); }
|
||||||
byte tempRow2[16] = {104, 106, 107, 108, 109, 109, 110, 110, 110, 110, 110, 109, 108, 107, 107, 106};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[1][x] = pgm_read_byte_near(tempRow2 + x); }
|
||||||
byte tempRow3[16] = {98, 101, 103, 103, 104, 105, 105, 105, 105, 105, 105, 104, 104, 103, 102, 102};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[2][x] = pgm_read_byte_near(tempRow3 + x); }
|
||||||
byte tempRow4[16] = {93, 96, 98, 99, 99, 100, 100, 101, 101, 101, 100, 100, 99, 98, 98, 97};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[3][x] = pgm_read_byte_near(tempRow4 + x);}
|
||||||
byte tempRow5[16] = {81, 86, 88, 89, 90, 91, 91, 91, 91, 91, 91, 90, 90, 89, 89, 88};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[4][x] = pgm_read_byte_near(tempRow5 + x); }
|
||||||
byte tempRow6[16] = {74, 80, 83, 84, 85, 86, 86, 86, 87, 86, 86, 86, 85, 84, 84, 84};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[5][x] = pgm_read_byte_near(tempRow6 + x); }
|
||||||
byte tempRow7[16] = {68, 75, 78, 79, 81, 81, 81, 82, 82, 82, 82, 81, 81, 80, 79, 79};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[6][x] = pgm_read_byte_near(tempRow7 + x); }
|
||||||
byte tempRow8[16] = {61, 69, 72, 74, 76, 76, 77, 77, 77, 77, 77, 76, 76, 75, 75, 74};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[7][x] = pgm_read_byte_near(tempRow8 + x); }
|
||||||
byte tempRow9[16] = {54, 62, 66, 69, 71, 71, 72, 72, 72, 72, 72, 72, 71, 71, 70, 70};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[8][x] = pgm_read_byte_near(tempRow9 + x); }
|
||||||
byte tempRow10[16] = {48, 56, 60, 64, 66, 66, 68, 68, 68, 68, 67, 67, 67, 66, 66, 65};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[9][x] = pgm_read_byte_near(tempRow10 + x); }
|
||||||
byte tempRow11[16] = {42, 49, 54, 58, 61, 62, 62, 63, 63, 63, 63, 62, 62, 61, 61, 61};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[10][x] = pgm_read_byte_near(tempRow11 + x); }
|
||||||
byte tempRow12[16] = {38, 43, 48, 52, 55, 56, 57, 58, 58, 58, 58, 58, 57, 57, 57, 56};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[11][x] = pgm_read_byte_near(tempRow12 + x); }
|
||||||
byte tempRow13[16] = {36, 39, 42, 46, 50, 51, 52, 53, 53, 53, 53, 53, 53, 52, 52, 52};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[12][x] = pgm_read_byte_near(tempRow13 + x); }
|
||||||
byte tempRow14[16] = {35, 36, 38, 41, 44, 46, 47, 48, 48, 49, 48, 48, 48, 48, 47, 47};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[13][x] = pgm_read_byte_near(tempRow14 + x); }
|
||||||
byte tempRow15[16] = {34, 35, 36, 37, 39, 41, 42, 43, 43, 44, 44, 44, 43, 43, 43, 43};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[14][x] = pgm_read_byte_near(tempRow15 + x); }
|
||||||
byte tempRow16[16] = {34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, 34, 34};
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[15][x] = pgm_read_byte_near(tempRow16 + x); }
|
||||||
|
/*
|
||||||
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[0][x] = tempRow1[x]; }
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[0][x] = tempRow1[x]; }
|
||||||
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[1][x] = tempRow2[x]; }
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[1][x] = tempRow2[x]; }
|
||||||
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[2][x] = tempRow3[x]; }
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[2][x] = tempRow3[x]; }
|
||||||
|
@ -66,6 +67,7 @@ void setup_FuelTable(void)
|
||||||
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[13][x] = tempRow14[x]; }
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[13][x] = tempRow14[x]; }
|
||||||
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[14][x] = tempRow15[x]; }
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[14][x] = tempRow15[x]; }
|
||||||
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[15][x] = tempRow16[x]; }
|
for (byte x = 0; x< fuelTable.xSize; x++) { fuelTable.values[15][x] = tempRow16[x]; }
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +80,14 @@ void testTables()
|
||||||
RUN_TEST(test_tableLookup_overMaxY);
|
RUN_TEST(test_tableLookup_overMaxY);
|
||||||
RUN_TEST(test_tableLookup_underMinX);
|
RUN_TEST(test_tableLookup_underMinX);
|
||||||
RUN_TEST(test_tableLookup_underMinY);
|
RUN_TEST(test_tableLookup_underMinY);
|
||||||
|
//RUN_TEST(test_all_incrementing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_tableLookup_50pct(void)
|
void test_tableLookup_50pct(void)
|
||||||
{
|
{
|
||||||
//Tests a lookup that is exactly 50% of the way between cells on both the X and Y axis
|
//Tests a lookup that is exactly 50% of the way between cells on both the X and Y axis
|
||||||
initialiseAll(); //Run the main initialise function
|
//initialiseAll(); //Run the main initialise function
|
||||||
setup_FuelTable();
|
setup_FuelTable();
|
||||||
|
|
||||||
currentStatus.RPM = 2250;
|
currentStatus.RPM = 2250;
|
||||||
|
@ -170,3 +174,22 @@ void test_tableLookup_underMinY(void)
|
||||||
uint16_t tempVE = get3DTableValue(&fuelTable, currentStatus.fuelLoad, currentStatus.RPM); //Perform lookup into fuel map for RPM vs MAP value
|
uint16_t tempVE = get3DTableValue(&fuelTable, currentStatus.fuelLoad, currentStatus.RPM); //Perform lookup into fuel map for RPM vs MAP value
|
||||||
TEST_ASSERT_EQUAL(tempVE, 34);
|
TEST_ASSERT_EQUAL(tempVE, 34);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_all_incrementing(void)
|
||||||
|
{
|
||||||
|
//Test the when going up both the load and RPM axis that the returned value is always equal or higher to the previous one
|
||||||
|
//Tests all combinations of load/rpm from between 0-200 load and 0-9000 rpm
|
||||||
|
//WARNING: This can take a LONG time to run. It is disabled by default for this reason
|
||||||
|
uint16_t tempVE = 0;
|
||||||
|
|
||||||
|
for(uint16_t rpm = 0; rpm<8000; rpm+=100)
|
||||||
|
{
|
||||||
|
tempVE = 0;
|
||||||
|
for(uint8_t load = 0; load<120; load++)
|
||||||
|
{
|
||||||
|
uint16_t newVE = get3DTableValue(&fuelTable, load, rpm);
|
||||||
|
TEST_ASSERT_GREATER_OR_EQUAL(tempVE, newVE);
|
||||||
|
tempVE = newVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,3 +7,22 @@ void test_tableLookup_overMaxX(void);
|
||||||
void test_tableLookup_overMaxY(void);
|
void test_tableLookup_overMaxY(void);
|
||||||
void test_tableLookup_underMinX(void);
|
void test_tableLookup_underMinX(void);
|
||||||
void test_tableLookup_underMinY(void);
|
void test_tableLookup_underMinY(void);
|
||||||
|
void test_all_incrementing(void);
|
||||||
|
|
||||||
|
//Go through the 8 rows and add the column values
|
||||||
|
const PROGMEM byte tempRow1[16] = {109, 111, 112, 113, 114, 114, 114, 115, 115, 115, 114, 114, 113, 112, 111, 111};
|
||||||
|
const PROGMEM byte tempRow2[16] = {104, 106, 107, 108, 109, 109, 110, 110, 110, 110, 110, 109, 108, 107, 107, 106};
|
||||||
|
const PROGMEM byte tempRow3[16] = {98, 101, 103, 103, 104, 105, 105, 105, 105, 105, 105, 104, 104, 103, 102, 102};
|
||||||
|
const PROGMEM byte tempRow4[16] = {93, 96, 98, 99, 99, 100, 100, 101, 101, 101, 100, 100, 99, 98, 98, 97};
|
||||||
|
const PROGMEM byte tempRow5[16] = {81, 86, 88, 89, 90, 91, 91, 91, 91, 91, 91, 90, 90, 89, 89, 88};
|
||||||
|
const PROGMEM byte tempRow6[16] = {74, 80, 83, 84, 85, 86, 86, 86, 87, 86, 86, 86, 85, 84, 84, 84};
|
||||||
|
const PROGMEM byte tempRow7[16] = {68, 75, 78, 79, 81, 81, 81, 82, 82, 82, 82, 81, 81, 80, 79, 79};
|
||||||
|
const PROGMEM byte tempRow8[16] = {61, 69, 72, 74, 76, 76, 77, 77, 77, 77, 77, 76, 76, 75, 75, 74};
|
||||||
|
const PROGMEM byte tempRow9[16] = {54, 62, 66, 69, 71, 71, 72, 72, 72, 72, 72, 72, 71, 71, 70, 70};
|
||||||
|
const PROGMEM byte tempRow10[16] = {48, 56, 60, 64, 66, 66, 68, 68, 68, 68, 67, 67, 67, 66, 66, 65};
|
||||||
|
const PROGMEM byte tempRow11[16] = {42, 49, 54, 58, 61, 62, 62, 63, 63, 63, 63, 62, 62, 61, 61, 61};
|
||||||
|
const PROGMEM byte tempRow12[16] = {38, 43, 48, 52, 55, 56, 57, 58, 58, 58, 58, 58, 57, 57, 57, 56};
|
||||||
|
const PROGMEM byte tempRow13[16] = {36, 39, 42, 46, 50, 51, 52, 53, 53, 53, 53, 53, 53, 52, 52, 52};
|
||||||
|
const PROGMEM byte tempRow14[16] = {35, 36, 38, 41, 44, 46, 47, 48, 48, 49, 48, 48, 48, 48, 47, 47};
|
||||||
|
const PROGMEM byte tempRow15[16] = {34, 35, 36, 37, 39, 41, 42, 43, 43, 44, 44, 44, 43, 43, 43, 43};
|
||||||
|
const PROGMEM byte tempRow16[16] = {34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, 34, 34};
|
Loading…
Reference in New Issue