test/test-automation/plain_logger.c
changeset 5743 3f79a693acd3
parent 5742 443d356b5af8
child 5746 b7a0b33b08f4
equal deleted inserted replaced
5742:443d356b5af8 5743:3f79a693acd3
     4 
     4 
     5 #include <stdio.h>
     5 #include <stdio.h>
     6 
     6 
     7 #include <SDL/SDL.h>
     7 #include <SDL/SDL.h>
     8 
     8 
       
     9 #include "logger_helpers.h"
     9 #include "plain_logger.h"
    10 #include "plain_logger.h"
       
    11 
    10 
    12 
    11 
    13 
    12 static int indentLevel;
    14 static int indentLevel;
    13 
    15 
    14 /*!
    16 /*!
    36 
    38 
    37 void
    39 void
    38 PlainRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
    40 PlainRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
    39 				void *data)
    41 				void *data)
    40 {
    42 {
    41 	/*
    43 	Output(indentLevel, "Test run started at %s", TimestampToString(eventTime));
    42     Output("Test run started with following parameters\n");
    44 	Output(indentLevel, "");
       
    45     /*
       
    46 	Output(indentLevel, "Runner: ");
    43 
    47 
    44 	int counter = 0;
    48 	int counter = 0;
    45 	for(counter = 0; counter < parameterCount; counter++) {
    49 	for(counter = 0; counter < parameterCount; counter++) {
    46 		char *parameter = runnerParameters[counter];
    50 		char *parameter = runnerParameters[counter];
    47 		Output("\t%s", parameter);
    51 		Output(indentLevel, "\t%s", parameter);
    48 	}
    52 	}
    49 	*/
    53 	*/
    50 }
    54 }
    51 
    55 
    52 void
    56 void
    53 PlainRunEnded(int testCount, int suiteCount, int testPassCount, int testFailCount,
    57 PlainRunEnded(int testCount, int suiteCount, int testPassCount, int testFailCount,
    54               time_t endTime, double totalRuntime)
    58               time_t endTime, double totalRuntime)
    55 {
    59 {
    56 	Output(indentLevel, "\nRan %d tests in %0.5f seconds from %d suites.",
    60 	Output(indentLevel, "Ran %d tests in %0.5f seconds from %d suites.",
    57 			testCount, totalRuntime, suiteCount);
    61 			testCount, totalRuntime, suiteCount);
    58 
    62 
    59 	Output(indentLevel, "%d tests passed", testPassCount);
    63 	Output(indentLevel, "%d tests passed", testPassCount);
    60 	Output(indentLevel, "%d tests failed", testFailCount);
    64 	Output(indentLevel, "%d tests failed", testFailCount);
    61 }
    65 }
    76 }
    80 }
    77 
    81 
    78 void
    82 void
    79 PlainTestStarted(const char *testName, const char *suiteName, const char *testDescription, time_t startTime)
    83 PlainTestStarted(const char *testName, const char *suiteName, const char *testDescription, time_t startTime)
    80 {
    84 {
    81 	Output(indentLevel++, "%s (in %s) started", testName, suiteName);
    85 	Output(indentLevel++, "Executing test: %s (in %s)", testName, suiteName);
    82 }
    86 }
    83 
    87 
    84 void
    88 void
    85 PlainTestEnded(const char *testName, const char *suiteName,
    89 PlainTestEnded(const char *testName, const char *suiteName,
    86           int testResult, time_t endTime, double totalRuntime)
    90           int testResult, time_t endTime, double totalRuntime)
   104 	Output(indentLevel, "%s: %s", assertName, assertMessage);
   108 	Output(indentLevel, "%s: %s", assertName, assertMessage);
   105 }
   109 }
   106 
   110 
   107 void
   111 void
   108 PlainAssertWithValues(const char *assertName, int assertResult, const char *assertMessage,
   112 PlainAssertWithValues(const char *assertName, int assertResult, const char *assertMessage,
   109 		int actualValue, int excpected, time_t eventTime)
   113 		int actualValue, int expected, time_t eventTime)
   110 {
   114 {
   111 	const char *result = (assertResult) ? "passed" : "failed";
   115 	const char *result = (assertResult) ? "passed" : "failed";
   112 	Output(indentLevel, "%s %d: %s", assertName, assertResult, assertMessage);
   116 	Output(indentLevel, "%s %d (expected %d, actualValue &d): %s",
       
   117 			assertName, assertResult, expected, actualValue, assertMessage);
   113 }
   118 }
   114 
   119 
   115 void
   120 void
   116 PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass, time_t eventTime)
   121 PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass, time_t eventTime)
   117 {
   122 {