void UnityConcludeFixtureTest(void) { if (Unity.CurrentTestIgnored) { if (UnityFixture.Verbose) { UNITY_OUTPUT_CHAR('\n'); } Unity.TestIgnores++; } else if (!Unity.CurrentTestFailed) { if (UnityFixture.Verbose) { UnityPrint(" PASS"); UNITY_OUTPUT_CHAR('\n'); } } else if (Unity.CurrentTestFailed) { Unity.TestFailures++; } Unity.CurrentTestFailed = 0; Unity.CurrentTestIgnored = 0; }
void UnityConcludeFixtureTest( struct _Unity * const unity_p ) { if (unity_p->CurrentTestIgnored) { if (unity_p->Verbose) { UNITY_OUTPUT_CHAR('\n'); } unity_p->TestIgnores++; } else if (!unity_p->CurrentTestFailed) { if (unity_p->Verbose) { UnityPrint(" PASS", unity_p); UNITY_OUTPUT_CHAR('\n'); } } else if (unity_p->CurrentTestFailed) { unity_p->TestFailures++; } unity_p->CurrentTestFailed = 0; unity_p->CurrentTestIgnored = 0; }
void UnityIgnoreTest(const char * printableName) { Unity.NumberOfTests++; Unity.CurrentTestIgnored = 1; if (UnityFixture.Verbose) { UnityPrint(printableName); UNITY_OUTPUT_CHAR('\n'); } else UNITY_OUTPUT_CHAR('!'); }
void UnityTestRunner(unityfunction * setup, unityTestfunction * body, unityTestfunction * teardown, const char * printableName, const char * group, const char * name, const char * file, int line, struct _Unity * const unity_p) { if (testSelected(name, unity_p) && groupSelected(group, unity_p)) { unity_p->CurrentTestFailed = 0; unity_p->TestFile = file; unity_p->CurrentTestName = printableName; unity_p->CurrentTestLineNumber = line; if (!unity_p->Verbose) UNITY_OUTPUT_CHAR('.'); else UnityPrint(printableName, unity_p); unity_p->NumberOfTests++; #if defined(UNITY_DYNAMIC_MEM_DEBUG) UnityMalloc_StartTest(); #endif #if defined(UNITY_CPP_UNIT_COMPAT) UnityPointer_Init(unity_p); #endif runTestCase(unity_p); /* remember setup has failed - skip teardown if so*/ bool hasSetupFailed = false; if (TEST_PROTECT()) { setup(unity_p); /*DX_PATCH for jumpless version. If setup failed don't perform the test*/ if (!unity_p->CurrentTestFailed) { body(unity_p->testLocalStorage, unity_p); } else { hasSetupFailed = true; } } if (TEST_PROTECT() && !hasSetupFailed ) { teardown(unity_p->testLocalStorage, unity_p); } if (TEST_PROTECT()) { #if defined(UNITY_CPP_UNIT_COMPAT) UnityPointer_UndoAllSets(unity_p); #endif #if defined(UNITY_DYNAMIC_MEM_DEBUG) if (!unity_p->CurrentTestFailed) UnityMalloc_EndTest(unity_p); #endif } UnityConcludeFixtureTest(unity_p); } }
static void announceTestRun(unsigned int runNumber) { UnityPrint("Unity test run "); UnityPrintNumber(runNumber+1); UnityPrint(" of "); UnityPrintNumber(UnityFixture.RepeatCount); UNITY_OUTPUT_CHAR('\n'); }
/* DX_PATCH: "static" modifier required to avoid GCC warning: no previous prototype for... */ static void announceTestRun(unsigned int runNumber, struct _Unity * const unity_p) { UnityPrint("Unity test run ", unity_p); UnityPrintNumber(runNumber+1, unity_p); UnityPrint(" of ", unity_p); UnityPrintNumber(unity_p->RepeatCount, unity_p); UNITY_OUTPUT_CHAR('\n'); }
void tearDown(void) { if (SetToOneToFailInTearDown == 1) TEST_FAIL_MESSAGE("<= Failed in tearDown"); if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) { UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); UNITY_OUTPUT_CHAR('\n'); } }
void UnityIgnoreTest(const char * printableName, struct _Unity * const unity_p) { unity_p->NumberOfTests++; unity_p->CurrentTestIgnored = 1; if (!unity_p->Verbose) UNITY_OUTPUT_CHAR('!'); else UnityPrint(printableName, unity_p); UnityConcludeFixtureTest(unity_p); }
void UnityPrint(const char* string, struct _Unity * const unity_p) { const char* pch = string; if (pch != NULL) { while (*pch) { // printable characters plus CR & LF are printed if ((*pch <= 126) && (*pch >= 32)) { UNITY_OUTPUT_CHAR(*pch); } //write escaped carriage returns else if (*pch == 13) { UNITY_OUTPUT_CHAR('\\'); UNITY_OUTPUT_CHAR('r'); } //write escaped line feeds else if (*pch == 10) { UNITY_OUTPUT_CHAR('\\'); UNITY_OUTPUT_CHAR('n'); } // unprintable characters are shown as codes else { UNITY_OUTPUT_CHAR('\\'); UnityPrintNumberHex((_U_SINT)*pch, 2, unity_p); } pch++; } } }
void UnityIgnoreTest(const char * printableName, const char * group, const char * name) { if (testSelected(name) && groupSelected(group)) { Unity.NumberOfTests++; Unity.CurrentTestIgnored = 1; if (!UnityFixture.Verbose) UNITY_OUTPUT_CHAR('!'); else UnityPrint(printableName); UnityConcludeFixtureTest(); } }
void UnityIgnoreTest(const char* printableName, const char* group, const char* name) { if (testSelected(name) && groupSelected(group)) { Unity.NumberOfTests++; Unity.TestIgnores++; if (!UnityFixture.Verbose) UNITY_OUTPUT_CHAR('!'); else { UnityPrint(printableName); UNITY_PRINT_EOL(); } } }
void UnityTestRunner(unityfunction* setup, unityfunction* testBody, unityfunction* teardown, const char* printableName, const char* group, const char* name, const char* file, unsigned int line) { if (testSelected(name) && groupSelected(group)) { Unity.TestFile = file; Unity.CurrentTestName = printableName; Unity.CurrentTestLineNumber = line; if (!UnityFixture.Verbose) UNITY_OUTPUT_CHAR('.'); else { UnityPrint(printableName); #ifndef UNITY_REPEAT_TEST_NAME Unity.CurrentTestName = NULL; #endif } Unity.NumberOfTests++; UnityMalloc_StartTest(); UnityPointer_Init(); UNITY_EXEC_TIME_START(); if (TEST_PROTECT()) { setup(); testBody(); } if (TEST_PROTECT()) { teardown(); } if (TEST_PROTECT()) { UnityPointer_UndoAllSets(); if (!Unity.CurrentTestFailed) UnityMalloc_EndTest(); } UnityConcludeFixtureTest(); } }
void UnityTestRunner(unityfunction* setup, unityfunction* testBody, unityfunction* teardown, const char * printableName, const char * group, const char * name, const char * file, int line) { if (testSelected(name) && groupSelected(group)) { Unity.CurrentTestFailed = 0; Unity.TestFile = file; Unity.CurrentTestName = printableName; Unity.CurrentTestLineNumber = line; if (!UnityFixture.Verbose) UNITY_OUTPUT_CHAR('.'); else UnityPrint(printableName); Unity.NumberOfTests++; UnityMalloc_StartTest(); UnityPointer_Init(); runTestCase(); if (TEST_PROTECT()) { setup(); testBody(); } if (TEST_PROTECT()) { teardown(); } if (TEST_PROTECT()) { UnityPointer_UndoAllSets(); if (!Unity.CurrentTestFailed) UnityMalloc_EndTest(); UnityConcludeFixtureTest(); } else { //aborting - jwg - di i need these for the other TEST_PROTECTS? } } }
int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)) { int result = UnityGetCommandLineOptions(argc, argv); unsigned int r; if (result != 0) return result; for (r = 0; r < UnityFixture.RepeatCount; r++) { UnityBegin(argv[0]); announceTestRun(r); runAllTests(); UNITY_OUTPUT_CHAR('\n'); UnityEnd(); } return UnityFailureCount(); }
int UnityMain(int argc, char* argv[], void (*runAllTests)(struct _Unity * const unity_p), struct _Unity * const unity_p) { int result = UnityGetCommandLineOptions(argc, argv, unity_p); unsigned int r; if (result != 0) return result; for (r = 0; r < unity_p->RepeatCount; r++) { announceTestRun(r, unity_p); UnityBegin(unity_p); runAllTests(unity_p); UNITY_OUTPUT_CHAR('\n'); UnityEnd(unity_p); } return UnityFailureCount(unity_p); }
void UnityIgnoreTest() { Unity.NumberOfTests++; Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('!'); }