Esempio n. 1
0
void QTestResult::finishedCurrentTestData()
{
    if (QTest::expectFailMode)
        addFailure("QEXPECT_FAIL was called without any subsequent verification statements", 0, 0);
    clearExpectFail();

    if (!QTest::failed && QTestLog::unhandledIgnoreMessages()) {
        QTestLog::printUnhandledIgnoreMessages();
        addFailure("Not all expected messages were received", 0, 0);
    }
    QTestLog::clearIgnoreMessages();
}
void COMErrorHook(StatusType error){
	
	com_error_instance++;
	switch (com_error_instance)
	{
		case 1:
			TestRunner_runTest(COMInternalTest_seq2_comerror_instance1());
			break;
		case 2:
			TestRunner_runTest(COMInternalTest_seq2_comerror_instance2());
			break;
		case 3:
			TestRunner_runTest(COMInternalTest_seq2_comerror_instance3());
			break;
		case 4:
			TestRunner_runTest(COMInternalTest_seq2_comerror_instance4());
			break;
		case 5:
			TestRunner_runTest(COMInternalTest_seq2_comerror_instance5());
			break;
		default:
			addFailure("instance error\n", __LINE__, __FILE__);
			break;
	}
}
Esempio n. 3
0
void 
TestResult::addError( Test *test, 
                      Exception *e )
{ 
  TestFailure failure( test, e, true );
  addFailure( failure );
}
Esempio n. 4
0
ProtectionReturnType ProtectionHook(StatusType Fatalerror)
{
  Fatalerrorstatus = Fatalerror;
	instance_protection++;
  stdimpl_print("ProtectionHook:%d\n",instance_protection);
	switch (instance_protection)
	{
		case 1 :
		{
      TestRunner_runTest(AutosarTPTest_seq4_protection_instance1());
			break;
		}
		case 2 :
		{
      TestRunner_runTest(AutosarTPTest_seq4_protection_instance2());
			break;
		}
		default:
		{
			addFailure("ProtectionHook : Instance error\n", __LINE__, __FILE__);
			break;
		}
	}
  
  return PRO_TERMINATETASKISR;
	
}
Esempio n. 5
0
void TestSuite::suiteAssertTrue(Test& test, bool condition, int lineNumber) {
    if (!condition && test.successful) {
        test.successful = false;
        addFailure();
        reporter->reportFailure(test, adjustLineNumber(lineNumber));
    }
}
Esempio n. 6
0
void ErrorHook(StatusType error)
{
	instance_error++;
	switch (instance_error)
	{
		case 1 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance1());	
			break;
		}
		case 2 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance2());	
			break;
		}
		case 3 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance3());	
			break;
		}
		case 4 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance4());	
			break;
		}
		case 5 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance5());	
			break;
		}
		case 6 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance6());	
			break;
		}
		case 7 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance7());	
			break;
		}
		case 8 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance8());	
			break;
		}
		case 9 :
		{
			TestRunner_runTest(AutosarSTTest_seq1_error_instance9());	
			break;
		}
		default:
		{
			addFailure("Instance error", __LINE__, __FILE__);
			break;
		}
	}
	
}
Esempio n. 7
0
void TestSuite::suiteAssertEquals(Test& test, int expected, int actual, int lineNumber) {
    bool areEqual = (expected == actual);
    if (!areEqual && test.successful) {
        test.successful = false;
        addFailure();

        char expectedBuffer[MAX_INTEGER_LENGTH];
        integerToString(expected, expectedBuffer);

        char actualBuffer[MAX_INTEGER_LENGTH];
        integerToString(actual, actualBuffer);

        reporter->reportEqualityFailure(test, adjustLineNumber(lineNumber), expectedBuffer, actualBuffer);
    }
}
Esempio n. 8
0
void assertImplementationInt(int expected,int actual, long line, const char *file)
{
	char buffer[32];	/*"exp -2147483647 was -2147483647"*/
	char numbuf[12];	/*32bit int decimal maximum column is 11 (-2147483647~2147483647)*/

	stdimpl_strcpy(buffer, "exp ");

	{	stdimpl_itoa(expected, numbuf, 10);
		stdimpl_strncat(buffer, numbuf, 11);	}

	stdimpl_strcat(buffer, " was ");

	{	stdimpl_itoa(actual, numbuf, 10);
		stdimpl_strncat(buffer, numbuf, 11);	}

	addFailure(buffer, line, file);
}
Esempio n. 9
0
void assertImplementationCStr(const char *expected,const char *actual, long line, const char *file)
{
	char buffer[ASSERT_STRING_BUFFER_MAX];
	#define exp_act_limit ((ASSERT_STRING_BUFFER_MAX-11-1)/2)/*	"exp'' was''" = 11 byte	*/
	int el;
	int al;

	if (expected) {
		el = stdimpl_strlen(expected);
	} else {
		el = 4;
		expected = "null";
	}

	if (actual) {
		al = stdimpl_strlen(actual);
	} else {
		al = 4;
		actual = "null";
	}
	if (el > exp_act_limit) {
		if (al > exp_act_limit) {
			al = exp_act_limit;
			el = exp_act_limit;
		} else {
			int w = exp_act_limit + (exp_act_limit - al);
			if (el > w) {
				el = w;
			}
		}
	} else {
		int w = exp_act_limit + (exp_act_limit - el);
		if (al > w) {
			al = w;
		}
	}
	stdimpl_strcpy(buffer, "exp \"");
	stdimpl_strncat(buffer, expected, el);
	stdimpl_strcat(buffer, "\" was \"");
	stdimpl_strncat(buffer, actual, al);
	stdimpl_strcat(buffer, "\"");

	addFailure(buffer, line, file);
}
Esempio n. 10
0
bool QTestResult::expectFail(const char *dataIndex, const char *comment,
                             QTest::TestFailMode mode, const char *file, int line)
{
    QTEST_ASSERT(comment);
    QTEST_ASSERT(mode > 0);

    if (!isExpectFailData(dataIndex))
        return true; // we don't care

    if (QTest::expectFailMode) {
        clearExpectFail();
        addFailure("Already expecting a fail", file, line);
        return false;
    }

    QTest::expectFailMode = mode;
    QTest::expectFailComment = comment;
    return true;
}
Esempio n. 11
0
bool MprTestResult::assertTrue(MprTest *test, char *file, int line, 
	bool success, char *testCode) 
{
	if (! success) {
		if (getDebugOnFailures()) {
			mprBreakpoint(0, 0, 0);
		}
		addFailure(new MprTestFailure(file, line, testCode));
		if (test->getFailureCount() == 0) {
			lock();
			testFailedCount++;
			unlock();
		}
		test->adjustFailureCount(1);
	} else {
		addSuccess(test);
	}
	return success;
}
Esempio n. 12
0
void QTestResult::finishedCurrentTestFunction()
{
    if (!QTest::failed && QTestLog::unhandledIgnoreMessages()) {
        QTestLog::printUnhandledIgnoreMessages();
        addFailure("Not all expected messages were received", 0, 0);
    }

    if (!QTest::failed && !QTest::skipCurrentTest) {
        QTestLog::addPass("");
        ++QTest::passes;
    }
    QTest::currentTestFunc = 0;
    QTest::failed = false;
    QTest::dataFailed = false;
    QTest::location = NoWhere;

    QTestLog::leaveTestFunction();

    clearExpectFail();
}
Esempio n. 13
0
void ErrorHook(StatusType error)
{
  addFailure("ErrorHook : Instance error\n", __LINE__, __FILE__);	
}
Esempio n. 14
0
void 
TestResult::addFailure( Test *test, Exception *e )
{ 
  TestFailure failure( test, e, false );
  addFailure( failure );
}