提交 a867d1f6 编写于 作者: M mvandervoord

- fixed some formatting

- added a cast to reduce warnings

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@80 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 b8007051
...@@ -37,19 +37,19 @@ void UnityPrint(const char* string) ...@@ -37,19 +37,19 @@ void UnityPrint(const char* string)
{ {
while (*pch) while (*pch)
{ {
// printable characters plus CR & LF are printed // printable characters plus CR & LF are printed
if ( ((*pch <= 126) && (*pch >= 32)) || (*pch == 13) || (*pch == 10) ) if ( ((*pch <= 126) && (*pch >= 32)) || (*pch == 13) || (*pch == 10) )
{ {
UNITY_OUTPUT_CHAR(*pch); UNITY_OUTPUT_CHAR(*pch);
} }
// unprintable characters are shown as codes // unprintable characters are shown as codes
else else
{ {
UNITY_OUTPUT_CHAR('{'); UNITY_OUTPUT_CHAR('{');
UNITY_OUTPUT_CHAR('\\'); UNITY_OUTPUT_CHAR('\\');
UnityPrintNumber((_US32)*pch); UnityPrintNumber((_US32)*pch);
UNITY_OUTPUT_CHAR('}'); UNITY_OUTPUT_CHAR('}');
} }
pch++; pch++;
} }
} }
...@@ -237,28 +237,28 @@ void UnityAddMsgIfSpecified(const char* msg) ...@@ -237,28 +237,28 @@ void UnityAddMsgIfSpecified(const char* msg)
//----------------------------------------------- //-----------------------------------------------
void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual) void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
{ {
UnityPrint(UnityStrExpected); UnityPrint(UnityStrExpected);
if (expected != NULL) if (expected != NULL)
{ {
UNITY_OUTPUT_CHAR('\''); UNITY_OUTPUT_CHAR('\'');
UnityPrint(expected); UnityPrint(expected);
UNITY_OUTPUT_CHAR('\''); UNITY_OUTPUT_CHAR('\'');
} }
else else
{ {
UnityPrint(UnityStrNull); UnityPrint(UnityStrNull);
} }
UnityPrint(UnityStrWas); UnityPrint(UnityStrWas);
if (actual != NULL) if (actual != NULL)
{ {
UNITY_OUTPUT_CHAR('\''); UNITY_OUTPUT_CHAR('\'');
UnityPrint(actual); UnityPrint(actual);
UNITY_OUTPUT_CHAR('\''); UNITY_OUTPUT_CHAR('\'');
} }
else else
{ {
UnityPrint(UnityStrNull); UnityPrint(UnityStrNull);
} }
} }
//----------------------------------------------- //-----------------------------------------------
...@@ -575,7 +575,7 @@ void UnityAssertEqualString(const char* expected, ...@@ -575,7 +575,7 @@ void UnityAssertEqualString(const char* expected,
if (Unity.CurrentTestFailed) if (Unity.CurrentTestFailed)
{ {
UnityTestResultsFailBegin(lineNumber); UnityTestResultsFailBegin(lineNumber);
UnityPrintExpectedAndActualStrings(expected, actual); UnityPrintExpectedAndActualStrings(expected, actual);
UnityAddMsgIfSpecified(msg); UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL; UNITY_FAIL_AND_BAIL;
} }
...@@ -632,7 +632,7 @@ void UnityAssertEqualStringArray( const char** expected, ...@@ -632,7 +632,7 @@ void UnityAssertEqualStringArray( const char** expected,
UnityPrint(UnityStrElement); UnityPrint(UnityStrElement);
UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT); UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT);
} }
UnityPrintExpectedAndActualStrings(expected[j], actual[j]); UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
UnityAddMsgIfSpecified(msg); UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL; UNITY_FAIL_AND_BAIL;
} }
...@@ -647,8 +647,8 @@ void UnityAssertEqualMemory( const void* expected, ...@@ -647,8 +647,8 @@ void UnityAssertEqualMemory( const void* expected,
const char* msg, const char* msg,
const UNITY_LINE_TYPE lineNumber) const UNITY_LINE_TYPE lineNumber)
{ {
unsigned char* expected_ptr = (unsigned char*)expected; unsigned char* expected_ptr = (unsigned char*)expected;
unsigned char* actual_ptr = (unsigned char*)actual; unsigned char* actual_ptr = (unsigned char*)actual;
_UU32 elements = num_elements; _UU32 elements = num_elements;
if ((elements == 0) || (length == 0)) if ((elements == 0) || (length == 0))
{ {
...@@ -699,8 +699,8 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line) ...@@ -699,8 +699,8 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
UNITY_OUTPUT_CHAR(':'); UNITY_OUTPUT_CHAR(':');
if (msg[0] != ' ') if (msg[0] != ' ')
{ {
UNITY_OUTPUT_CHAR(' '); UNITY_OUTPUT_CHAR(' ');
} }
UnityPrint(msg); UnityPrint(msg);
} }
UNITY_FAIL_AND_BAIL; UNITY_FAIL_AND_BAIL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册