void Assert::fail(const char* reason, const char* file, int line)
{
	TestsListener::theInstance().errorsLog() <<
		file << errmsgTag_inLine() << line << "\n" <<
		"Reason: " << reason << "\n";

	TestsListener::theInstance().testHasFailed();
}
void Assert::assertTrue(char* strExpression, bool expression,
		const char* file, int line)
{
	if (!expression)
	{
		TestsListener::theInstance().errorsLog() << "\n"
			<< errmsgTag_testFailedIn() << file 
			<< errmsgTag_inLine() << line << "\n" 
			<< errmsgTag_failedExpression() << strExpression << "\n";
		TestsListener::theInstance().testHasFailed();
	}
}
示例#3
0
void Assert::assertEqualsEpsilon( const double& expected, const double& result, const double& epsilon,
		const char* file, int linia )
{
	if (isNaN(expected) && isNaN(result) ) return;
	if (!isNaN(expected) && !isNaN(result) && fuzzyEquals(expected, result, epsilon) ) return;

	TestsListener::theInstance().errorsLog() 
			<< errmsgTag_testFailedIn() << file
			<< errmsgTag_inLine() << linia << "\n" 
			<< errmsgTag_expected()
			<< bold() << expected << normal() << " "
			<< errmsgTag_butWas() 
			<< bold() << result << normal() << "\n";
	TestsListener::theInstance().testHasFailed();
}