提交 68decf8b 编写于 作者: M mkarlesky

standardized pointer notation; did a bit of janitorial work on Unity struct

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@17 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 24a56b0c
...@@ -2,16 +2,17 @@ ...@@ -2,16 +2,17 @@
#include <stdio.h> #include <stdio.h>
struct _Unity Unity = struct _Unity Unity =
{ {
NULL,
NULL, NULL,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
NULL,
1e-4f, 1e-4f,
0,
}; };
void UnityPrintChar(const char ch) void UnityPrintChar(const char ch)
...@@ -19,9 +20,9 @@ void UnityPrintChar(const char ch) ...@@ -19,9 +20,9 @@ void UnityPrintChar(const char ch)
putchar(ch); putchar(ch);
} }
void UnityPrint(const char *string) void UnityPrint(const char* string)
{ {
unsigned char * pch = (unsigned char *)string; unsigned char* pch = (unsigned char*)string;
if (pch != NULL) if (pch != NULL)
{ {
...@@ -171,7 +172,7 @@ void UnityConcludeTest() ...@@ -171,7 +172,7 @@ void UnityConcludeTest()
void UnityAssertBits(const int mask, void UnityAssertBits(const int mask,
const int expected, const int expected,
const int actual, const int actual,
const char *msg, const char* msg,
const unsigned short lineNumber) const unsigned short lineNumber)
{ {
if ((mask & expected) != (mask & actual)) if ((mask & expected) != (mask & actual))
...@@ -195,7 +196,7 @@ void UnityAssertBits(const int mask, ...@@ -195,7 +196,7 @@ void UnityAssertBits(const int mask,
void UnityAssertEqualInt(const int expected, void UnityAssertEqualInt(const int expected,
const int actual, const int actual,
const char *msg, const char* msg,
const unsigned short lineNumber, const unsigned short lineNumber,
const UNITY_DISPLAY_STYLE_T style) const UNITY_DISPLAY_STYLE_T style)
{ {
...@@ -221,7 +222,7 @@ void UnityAssertEqualInt(const int expected, ...@@ -221,7 +222,7 @@ void UnityAssertEqualInt(const int expected,
void UnityAssertFloatsWithin(const float delta, void UnityAssertFloatsWithin(const float delta,
const float expected, const float expected,
const float actual, const float actual,
const char *msg, const char* msg,
const unsigned short lineNumber) const unsigned short lineNumber)
{ {
float diff = actual - expected; float diff = actual - expected;
...@@ -248,7 +249,7 @@ void UnityAssertFloatsWithin(const float delta, ...@@ -248,7 +249,7 @@ void UnityAssertFloatsWithin(const float delta,
void UnityAssertIntsWithin(const int delta, void UnityAssertIntsWithin(const int delta,
const int expected, const int expected,
const int actual, const int actual,
const char *msg, const char* msg,
const unsigned short lineNumber) const unsigned short lineNumber)
{ {
int diff = actual - expected; int diff = actual - expected;
...@@ -272,9 +273,9 @@ void UnityAssertIntsWithin(const int delta, ...@@ -272,9 +273,9 @@ void UnityAssertIntsWithin(const int delta,
} }
} }
void UnityAssertEqualString(const char *expected, void UnityAssertEqualString(const char* expected,
const char *actual, const char* actual,
const char *msg, const char* msg,
unsigned short lineNumber) unsigned short lineNumber)
{ {
unsigned int i; unsigned int i;
...@@ -317,10 +318,10 @@ void UnityAssertEqualString(const char *expected, ...@@ -317,10 +318,10 @@ void UnityAssertEqualString(const char *expected,
} }
void UnityAssertEqualMemory(void *expected, void UnityAssertEqualMemory(void* expected,
void *actual, void* actual,
unsigned int length, unsigned int length,
const char *msg, const char* msg,
unsigned short lineNumber) unsigned short lineNumber)
{ {
unsigned int i; unsigned int i;
...@@ -361,7 +362,7 @@ void UnityAssertEqualMemory(void *expected, ...@@ -361,7 +362,7 @@ void UnityAssertEqualMemory(void *expected,
} }
} }
void UnityFail(const char *message, const int line) void UnityFail(const char* message, const int line)
{ {
Unity.CurrentTestFailed = 1; Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(line); UnityTestResultsBegin(line);
...@@ -369,7 +370,7 @@ void UnityFail(const char *message, const int line) ...@@ -369,7 +370,7 @@ void UnityFail(const char *message, const int line)
UnityPrintChar('\n'); UnityPrintChar('\n');
} }
void UnityIgnore(const char *message, const int line) void UnityIgnore(const char* message, const int line)
{ {
Unity.CurrentTestIgnored = 1; Unity.CurrentTestIgnored = 1;
UnityTestResultsBegin(line); UnityTestResultsBegin(line);
......
...@@ -19,13 +19,13 @@ typedef enum ...@@ -19,13 +19,13 @@ typedef enum
struct _Unity struct _Unity
{ {
char* CurrentTestName; const char* TestFile;
const char* CurrentTestName;
unsigned char NumberOfTests; unsigned char NumberOfTests;
unsigned char TestFailures; unsigned char TestFailures;
unsigned char TestIgnores; unsigned char TestIgnores;
unsigned char CurrentTestFailed; unsigned char CurrentTestFailed;
unsigned char CurrentTestIgnored; unsigned char CurrentTestIgnored;
const char *TestFile;
float DefaultDelta; float DefaultDelta;
jmp_buf AbortFrame; jmp_buf AbortFrame;
}; };
...@@ -39,7 +39,7 @@ void UnityEnd(void); ...@@ -39,7 +39,7 @@ void UnityEnd(void);
int UnityGetNumFailures(void); int UnityGetNumFailures(void);
void UnityPrintChar(const char ch); void UnityPrintChar(const char ch);
void UnityPrint(const char *string); void UnityPrint(const char* string);
void UnityPrintMask(const unsigned long mask, const unsigned long number); void UnityPrintMask(const unsigned long mask, const unsigned long number);
void UnityPrintNumberByStyle(const long number, const UNITY_DISPLAY_STYLE_T style); void UnityPrintNumberByStyle(const long number, const UNITY_DISPLAY_STYLE_T style);
void UnityPrintNumber(const long number); void UnityPrintNumber(const long number);
...@@ -49,42 +49,42 @@ void UnityConcludeTest(); ...@@ -49,42 +49,42 @@ void UnityConcludeTest();
void UnityAssertEqualInt(const int expected, void UnityAssertEqualInt(const int expected,
const int actual, const int actual,
const char *msg, const char* msg,
const unsigned short lineNumber, const unsigned short lineNumber,
const UNITY_DISPLAY_STYLE_T style); const UNITY_DISPLAY_STYLE_T style);
void UnityAssertBits(const int mask, void UnityAssertBits(const int mask,
const int expected, const int expected,
const int actual, const int actual,
const char *msg, const char* msg,
const unsigned short lineNumber); const unsigned short lineNumber);
void UnityAssertEqualString(const char *expected, void UnityAssertEqualString(const char* expected,
const char *actual, const char* actual,
const char *msg, const char* msg,
const unsigned short lineNumber ); const unsigned short lineNumber );
void UnityAssertEqualMemory(void *expected, void UnityAssertEqualMemory(void* expected,
void *actual, void* actual,
unsigned int length, unsigned int length,
const char *msg, const char* msg,
const unsigned short lineNumber ); const unsigned short lineNumber );
void UnityAssertFloatsWithin(const float delta, void UnityAssertFloatsWithin(const float delta,
const float expected, const float expected,
const float actual, const float actual,
const char *msg, const char* msg,
const unsigned short lineNumber); const unsigned short lineNumber);
void UnityAssertIntsWithin(const int delta, void UnityAssertIntsWithin(const int delta,
const int expected, const int expected,
const int actual, const int actual,
const char *msg, const char* msg,
const unsigned short lineNumber); const unsigned short lineNumber);
void UnityFail(const char *message, const int line); void UnityFail(const char* message, const int line);
void UnityIgnore(const char *message, const int line); void UnityIgnore(const char* message, const int line);
#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) #define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册