Пример #1
0
void test_caseStartv(const char *fmt,va_list ap) {
	testPrintf("== Testcase %d : ",testCase++);
	testvPrintf(fmt,ap);
	testPrintf(" ==\n");
	fflush(stdout);
	assertCount = 0;
}
Пример #2
0
void newline()
{
#ifdef _MSC_VER
	SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	testPrintf("\n");
#else
	testPrintf(NEWLINE);
#endif
}
Пример #3
0
void test_caseFailed(const char *fmt,...) {
	va_list ap;
	testPrintf("== >> \033[co;4]%s\033[co] : ","FAILED");
	va_start(ap,fmt);
	testvPrintf(fmt,ap);
	va_end(ap);
	testPrintf(" ==\n\n");
	totalFail++;
	failCount++;
}
Пример #4
0
int main(int argc, char** argv)
{
    char* path;
    FILE* f;

    if(argc > 1)
    {
        f = fopen(argv[1], "w");
        path = argv[1];
    }
    else
    {
        f = stdout;
        path = "stdout";
    }
    printf("A test of \"fprintf\" to file: \"%s\".\r\n\n", path);

    if(f != (FILE*)0)
    {
        testPrintf(f);
		testFputs(f);
    }
    else
    {
        printf("File could not be opened.\r\n" );
    }

    return 0;
}
Пример #5
0
void echoAborted()
{
	if (isTTY)
		testPrintf("\n" BRACKET "[" FAILURE " **** ABORTED **** " BRACKET "]" NEWLINE);
	else
		printAborted();
	throw threadExit_t(2);
}
Пример #6
0
void echoSkip()
{
	if (isTTY)
		testPrintf(" " SET_COL BRACKET "[" WARNING " SKIP " BRACKET "]" NEWLINE, COL(getColumns()));
	else
		printSkip();
	++passes;
}
Пример #7
0
void echoFailure()
{
	if (isTTY)
		testPrintf(" " SET_COL BRACKET "[" FAILURE " FAIL " BRACKET "]" NEWLINE, COL(getColumns()));
	else
		printFailure();
	++failures;
}
Пример #8
0
void echoAborted()
{
	if (isTTY)
	{
		SetConsoleTextAttribute(console, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
		testPrintf("[");
		SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_INTENSITY);
		testPrintf(" **** ABORTED **** ");
		SetConsoleTextAttribute(console, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
		testPrintf("]");
		SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
		testPrintf("\n");
	}
	else
		printAborted();
	throw threadExit_t(2);
}
Пример #9
0
void *testRunner(void *self)
{
	unitTest *test = (unitTest *)self;
	if (isTTY != 0)
#ifndef _MSC_VER
		testPrintf(INFO);
#else
		SetConsoleTextAttribute(console, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
#endif
	testPrintf("%s...", test->theTest->testName);
	if (isTTY != 0)
#ifndef _MSC_VER
		testPrintf(NEWLINE);
#else
		newline();
#endif
	else
Пример #10
0
void echoOk()
{
	if (isTTY)
		testPrintf(CURS_UP SET_COL BRACKET "[" SUCCESS "  OK  " BRACKET "]" NEWLINE, COL(getColumns()));
	else
		printOk();
	++passes;
}
Пример #11
0
void normal()
{
#ifndef _MSC_VER
	testPrintf(NORMAL);
#else
	SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
#endif
}
Пример #12
0
void echoSkip()
{
	if (isTTY)
	{
		CONSOLE_SCREEN_BUFFER_INFO cursor;
		GetConsoleScreenBufferInfo(console, &cursor);
		cursor.dwCursorPosition.X = COL(getColumns());
		SetConsoleCursorPosition(console, cursor.dwCursorPosition);
		SetConsoleTextAttribute(console, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
		testPrintf("[");
		SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
		testPrintf(" SKIP ");
		SetConsoleTextAttribute(console, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
		testPrintf("]");
		SetConsoleTextAttribute(console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
		testPrintf("\n");
	}
	else
		printSkip();
}
Пример #13
0
void printOk() { testPrintf(" [  OK  ]\n"); }
Пример #14
0
void test_caseSucceeded(void) {
	testPrintf("== >> \033[co;2]%s\033[co] ==\n\n","SUCCESS");
	totalSucc++;
	succCount++;
}
Пример #15
0
void init()
{
	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default

	/*There are four debug levels: debug=3, info=2, warn=1, error=0
	 * You can set the debug level by making with DEBUG_VERBOSE_LEVEL
	 * set to the desired level (0-3). Ex make rebuild DEBUG_VERBOSE_LEVEL=2 will
	 * show only info messages and above, will not show debug messages
	 * (they will be removed from the build at compile time, saving flash space)
	 *
	 * Functions debugf, debug_d, debug_i, debug_w, and debug_e store the format string
	 * in flash so that the RAM is freed for more important information.
	 *
	 * Another useful feature is printing the filename and line number of every debug line
	 * This will require extra space on flash and can be enabled
	 * using make parameter PRINT_FILENAME_AND_LINE=1*/

	debug_d("(DEBUG) message printed on UART0");

	debug_i("(INFO) message printed on UART0");

	debug_w("(WARNING) message printed on UART0");

	debug_e("(ERROR) message printed on UART0");

	/*debugf is equivalent to debug_i*/
	debugf("(INFO) message printed with debugf on UART0");

	/*
	 * Notice: The line below disables the debugf output on all UARTs.
	 */
	Serial.systemDebugOutput(false);

	debugf("(DEBUG) don't print me at all");

	/*
	 * The debugf output is redirected to UART0
	 * together with the system debug messages.
	 */
	Serial.systemDebugOutput(true);
	delay(200);

	debugf("(DEBUG) print me again on UART0");

	/**
	 * Serial1 uses UART1, TX pin is GPIO2.
	 * UART1 can not be used to receive data because normally
	 * it's RX pin is occupied for flash chip connection.
	 *
	 * If you have a spare serial to USB converter do the following to see the
	 * messages printed on UART1:
	 * - connect converter GND to esp8266 GND
	 * - connect converter RX to esp8266 GPIO2
	 */
	HardwareSerial Serial1(UART1);
	Serial1.begin(SERIAL_BAUD_RATE);

	/*
	 * The line below redirect debug output to UART1
	 */
	Serial1.systemDebugOutput(true);
	Serial1.printf("====Debug Information=====\n");

	debugf("(DEBUG) message printed on UART1"); // You should see the debug message in UART1 only.

	procTimer.initializeMs(2000, sayHello).start();

	testPrintf();

	/// Reading callback example:
	//  * Option 1
	//	Set Serial Callback to global routine:
	//	   Serial.setCallback(onDataCallback);
	// If you want to test local echo set the following callback
	//	   Serial.setCallback(echoCallback);

	// 	* Option 2
	//  Instantiate hwsDelegateDemo which includes Serial Delegate class
	delegateDemoClass.begin();
}
Пример #16
0
void printAborted() { testPrintf("[ **** ABORTED **** ]\n"); }
Пример #17
0
void printSkip() { testPrintf(" [ SKIP ]\n"); }
Пример #18
0
void printFailure() { testPrintf(" [ FAIL ]\n"); }
Пример #19
0
void test_start(void) {
	size_t i;
	testPrintf("\n====== Starting test-procedure ======\n");

	for(i = 0; i < moduleCount; i++) {
		testPrintf("---- Starting with module %d : \"%s\" ----\n\n",i,modules[i]->name);

		testCase = 1;
		succCount = 0;
		failCount = 0;
		modules[i]->start();

		if(!failCount)
			modsSucc++;
		else
			modsFailed++;

		testPrintf("---- Module \"%s\" finished. Summary: ----\n",modules[i]->name);
		testPrintf("-- \033[co;2]%d\033[co] testcases successfull --\n",succCount);
		testPrintf("-- \033[co;4]%d\033[co] testcases failed --\n",failCount);
		testPrintf("----------------------------------\n\n");
	}

	testPrintf("====== All modules done ======\n");
	testPrintf("== \033[co;2]%d\033[co] modules successfull ==\n",modsSucc);
	testPrintf("== \033[co;4]%d\033[co] modules failed ==\n",modsFailed);
	testPrintf("== \033[co;2]%d\033[co] testcases successfull ==\n",totalSucc);
	testPrintf("== \033[co;4]%d\033[co] testcases failed ==\n",totalFail);
	testPrintf("============================\n");
}