1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00

Added stricter error checks by the compiler, and adapted all impacted code.

Primarily -
* Added "static" to static functions.
* Added proper signature with "void" to functions without arguments.
* Marked unused arguments with "(void)".
* Removed entirely unused static functions.
* Added "const" to preserve const-correctness.
* Added function prototypes for external functions.
This commit is contained in:
nimrodz
2015-01-18 00:32:47 +02:00
parent af40e7901d
commit b389c71e71
20 changed files with 130 additions and 87 deletions

View File

@@ -12,18 +12,6 @@ extern void test_IgnoredTest(void);
extern void test_AnotherIgnoredTest(void);
extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void);
static void runTest(UnityTestFunction test)
{
if (TEST_PROTECT())
{
setUp();
test();
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest(void);
void resetTest(void)
{
@@ -36,7 +24,6 @@ int main(void)
{
UnityBegin("test/TestProductionCode2.c");
// RUN_TEST calls runTest
RUN_TEST(test_IgnoredTest, 13);
RUN_TEST(test_AnotherIgnoredTest, 18);
RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23);

View File

@@ -14,18 +14,6 @@ extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounter
extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void);
extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void);
static void runTest(UnityTestFunction test)
{
if (TEST_PROTECT())
{
setUp();
test();
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest(void);
void resetTest(void)
{
@@ -38,7 +26,6 @@ int main(void)
{
UnityBegin("test/TestProductionCode.c");
// RUN_TEST calls runTest
RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20);
RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30);
RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41);