1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

remove not needed whitespaces

This commit is contained in:
Steffen Windoffer 2017-08-24 11:29:11 +02:00
parent dfe868ef96
commit 03aa31acdd
197 changed files with 118 additions and 308 deletions

View file

@ -32,9 +32,9 @@ extern "C" {
* This test file contains an independent method of rotating a vector.
* The output of alignSensor() is compared to the output of the test
* rotation method.
*
*
* For each alignment condition (CW0, CW90, etc) the source vector under
* test is set to a unit vector along each axis (x-axis, y-axis, z-axis)
* test is set to a unit vector along each axis (x-axis, y-axis, z-axis)
* plus one additional random vector is tested.
*/
@ -50,7 +50,7 @@ static void rotateVector(int32_t mat[3][3], int32_t vec[3], int32_t *out)
tmp[i] += mat[j][i] * vec[j];
}
}
out[0]=tmp[0];
out[1]=tmp[1];
out[2]=tmp[2];
@ -105,7 +105,7 @@ static void testCW(sensor_align_e rotation, int32_t angle)
src[X] = 1;
src[Y] = 0;
src[Z] = 0;
int32_t matrix[3][3];
initZAxisRotation(matrix, angle);
rotateVector(matrix, src, test);
@ -162,7 +162,7 @@ static void testCWFlip(sensor_align_e rotation, int32_t angle)
src[X] = 1;
src[Y] = 0;
src[Z] = 0;
int32_t matrix[3][3];
initYAxisRotation(matrix, 180);
rotateVector(matrix, src, test);
@ -223,7 +223,7 @@ static void testCWFlip(sensor_align_e rotation, int32_t angle)
EXPECT_EQ(test[Y], src[Y]) << "Random alignment does not match in Y-Axis. " << test[Y] << " " << src[Y];
EXPECT_EQ(test[Z], src[Z]) << "Random alignment does not match in Z-Axis. " << test[Z] << " " << src[Z];
}
TEST(AlignSensorTest, ClockwiseZeroDegrees)
{
@ -265,4 +265,3 @@ TEST(AlignSensorTest, ClockwiseTwoSeventyDegreesFlip)
{
testCWFlip(CW270_DEG_FLIP, 270);
}

View file

@ -60,7 +60,7 @@ extern "C" {
};
const uint16_t valueTableEntryCount = ARRAYLEN(valueTable);
const lookupTableEntry_t lookupTables[] = {};
PG_REGISTER(osdConfig_t, osdConfig, PG_OSD_CONFIG, 0);
PG_REGISTER(batteryConfig_t, batteryConfig, PG_BATTERY_CONFIG, 0);
@ -81,7 +81,7 @@ extern "C" {
PG_REGISTER_ARRAY(rxFailsafeChannelConfig_t, MAX_SUPPORTED_RC_CHANNEL_COUNT, rxFailsafeChannelConfigs, PG_RX_FAILSAFE_CHANNEL_CONFIG, 0);
PG_REGISTER(pidConfig_t, pidConfig, PG_PID_CONFIG, 0);
PG_REGISTER_WITH_RESET_FN(int8_t, unitTestData, PG_RESERVED_FOR_TESTING_1, 0);
PG_REGISTER_WITH_RESET_FN(int8_t, unitTestData, PG_RESERVED_FOR_TESTING_1, 0);
}
#include "unittest_macros.h"

View file

@ -72,4 +72,3 @@ TEST(GpsConversionTest, GPSCoordToDegrees_NMEA_Values)
EXPECT_EQ(result, expectation->degrees);
}
}

View file

@ -87,4 +87,3 @@ TEST(ParameterGroupsfTest, Test_pgFind)
extern "C" {
}

View file

