void TextTestResult::printFailures (std::ostream &stream)
{
	if ( testFailures () != 0 ) {
		if (testFailures () == 1) {
			stream << "There was " << testFailures () << " failure: " << std::endl;
		} else {
			stream << "There were " << testFailures () << " failures: " << std::endl;
		}

		printCauses(stream, failures());
	}
}
Beispiel #2
0
void TextTestResult::printFailures(std::ostream& stream)
{
    if (testFailures() != 0)
    {
        stream << "\n";
        if (testFailures() == 1)
            stream << "There was " << testFailures() << " failure: " << std::endl;
        else
            stream << "There were " << testFailures() << " failures: " << std::endl;

        int i = 1;

        for (std::vector<TestFailure*>::iterator it = failures().begin(); it != failures().end(); ++it)
        {
            TestFailure* failure = *it;
            CppUnitException* e = failure->thrownException();

            stream << std::setw(2) << i
                   << ": "
                   << failure->failedTest()->toString() << "\n"
                   << "    \"" << (e ? e->what() : "") << "\"\n"
                   << "    in \""
                   << (e ? e->fileName() : std::string())
                   << "\", line ";
            if (e == 0)
            {
                stream << "0";
            }
            else
            {
                stream << e->lineNumber();
                if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
                {
                    stream << " data lines "
                           << e->data1LineNumber()
                           << ", " << e->data2LineNumber();
                }
                else if (e->data1LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
                {
                    stream << " data line " << e->data1LineNumber();
                }
            }
            stream << "\n";
            i++;
        }
    }
}
Beispiel #3
0
int
Test::Main()
{
    TEST_INIT("programoptions_test");
    srandom(1);
    testSyntaxPage();
    testNormalUsage();
    testFailures();
    testVectorArgument();
    testAllHiddenOption();
    // Currently not supported
    // testOptionsAfterArguments();
    TEST_DONE();
}
Beispiel #4
0
void TextTestResult::printHeader(std::ostream& stream)
{
    stream << "\n\n";
    if (wasSuccessful())
        stream << "OK ("
               << runTests() << " tests)"
               << std::endl;
    else
        stream << "!!!FAILURES!!!" << std::endl
               << "Runs: "
               << runTests ()
               << "   Failures: "
               << testFailures ()
               << "   Errors: "
               << testErrors ()
               << std::endl;
}
void TextTestResult::printHeader (std::ostream &stream)
{
	if (wasSuccessful ())
		std::cout << "OK (" << runTests () << " tests and "
			 << testSuccesses() << " assertions in " << elapsedTime() << " ms)" << std::endl;
	else
		std::cout << std::endl
			 << "!!!FAILURES!!!" << std::endl
			 << "Test Results:" << std::endl
			 << "Run:  "
			 << runTests ()
			 << "   Failures: "
			 << testFailures ()
			 << "   Errors: "
			 << testErrors ()
			 << std::endl
			 << "(" << testSuccesses() << " assertions ran successfully in " << elapsedTime() << " ms)" << std::endl;

}