mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-18 03:29:47 +02:00
submitted 1.2.0
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
//
|
||||
// CppUnitException.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/CppUnitException.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/CppUnitException.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
const std::string CppUnitException::CPPUNIT_UNKNOWNFILENAME = "<unknown>";
|
||||
const int CppUnitException::CPPUNIT_UNKNOWNLINENUMBER = -1;
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TestCase.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TestCase.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TestCase.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
using namespace std;
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Create a default TestResult
|
||||
@@ -34,6 +34,20 @@ void TestCase::assertImplementation(bool condition, const std::string& condition
|
||||
}
|
||||
|
||||
|
||||
void TestCase::loop1assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, long data1lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (!condition)
|
||||
throw CppUnitException(conditionExpression, lineNumber, data1lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
void TestCase::loop2assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (!condition)
|
||||
throw CppUnitException(conditionExpression, lineNumber, data1lineNumber, data2lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
// Check for a failed equality assertion
|
||||
void TestCase::assertEquals(long expected, long actual, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
@@ -165,4 +179,4 @@ std::string TestCase::notEqualsMessage(const std::string& expected, const std::s
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// TestDecorator.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TestDecorator.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TestDecorator.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestDecorator.h"
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
TestDecorator::TestDecorator(Test* test)
|
||||
@@ -40,4 +40,4 @@ std::string TestDecorator::toString()
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TestFailure.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TestFailure.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TestFailure.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "CppUnit/Test.h"
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Returns a short description of the failure.
|
||||
@@ -19,4 +19,4 @@ std::string TestFailure::toString()
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,14 +1,14 @@
|
||||
//
|
||||
// TestResult.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TestResult.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TestResult.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestResult.h"
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Destroys a test result
|
||||
@@ -26,4 +26,4 @@ TestResult::~TestResult()
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TestRunner.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TestRunner.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TestRunner.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
TestRunner::TestRunner()
|
||||
@@ -178,4 +178,4 @@ Test* TestRunner::find(const std::string& name, Test* pTest, const std::string&
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TestSuite.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TestSuite.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "CppUnit/TestResult.h"
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Deletes all tests in the suite.
|
||||
@@ -46,4 +46,4 @@ int TestSuite::countTestCases()
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TextTestResult.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/src/TextTestResult.cpp#1 $
|
||||
// $Id: //poco/1.2/CppUnit/src/TextTestResult.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
void TextTestResult::addError(Test* test, CppUnitException* e)
|
||||
@@ -42,6 +42,7 @@ void TextTestResult::printErrors(std::ostream& stream)
|
||||
if (testErrors() != 0)
|
||||
{
|
||||
stream << "\n";
|
||||
|
||||
if (testErrors() == 1)
|
||||
stream << "There was " << testErrors() << " error: " << std::endl;
|
||||
else
|
||||
@@ -57,7 +58,27 @@ void TextTestResult::printErrors(std::ostream& stream)
|
||||
<< ": "
|
||||
<< failure->failedTest()->toString() << "\n"
|
||||
<< " \"" << (e ? e->what() : "") << "\"\n"
|
||||
<< " in \"" << (e ? e->fileName() : std::string()) << "\", line " << (e ? e->lineNumber() : 0) << "\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++;
|
||||
}
|
||||
}
|
||||
@@ -85,11 +106,31 @@ void TextTestResult::printFailures(std::ostream& stream)
|
||||
<< ": "
|
||||
<< failure->failedTest()->toString() << "\n"
|
||||
<< " \"" << (e ? e->what() : "") << "\"\n"
|
||||
<< " in \"" << (e ? e->fileName() : std::string()) << "\", line " << (e ? e->lineNumber() : 0) << "\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++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -130,4 +171,4 @@ std::string TextTestResult::shortName(const std::string& testName)
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
} // namespace CppUnit
|
||||
|
Reference in New Issue
Block a user