@ -34,7 +34,7 @@ extern "C" {
#include "fc/rc_controls.h"
#include "fc/rc_modes.h"
#include "io/beeper.h"
#include "io/serial.h"
@ -118,13 +118,13 @@ TEST(RCSplitTest, TestRecvWhoAreYouResponse)
unitTestResetRCSplit();
testData.isRunCamSplitOpenPortSupported = true;
testData.isRunCamSplitPortConfigurated = true;
bool result = rcSplitInit();
EXPECT_EQ(true, result);
// here will generate a number in [6-255], it's make the serialRxBytesWaiting() and serialRead() run at least 5 times,
// here will generate a number in [6-255], it's make the serialRxBytesWaiting() and serialRead() run at least 5 times,
// so the "who are you response" will full received, and cause the state change to RCSPLIT_STATE_IS_READY;
int8_t randNum = rand() % 127 + 6;
int8_t randNum = rand() % 127 + 6;
testData.maxTimesOfRespDataAvailable = randNum;
rcSplitProcess((timeUs_t)0);
@ -138,7 +138,7 @@ TEST(RCSplitTest, TestWifiModeChangeWithDeviceUnready)
testData.isRunCamSplitOpenPortSupported = true;
testData.isRunCamSplitPortConfigurated = true;
testData.maxTimesOfRespDataAvailable = 0;
bool result = rcSplitInit();
EXPECT_EQ(true, result);
@ -187,7 +187,7 @@ TEST(RCSplitTest, TestWifiModeChangeWithDeviceReady)
testData.isRunCamSplitOpenPortSupported = true;
testData.isRunCamSplitPortConfigurated = true;
testData.maxTimesOfRespDataAvailable = 0;
bool result = rcSplitInit();
EXPECT_EQ(true, result);
@ -195,7 +195,7 @@ TEST(RCSplitTest, TestWifiModeChangeWithDeviceReady)
for (uint8_t i = 0; i <= BOXCAMERA3 - BOXCAMERA1; i++) {
memset(modeActivationConditionsMutable(i), 0, sizeof(modeActivationCondition_t));
}
// bind aux1 to wifi button with range [900,1600]
modeActivationConditionsMutable(0)->auxChannelIndex = 0;
@ -222,7 +222,7 @@ TEST(RCSplitTest, TestWifiModeChangeWithDeviceReady)
updateActivatedModes();
// runn process loop
int8_t randNum = rand() % 127 + 6;
int8_t randNum = rand() % 127 + 6;
testData.maxTimesOfRespDataAvailable = randNum;
rcSplitProcess((timeUs_t)0);
@ -240,7 +240,7 @@ TEST(RCSplitTest, TestWifiModeChangeCombine)
testData.isRunCamSplitOpenPortSupported = true;
testData.isRunCamSplitPortConfigurated = true;
testData.maxTimesOfRespDataAvailable = 0;
bool result = rcSplitInit();
EXPECT_EQ(true, result);
@ -248,7 +248,7 @@ TEST(RCSplitTest, TestWifiModeChangeCombine)
for (uint8_t i = 0; i <= BOXCAMERA3 - BOXCAMERA1; i++) {
memset(modeActivationConditionsMutable(i), 0, sizeof(modeActivationCondition_t));
}
// bind aux1 to wifi button with range [900,1600]
modeActivationConditionsMutable(0)->auxChannelIndex = 0;
@ -275,7 +275,7 @@ TEST(RCSplitTest, TestWifiModeChangeCombine)
updateActivatedModes();
// runn process loop
int8_t randNum = rand() % 127 + 6;
int8_t randNum = rand() % 127 + 6;
testData.maxTimesOfRespDataAvailable = randNum;
rcSplitProcess((timeUs_t)0);
@ -361,8 +361,8 @@ extern "C" {
return NULL;
}
uint32_t serialRxBytesWaiting(const serialPort_t *instance)
{
uint32_t serialRxBytesWaiting(const serialPort_t *instance)
{
UNUSED(instance);
testData.maxTimesOfRespDataAvailable--;
@ -373,9 +373,9 @@ extern "C" {
return 0;
}
uint8_t serialRead(serialPort_t *instance)
{
UNUSED(instance);
uint8_t serialRead(serialPort_t *instance)
{
UNUSED(instance);
if (testData.maxTimesOfRespDataAvailable > 0) {
static uint8_t i = 0;
@ -388,41 +388,41 @@ extern "C" {
return buffer[i++];
}
return 0;
return 0;
}
void sbufWriteString(sbuf_t *dst, const char *string)
{
UNUSED(dst); UNUSED(string);
void sbufWriteString(sbuf_t *dst, const char *string)
{
UNUSED(dst); UNUSED(string);
if (testData.isAllowBufferReadWrite) {
sbufWriteData(dst, string, strlen(string));
}
}
void sbufWriteU8(sbuf_t *dst, uint8_t val)
{
UNUSED(dst); UNUSED(val);
void sbufWriteU8(sbuf_t *dst, uint8_t val)
{
UNUSED(dst); UNUSED(val);
if (testData.isAllowBufferReadWrite) {
*dst->ptr++ = val;
}
}
void sbufWriteData(sbuf_t *dst, const void *data, int len)
{
UNUSED(dst); UNUSED(data); UNUSED(len);
UNUSED(dst); UNUSED(data); UNUSED(len);
if (testData.isAllowBufferReadWrite) {
memcpy(dst->ptr, data, len);
dst->ptr += len;
}
}
// modifies streambuf so that written data are prepared for reading
void sbufSwitchToReader(sbuf_t *buf, uint8_t *base)
{
UNUSED(buf); UNUSED(base);
UNUSED(buf); UNUSED(base);
if (testData.isAllowBufferReadWrite) {
buf->end = buf->ptr;

View file

@ -250,7 +250,7 @@ protected:
findSerialPortConfig_stub_retval = &serialTestInstanceConfig;
EXPECT_TRUE(ibusInit(&initialRxConfig, &rxRuntimeConfig));
EXPECT_TRUE(initSharedIbusTelemetryCalled);
//handle that internal ibus position is not set to zero at init
@ -330,7 +330,7 @@ TEST_F(IbusRxProtocollUnitTest, Test_IA6B_HalfPacketReceived_then_interPacketGap
const uint8_t packet_half[] = {0x20, 0x00, //length and reserved (unknown) bits
0x00, 0xab, 0x01, 0xab, 0x02, 0xab, 0x03, 0xab, 0x04, 0xab, //channel 1..5
0x05, 0xab};
const uint8_t packet_full[] = {0x20, 0x00, //length and reserved (unknown) bits
const uint8_t packet_full[] = {0x20, 0x00, //length and reserved (unknown) bits
0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, //channel 1..5
0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, //channel 6..10
0x0a, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0d, 0x00, //channel 11..14
@ -343,7 +343,7 @@ TEST_F(IbusRxProtocollUnitTest, Test_IA6B_HalfPacketReceived_then_interPacketGap
microseconds_stub_value += 5000;
EXPECT_EQ(RX_FRAME_PENDING, rxRuntimeConfig.rcFrameStatusFn());
for (size_t i=0; i < sizeof(packet_full); i++) {
EXPECT_EQ(RX_FRAME_PENDING, rxRuntimeConfig.rcFrameStatusFn());
stub_serialRxCallback(packet_full[i]);
@ -452,9 +452,9 @@ TEST_F(IbusRxProtocollUnitTest, Test_IA6B_OnePacketReceived_not_shared_port)
TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryPacketReceived)
{
uint8_t packet[] = {0x04, 0x81, 0x7a, 0xff}; //ibus sensor discovery
uint8_t packet[] = {0x04, 0x81, 0x7a, 0xff}; //ibus sensor discovery
resetStubTelemetry();
receivePacket(packet, sizeof(packet));
//no frame complete signal to rx system, but telemetry system is called
@ -466,7 +466,7 @@ TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryPacketReceived)
TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryIgnoreTxEchoToRx)
{
uint8_t packet[] = {0x04, 0x81, 0x7a, 0xff}; //ibus sensor discovery
uint8_t packet[] = {0x04, 0x81, 0x7a, 0xff}; //ibus sensor discovery
resetStubTelemetry();
stubTelemetryIgnoreRxChars = 4;
@ -475,7 +475,7 @@ TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryIgnoreTxEchoToRx)
rxRuntimeConfig.rcFrameStatusFn();
EXPECT_TRUE(stubTelemetryCalled);
//when those four bytes are sent and looped back
//when those four bytes are sent and looped back
resetStubTelemetry();
rxRuntimeConfig.rcFrameStatusFn();
receivePacket(packet, sizeof(packet));
@ -483,7 +483,7 @@ TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryIgnoreTxEchoToRx)
//then they are ignored
EXPECT_FALSE(stubTelemetryCalled);
//and then next packet can be received
//and then next packet can be received
receivePacket(packet, sizeof(packet));
rxRuntimeConfig.rcFrameStatusFn();
EXPECT_TRUE(stubTelemetryCalled);
@ -492,7 +492,7 @@ TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryIgnoreTxEchoToRx)
TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryShouldNotIgnoreTxEchoAfterInterFrameGap)
{
uint8_t packet[] = {0x04, 0x81, 0x7a, 0xff}; //ibus sensor discovery
uint8_t packet[] = {0x04, 0x81, 0x7a, 0xff}; //ibus sensor discovery
resetStubTelemetry();
stubTelemetryIgnoreRxChars = 4;
@ -506,9 +506,8 @@ TEST_F(IbusRxProtocollUnitTest, Test_OneTelemetryShouldNotIgnoreTxEchoAfterInter
resetStubTelemetry();
rxRuntimeConfig.rcFrameStatusFn();
//then next packet can be received
//then next packet can be received
receivePacket(packet, sizeof(packet));
rxRuntimeConfig.rcFrameStatusFn();
EXPECT_TRUE(stubTelemetryCalled);
}

View file

@ -219,4 +219,3 @@ void failsafeOnValidDataFailed(void)
}
}