Removing noise from unit tests.
This commit is contained in:
parent
04faa36cb3
commit
60a95f1d22
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
//#define DEBUG_ALTITUDE_HOLD
|
||||
|
||||
#define BARO
|
||||
|
||||
extern "C" {
|
||||
|
@ -87,7 +89,9 @@ TEST(AltitudeHoldTest, IsThrustFacingDownwards)
|
|||
|
||||
for (uint8_t index = 0; index < testIterationCount; index ++) {
|
||||
inclinationExpectation_t *angleInclinationExpectation = &inclinationExpectations[index];
|
||||
#ifdef DEBUG_ALTITUDE_HOLD
|
||||
printf("iteration: %d\n", index);
|
||||
#endif
|
||||
bool result = isThrustFacingDownwards(&angleInclinationExpectation->inclination);
|
||||
EXPECT_EQ(angleInclinationExpectation->expectDownwardsThrust, result);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
//#define DEBUG_BATTERY
|
||||
|
||||
extern "C" {
|
||||
#include "sensors/battery.h"
|
||||
}
|
||||
|
@ -76,11 +78,12 @@ TEST(BatteryTest, BatteryADCToVoltage)
|
|||
for (uint8_t index = 0; index < testIterationCount; index ++) {
|
||||
batteryAdcToVoltageExpectation_t *batteryAdcToVoltageExpectation = &batteryAdcToVoltageExpectations[index];
|
||||
batteryConfig.vbatscale = batteryAdcToVoltageExpectation->scale;
|
||||
#ifdef DEBUG_BATTERY
|
||||
printf("adcReading: %d, vbatscale: %d\n",
|
||||
batteryAdcToVoltageExpectation->adcReading,
|
||||
batteryAdcToVoltageExpectation->scale
|
||||
);
|
||||
|
||||
#endif
|
||||
uint16_t pointOneVoltSteps = batteryAdcToVoltage(batteryAdcToVoltageExpectation->adcReading);
|
||||
|
||||
EXPECT_EQ(pointOneVoltSteps, batteryAdcToVoltageExpectation->expectedVoltageInDeciVoltSteps);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
//#ifdef DEBUG_GPS_CONVERSION
|
||||
|
||||
extern "C" {
|
||||
#include "flight/gps_conversion.h"
|
||||
}
|
||||
|
@ -63,8 +65,9 @@ TEST(GpsConversionTest, GPSCoordToDegrees_NMEA_Values)
|
|||
|
||||
for (uint8_t index = 0; index < testIterationCount; index ++) {
|
||||
const gpsConversionExpectation_t *expectation = &gpsConversionExpectations[index];
|
||||
#ifdef DEBUG_GPS_CONVERSION
|
||||
printf("iteration: %d\n", index);
|
||||
|
||||
#endif
|
||||
uint32_t result = GPS_coord_to_degrees(expectation->coord);
|
||||
EXPECT_EQ(result, expectation->degrees);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
//#define DEBUG_LEDSTRIP
|
||||
|
||||
extern "C" {
|
||||
#include "build_config.h"
|
||||
|
||||
|
@ -165,8 +167,9 @@ TEST(LedStripTest, parseLedStripConfig)
|
|||
|
||||
// and
|
||||
for (uint8_t index = 0; index < WS2811_LED_STRIP_LENGTH; index++) {
|
||||
#ifdef DEBUG_LEDSTRIP
|
||||
printf("iteration: %d\n", index);
|
||||
|
||||
#endif
|
||||
EXPECT_EQ(expectedLedStripConfig[index].xy, ledConfigs[index].xy);
|
||||
EXPECT_EQ(expectedLedStripConfig[index].flags, ledConfigs[index].flags);
|
||||
EXPECT_EQ(expectedLedStripConfig[index].color, ledConfigs[index].color);
|
||||
|
@ -324,14 +327,19 @@ TEST(ColorTest, parseColor)
|
|||
|
||||
// when
|
||||
for (uint8_t index = 0; index < TEST_COLOR_COUNT; index++) {
|
||||
#ifdef DEBUG_LEDSTRIP
|
||||
printf("parse iteration: %d\n", index);
|
||||
#endif
|
||||
|
||||
parseColor(index, testColors[index]);
|
||||
}
|
||||
|
||||
// then
|
||||
|
||||
for (uint8_t index = 0; index < TEST_COLOR_COUNT; index++) {
|
||||
#ifdef DEBUG_LEDSTRIP
|
||||
printf("iteration: %d\n", index);
|
||||
#endif
|
||||
|
||||
EXPECT_EQ(expectedColors[index].h, colors[index].h);
|
||||
EXPECT_EQ(expectedColors[index].s, colors[index].s);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
|
||||
//#define DEBUG_LOWPASS
|
||||
|
||||
extern "C" {
|
||||
#include "flight/lowpass.h"
|
||||
}
|
||||
|
@ -97,8 +99,9 @@ TEST(LowpassTest, Lowpass)
|
|||
|
||||
// Test all frequencies
|
||||
for (freq = 10; freq <= 400; freq++) {
|
||||
#ifdef DEBUG_LOWPASS
|
||||
printf("*** Testing freq: %d (%f)\n", freq, ((float)freq * 0.001f));
|
||||
|
||||
#endif
|
||||
// Run tests
|
||||
for (sampleIdx = 0; sampleIdx < sampleCount; sampleIdx++)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
//#define DEBUG_RC_CONTROLS
|
||||
|
||||
extern "C" {
|
||||
#include "platform.h"
|
||||
|
||||
|
@ -69,7 +71,9 @@ TEST(RcControlsTest, updateActivatedModesWithAllInputsAtMidde)
|
|||
|
||||
// then
|
||||
for (index = 0; index < CHECKBOX_ITEM_COUNT; index++) {
|
||||
#ifdef DEBUG_RC_CONTROLS
|
||||
printf("iteration: %d\n", index);
|
||||
#endif
|
||||
EXPECT_EQ(false, IS_RC_MODE_ACTIVE(index));
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +164,9 @@ TEST(RcControlsTest, updateActivatedModesUsingValidAuxConfigurationAndRXValues)
|
|||
|
||||
// then
|
||||
for (index = 0; index < CHECKBOX_ITEM_COUNT; index++) {
|
||||
#ifdef DEBUG_RC_CONTROLS
|
||||
printf("iteration: %d\n", index);
|
||||
#endif
|
||||
EXPECT_EQ(expectedMask & (1 << index), rcModeActivationMask & (1 << index));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue