Various fixes for gtests that were shown when running tests in random… (#3978)

* Various fixes for gtests that were shown when running tests in random sequence. Enabled random gtests shuffling in commit tests.

* 9X gtests fixes

* more gtests fixes

* even more gtests fixes

* Another round of gtests fixes

* Code deduplication with test fixtures

* More fixtures
This commit is contained in:
Damjan Adamic
2016-11-02 22:03:44 +01:00
committed by Bertrand Songis
parent dfc81cecad
commit d2144001d1
6 changed files with 137 additions and 136 deletions
+16
View File
@@ -33,6 +33,8 @@ void displayVoltagesScreen();
#if defined(TELEMETRY_FRSKY) && !defined(CPUARM)
TEST(FrSky, gpsNfuel)
{
MODEL_RESET();
TELEMETRY_RESET();
g_model.frsky.usrProto = 1;
telemetryData.hub.gpsFix = 1;
@@ -62,6 +64,11 @@ TEST(FrSky, gpsNfuel)
TEST(FrSky, dateNtime)
{
MODEL_RESET();
TELEMETRY_RESET();
g_model.frsky.usrProto = 1;
telemetryData.hub.gpsFix = 1;
uint8_t pkt1[] = { 0xfd, 0x07, 0x00, 0x5e, 0x15, 0x0f, 0x07, 0x5e, 0x16, 0x0b };
uint8_t pkt2[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x17, 0x06, 0x12, 0x5e, 0x18 };
uint8_t pkt3[] = { 0xfd, 0x03, 0x00, 0x32, 0x00, 0x5e };
@@ -178,6 +185,8 @@ TEST(FrSky, Gps)
{
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
EXPECT_EQ(telemetryItems[0].value, 0);
// latitude 15 degrees north, 30.5000 minutes = 15.508333333333333 degrees
@@ -240,6 +249,8 @@ TEST(FrSkySPORT, FrSkyDCells)
{
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
uint8_t pkt1[] = { 0x7E, 0x98, 0x10, 0x06, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x12 };
EXPECT_EQ(checkSportPacket(pkt1+1), true);
sportProcessTelemetryPacket(pkt1+1);
@@ -266,6 +277,7 @@ TEST(FrSkySPORT, frskySetCellVoltage)
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
// test that simulates 3 cell battery
generateSportCellPacket(packet, 3, 0, _V(410), _V(420)); sportProcessTelemetryPacket(packet);
@@ -360,6 +372,7 @@ TEST(FrSkySPORT, StrangeCellsBug)
{
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
uint8_t pkt[] = { 0x7E, 0x48, 0x10, 0x00, 0x03, 0x30, 0x15, 0x50, 0x81, 0xD5 };
EXPECT_EQ(checkSportPacket(pkt+1), true);
@@ -375,6 +388,7 @@ TEST(FrSkySPORT, frskySetCellVoltageTwoSensors)
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
//sensor 1: 3 cell battery
generateSportCellPacket(packet, 3, 0, _V(418), _V(416)); sportProcessTelemetryPacket(packet);
@@ -449,6 +463,7 @@ TEST(FrSkySPORT, frskyVfas)
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
// tests for Vfas
generateSportFasVoltagePacket(packet, 5000); sportProcessTelemetryPacket(packet);
@@ -487,6 +502,7 @@ TEST(FrSkySPORT, frskyCurrent)
MODEL_RESET();
TELEMETRY_RESET();
allowNewSensors = true;
// tests for Curr
generateSportFasCurrentPacket(packet, 0); sportProcessTelemetryPacket(packet);