Example #1
0
void utest_startTest(void(*fncTest)(void),void(*fncBefore)(void),char* testName)
{
	if(fncTest!=0)
	{
	    utest_print("--------------------------------------------------------------------\r\n");
		utest_flagTestError=0;
		utest_print1("%-40s\r\n",testName);

		if(fncBefore!=0)
			fncBefore();
		utest_totalTestsCounter++;
		fncTest();
		if(utest_flagTestError==1)
		{
			utest_print2("TEST FAILED\r\nFILE:%s LINE:%d\r\n",utest_fileTestError,utest_lineTestError);
		}
		else
		{
			utest_print("TEST OK\r\n");
			utest_okTestsCounter++;
		}


	}
}
Example #2
0
void utest_printStatistics(void)
{
	utest_print("Unit Tests Statistics\r\n");
	if(utest_totalTestsCounter>0)
	{
		int per = (int)(((float)utest_okTestsCounter/(float)utest_totalTestsCounter)*100.0);
		utest_print1("Tests OK : %d %%\r\n",per);
		utest_print2("Tests: %d. Failed Tests: %d\r\n",utest_totalTestsCounter,(utest_totalTestsCounter-utest_okTestsCounter));
	}
	else
		utest_print("No tests executed.\r\n");

}