2011-06-21 22:04:44 +03:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2011-06-24 14:35:14 +03:00
|
|
|
#include <SDL/SDL.h>
|
|
|
|
|
2011-06-21 22:04:44 +03:00
|
|
|
#include "logger.h"
|
|
|
|
#include "xml_logger.h"
|
|
|
|
#include "plain_logger.h"
|
|
|
|
|
|
|
|
// Pointers to selected logger implementation
|
|
|
|
RunStartedFp RunStarted = 0;
|
|
|
|
RunEndedFp RunEnded = 0;
|
|
|
|
SuiteStartedFp SuiteStarted = 0;
|
|
|
|
SuiteEndedFp SuiteEnded = 0;
|
|
|
|
TestStartedFp TestStarted = 0;
|
|
|
|
TestEndedFp TestEnded = 0;
|
|
|
|
AssertFp Assert = 0;
|
2011-06-26 23:04:37 +03:00
|
|
|
AssertSummaryFp AssertSummary = 0;
|
2011-06-21 22:04:44 +03:00
|
|
|
LogFp Log = 0;
|
|
|
|
|
2011-06-26 23:04:37 +03:00
|
|
|
int
|
|
|
|
SetupXMLLogger()
|
|
|
|
{
|
|
|
|
RunStarted = XMLRunStarted;
|
|
|
|
RunEnded = XMLRunEnded;
|
|
|
|
|
|
|
|
SuiteStarted = XMLSuiteStarted;
|
|
|
|
SuiteEnded = XMLSuiteEnded;
|
|
|
|
|
|
|
|
TestStarted = XMLTestStarted;
|
|
|
|
TestEnded = XMLTestEnded;
|
|
|
|
|
|
|
|
Assert = XMLAssert;
|
|
|
|
AssertSummary = XMLAssertSummary;
|
|
|
|
|
|
|
|
Log = XMLLog;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
SetupPlainLogger()
|
|
|
|
{
|
|
|
|
RunStarted = PlainRunStarted;
|
|
|
|
RunEnded = PlainRunEnded;
|
|
|
|
|
|
|
|
SuiteStarted = PlainSuiteStarted;
|
|
|
|
SuiteEnded = PlainSuiteEnded;
|
|
|
|
|
|
|
|
TestStarted = PlainTestStarted;
|
|
|
|
TestEnded = PlainTestEnded;
|
|
|
|
|
|
|
|
Assert = PlainAssert;
|
|
|
|
AssertSummary = PlainAssertSummary;
|
|
|
|
|
|
|
|
Log = PlainLog;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
2011-06-21 22:04:44 +03:00
|
|
|
/*!
|
|
|
|
* Test app for logging functionality
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int xml_enabled = 1;
|
|
|
|
|
|
|
|
if(xml_enabled) {
|
2011-06-26 23:04:37 +03:00
|
|
|
SetupXMLLogger();
|
2011-06-21 22:04:44 +03:00
|
|
|
} else {
|
2011-06-26 23:04:37 +03:00
|
|
|
SetupPlainLogger();
|
2011-06-21 22:04:44 +03:00
|
|
|
}
|
|
|
|
|
2011-06-27 11:53:14 +03:00
|
|
|
RunStarted(Output, "some_<data_>here&here", 0);
|
2011-06-21 22:04:44 +03:00
|
|
|
SuiteStarted("Suite data here", 0);
|
|
|
|
|
2011-06-22 17:41:37 +03:00
|
|
|
TestStarted("test1", "suite", "desc", 0);
|
|
|
|
TestEnded("test1", "suite", 0, 0, 0, 0);
|
2011-06-21 22:04:44 +03:00
|
|
|
|
|
|
|
SuiteEnded(0, 0, 0, 0.0f, 0);
|
2011-06-22 17:41:37 +03:00
|
|
|
RunEnded(0, 0, 0, 0, 0, 0);
|
2011-06-21 22:04:44 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2011-06-26 23:04:37 +03:00
|
|
|
#endif
|