00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#include "../GeneralInclude/CompilerSwitches.h"
00012
#include "../GeneralInclude/TestConstants.h"
00013
#include "TestCase.h"
00014
#include <string.h>
00015
00016 TestCase::TestCase(
int id,
char* name) {
00017 testId =
id;
00018
00019 testName =
new char[strlen(name)+1];
00020 strcpy(testName,name);
00021
00022 testResultFlag =
false;
00023 }
00024
00025 void TestCase::setTestResult(
bool outcome,
char* msg) {
00026
00027
if (testResultFlag) {
00028
const char *error =
"INVALID TEST -- SetTestResult called more than once";
00029
00030 testOutcome =
false;
00031 testMessage =
new char[strlen(error)+1];
00032 strcpy(testMessage,error);
00033 }
00034
else {
00035 testOutcome = outcome;
00036 testMessage =
new char[strlen(msg)+1];
00037 strcpy(testMessage,msg);
00038 }
00039 }
00040
00041 bool TestCase::isNonNominalCheckAllowed(
void)
const {
00042
#if defined(NDEBUG) || !defined(USE_SYSTEM_ASSERT)
00043
return true;
00044
#else
00045
return false;
00046
#endif
00047
}
00048
00049 bool TestCase::shutDownTestCase(
void) {
00050
return SHUTDOWN_SUCCESS;
00051 }
00052
00053 bool TestCase::setUpTestCase(
void) {
00054
return INITIALIZATION_SUCCESS;
00055 }
00056
00057 char*
TestCase::getTestName(
void)
const {
00058
return testName;
00059 }
00060
00061 bool TestCase::getTestOutcome(
void)
const {
00062
return testOutcome;
00063 }
00064
00065 char*
TestCase::getTestMessage(
void)
const {
00066
return testMessage;
00067 }