Merge pull request #254 from jsalling/cleanup/clang-format

Formatting source code to existing style
This commit is contained in:
Mark VanderVoord
2017-01-19 06:56:35 -05:00
committed by GitHub
2 changed files with 71 additions and 71 deletions

View File

@@ -180,8 +180,7 @@ void UnityPrintNumberUnsigned(const UNITY_UINT number)
{
UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
divisor /= 10;
}
while (divisor > 0);
} while (divisor > 0);
}
/*-----------------------------------------------*/
@@ -401,7 +400,7 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
}
else
{
UnityPrint(UnityStrNull);
UnityPrint(UnityStrNull);
}
UnityPrint(UnityStrWas);
if (actual != NULL)
@@ -412,12 +411,14 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
}
else
{
UnityPrint(UnityStrNull);
UnityPrint(UnityStrNull);
}
}
/*-----------------------------------------------*/
static void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const UNITY_UINT32 length)
static void UnityPrintExpectedAndActualStringsLen(const char* expected,
const char* actual,
const UNITY_UINT32 length)
{
UnityPrint(UnityStrExpected);
if (expected != NULL)
@@ -428,7 +429,7 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
}
else
{
UnityPrint(UnityStrNull);
UnityPrint(UnityStrNull);
}
UnityPrint(UnityStrWas);
if (actual != NULL)
@@ -439,12 +440,10 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
}
else
{
UnityPrint(UnityStrNull);
UnityPrint(UnityStrNull);
}
}
/*-----------------------------------------------
* Assertion & Control Helpers
*-----------------------------------------------*/
@@ -580,7 +579,7 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
if (expect_val != actual_val)
{
if (style & UNITY_DISPLAY_RANGE_UINT && length < sizeof expect_val)
if (style & UNITY_DISPLAY_RANGE_UINT && length < sizeof(expect_val))
{ /* For UINT, remove sign extension (padding 1's) from signed type casts above */
UNITY_INT mask = 1;
mask = (mask << 8 * length) - 1;
@@ -621,12 +620,11 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
#define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
do { \
{ \
UnityPrint(UnityStrExpected); \
UnityPrintFloat(expected); \
UnityPrint(UnityStrWas); \
UnityPrintFloat(actual); \
} while(0)
UnityPrintFloat(actual); }
#else
#define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
UnityPrint(UnityStrDelta)
@@ -700,14 +698,14 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLOAT_TRAIT_T style)
{
const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
UNITY_INT is_trait = !should_be_trait;
UNITY_INT trait_index = (UNITY_INT)(style >> 1);
const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
UNITY_INT is_trait = !should_be_trait;
UNITY_INT trait_index = (UNITY_INT)(style >> 1);
RETURN_IF_FAIL_OR_IGNORE;
switch(style)
switch (style)
{
case UNITY_FLOAT_IS_INF:
case UNITY_FLOAT_IS_NOT_INF:
@@ -826,14 +824,14 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLOAT_TRAIT_T style)
{
const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
UNITY_INT is_trait = !should_be_trait;
UNITY_INT trait_index = (UNITY_INT)(style >> 1);
const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
UNITY_INT is_trait = !should_be_trait;
UNITY_INT trait_index = (UNITY_INT)(style >> 1);
RETURN_IF_FAIL_OR_IGNORE;
switch(style)
switch (style)
{
case UNITY_FLOAT_IS_INF:
case UNITY_FLOAT_IS_NOT_INF:
@@ -880,16 +878,15 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
}
}
#endif /* not UNITY_EXCLUDE_DOUBLE */
/*-----------------------------------------------*/
void UnityAssertNumbersWithin( const UNITY_UINT delta,
const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
void UnityAssertNumbersWithin(const UNITY_UINT delta,
const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
{
RETURN_IF_FAIL_OR_IGNORE;
@@ -954,19 +951,19 @@ void UnityAssertEqualString(const char* expected,
if (Unity.CurrentTestFailed)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrintExpectedAndActualStrings(expected, actual);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
UnityTestResultsFailBegin(lineNumber);
UnityPrintExpectedAndActualStrings(expected, actual);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
/*-----------------------------------------------*/
void UnityAssertEqualStringLen(const char* expected,
const char* actual,
const UNITY_UINT32 length,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
const char* actual,
const UNITY_UINT32 length,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
{
UNITY_UINT32 i;
@@ -994,20 +991,19 @@ void UnityAssertEqualStringLen(const char* expected,
if (Unity.CurrentTestFailed)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrintExpectedAndActualStringsLen(expected, actual, length);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
UnityTestResultsFailBegin(lineNumber);
UnityPrintExpectedAndActualStringsLen(expected, actual, length);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
/*-----------------------------------------------*/
void UnityAssertEqualStringArray( const char** expected,
const char** actual,
const UNITY_UINT32 num_elements,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
void UnityAssertEqualStringArray(const char** expected,
const char** actual,
const UNITY_UINT32 num_elements,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
{
UNITY_UINT32 i, j = 0;
@@ -1061,12 +1057,12 @@ void UnityAssertEqualStringArray( const char** expected,
}
/*-----------------------------------------------*/
void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
UNITY_INTERNAL_PTR actual,
const UNITY_UINT32 length,
const UNITY_UINT32 num_elements,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
UNITY_INTERNAL_PTR actual,
const UNITY_UINT32 length,
const UNITY_UINT32 num_elements,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
{
UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
@@ -1159,22 +1155,22 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
UnityPrint(UnityStrIgnore);
if (msg != NULL)
{
UNITY_OUTPUT_CHAR(':');
UNITY_OUTPUT_CHAR(' ');
UnityPrint(msg);
UNITY_OUTPUT_CHAR(':');
UNITY_OUTPUT_CHAR(' ');
UnityPrint(msg);
}
UNITY_IGNORE_AND_BAIL;
}
/*-----------------------------------------------*/
#if defined(UNITY_WEAK_ATTRIBUTE)
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
#elif defined(UNITY_WEAK_PRAGMA)
# pragma weak setUp
void setUp(void) { }
# pragma weak tearDown
void tearDown(void) { }
#pragma weak setUp
void setUp(void) { }
#pragma weak tearDown
void tearDown(void) { }
#endif
/*-----------------------------------------------*/
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
@@ -1248,7 +1244,7 @@ int UnityEnd(void)
char* UnityOptionIncludeNamed = NULL;
char* UnityOptionExcludeNamed = NULL;
int UnityVerbosity = 1;
int UnityVerbosity = 1;
int UnityParseOptions(int argc, char** argv)
{
@@ -1259,7 +1255,7 @@ int UnityParseOptions(int argc, char** argv)
{
if (argv[i][0] == '-')
{
switch(argv[i][1])
switch (argv[i][1])
{
case 'l': /* list tests */
return -1;
@@ -1364,7 +1360,8 @@ int UnityStringArgumentMatches(const char* str)
/* look for the start of the next partial */
ptr2 = ptr1;
ptrf = 0;
do {
do
{
ptr2++;
if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
ptrf = &ptr2[1];