------------------------------------------------------------------------

r206 | cnicholson | 2009-02-01 23:09:01 -0600 (Sun, 01 Feb 2009) | 1 line

- apply patch from tracker issue 2528976, VC6 support from Koji Yoshioka
------------------------------------------------------------------------
This commit is contained in:
Patrick Johnmeyer 2012-12-14 00:24:48 -06:00
parent 270380845c
commit d1c51eb71b
7 changed files with 591 additions and 118 deletions

169
TestUnitTestPP_vs6.dsp Normal file
View file

@ -0,0 +1,169 @@
# Microsoft Developer Studio Project File - Name="TestUnitTestPP_vs6" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** 編集しないでください **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=TestUnitTestPP_vs6 - Win32 Debug
!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。
!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください
!MESSAGE
!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak".
!MESSAGE
!MESSAGE NMAKE の実行時に構成を指定できます
!MESSAGE コマンド ライン上でマクロの設定を定義します。例:
!MESSAGE
!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak" CFG="TestUnitTestPP_vs6 - Win32 Debug"
!MESSAGE
!MESSAGE 選択可能なビルド モード:
!MESSAGE
!MESSAGE "TestUnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Console Application" 用)
!MESSAGE "TestUnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Console Application" 用)
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x411 /d "NDEBUG"
# ADD RSC /l 0x411 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x411 /d "_DEBUG"
# ADD RSC /l 0x411 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "TestUnitTestPP_vs6 - Win32 Release"
# Name "TestUnitTestPP_vs6 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\src\tests\Main.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestAssertHandler.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestCheckMacros.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestChecks.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestCurrentTest.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestDeferredTestReporter.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestMemoryOutStream.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTest.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTestList.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTestMacros.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTestResults.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTestRunner.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTestSuite.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTimeConstraint.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestTimeConstraintMacro.cpp
# End Source File
# Begin Source File
SOURCE=".\src\tests\TestUnitTest++.cpp"
# End Source File
# Begin Source File
SOURCE=.\src\tests\TestXmlTestReporter.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\src\tests\RecordingReporter.h
# End Source File
# Begin Source File
SOURCE=.\src\tests\ScopedCurrentTest.h
# End Source File
# End Group
# End Target
# End Project

260
UnitTestPP_vs6.dsp Normal file
View file

@ -0,0 +1,260 @@
# Microsoft Developer Studio Project File - Name="UnitTestPP_vs6" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** 編集しないでください **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=UnitTestPP_vs6 - Win32 Debug
!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。
!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください
!MESSAGE
!MESSAGE NMAKE /f "UnitTestPP_vs6.mak".
!MESSAGE
!MESSAGE NMAKE の実行時に構成を指定できます
!MESSAGE コマンド ライン上でマクロの設定を定義します。例:
!MESSAGE
!MESSAGE NMAKE /f "UnitTestPP_vs6.mak" CFG="UnitTestPP_vs6 - Win32 Debug"
!MESSAGE
!MESSAGE 選択可能なビルド モード:
!MESSAGE
!MESSAGE "UnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Static Library" 用)
!MESSAGE "UnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Static Library" 用)
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "UnitTestPP_vs6 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x411 /d "NDEBUG"
# ADD RSC /l 0x411 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "UnitTestPP_vs6 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x411 /d "_DEBUG"
# ADD RSC /l 0x411 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "UnitTestPP_vs6 - Win32 Release"
# Name "UnitTestPP_vs6 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\src\AssertException.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Checks.cpp
# End Source File
# Begin Source File
SOURCE=.\src\CurrentTest.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DeferredTestReporter.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DeferredTestResult.cpp
# End Source File
# Begin Source File
SOURCE=.\src\MemoryOutStream.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ReportAssert.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Test.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TestDetails.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TestList.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TestReporter.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TestReporterStdout.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TestResults.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TestRunner.cpp
# End Source File
# Begin Source File
SOURCE=.\src\TimeConstraint.cpp
# End Source File
# Begin Source File
SOURCE=.\src\XmlTestReporter.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\src\AssertException.h
# End Source File
# Begin Source File
SOURCE=.\src\CheckMacros.h
# End Source File
# Begin Source File
SOURCE=.\src\Checks.h
# End Source File
# Begin Source File
SOURCE=.\src\Config.h
# End Source File
# Begin Source File
SOURCE=.\src\CurrentTest.h
# End Source File
# Begin Source File
SOURCE=.\src\DeferredTestReporter.h
# End Source File
# Begin Source File
SOURCE=.\src\DeferredTestResult.h
# End Source File
# Begin Source File
SOURCE=.\src\ExecuteTest.h
# End Source File
# Begin Source File
SOURCE=.\src\MemoryOutStream.h
# End Source File
# Begin Source File
SOURCE=.\src\ReportAssert.h
# End Source File
# Begin Source File
SOURCE=.\src\Test.h
# End Source File
# Begin Source File
SOURCE=.\src\TestDetails.h
# End Source File
# Begin Source File
SOURCE=.\src\TestList.h
# End Source File
# Begin Source File
SOURCE=.\src\TestMacros.h
# End Source File
# Begin Source File
SOURCE=.\src\TestReporter.h
# End Source File
# Begin Source File
SOURCE=.\src\TestReporterStdout.h
# End Source File
# Begin Source File
SOURCE=.\src\TestResults.h
# End Source File
# Begin Source File
SOURCE=.\src\TestRunner.h
# End Source File
# Begin Source File
SOURCE=.\src\TestSuite.h
# End Source File
# Begin Source File
SOURCE=.\src\TimeConstraint.h
# End Source File
# Begin Source File
SOURCE=.\src\TimeHelpers.h
# End Source File
# Begin Source File
SOURCE=".\src\UnitTest++.h"
# End Source File
# Begin Source File
SOURCE=.\src\XmlTestReporter.h
# End Source File
# End Group
# Begin Group "Win32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\Win32\TimeHelpers.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Win32\TimeHelpers.h
# End Source File
# End Group
# End Target
# End Project

44
UnitTestPP_vs6.dsw Normal file
View file

@ -0,0 +1,44 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# 警告: このワークスペース ファイル を編集または削除しないでください!
###############################################################################
Project: "TestUnitTestPP_vs6"=".\TestUnitTestPP_vs6.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name UnitTestPP_vs6
End Project Dependency
}}}
###############################################################################
Project: "UnitTestPP_vs6"=".\UnitTestPP_vs6.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -1,29 +1,28 @@
#include "DeferredTestReporter.h"
#include "TestDetails.h"
#include "Config.h"
using namespace UnitTest;
void DeferredTestReporter::ReportTestStart(TestDetails const& details)
{
m_results.push_back(DeferredTestResult(details.suiteName, details.testName));
}
void DeferredTestReporter::ReportFailure(TestDetails const& details, char const* failure)
{
DeferredTestResult& r = m_results.back();
r.failed = true;
r.failures.push_back(DeferredTestResult::Failure(details.lineNumber, failure));
r.failureFile = details.filename;
}
void DeferredTestReporter::ReportTestFinish(TestDetails const&, float secondsElapsed)
{
DeferredTestResult& r = m_results.back();
r.timeElapsed = secondsElapsed;
}
DeferredTestReporter::DeferredTestResultList& DeferredTestReporter::GetResults()
{
return m_results;
}
#include "DeferredTestReporter.h"
#include "TestDetails.h"
using namespace UnitTest;
void DeferredTestReporter::ReportTestStart(TestDetails const& details)
{
m_results.push_back(DeferredTestResult(details.suiteName, details.testName));
}
void DeferredTestReporter::ReportFailure(TestDetails const& details, char const* failure)
{
DeferredTestResult& r = m_results.back();
r.failed = true;
r.failures.push_back(DeferredTestResult::Failure(details.lineNumber, failure));
r.failureFile = details.filename;
}
void DeferredTestReporter::ReportTestFinish(TestDetails const&, float secondsElapsed)
{
DeferredTestResult& r = m_results.back();
r.timeElapsed = secondsElapsed;
}
DeferredTestReporter::DeferredTestResultList& DeferredTestReporter::GetResults()
{
return m_results;
}

View file

@ -1,28 +1,29 @@
#ifndef UNITTEST_DEFERREDTESTREPORTER_H
#define UNITTEST_DEFERREDTESTREPORTER_H
#include "TestReporter.h"
#include "DeferredTestResult.h"
#include <vector>
namespace UnitTest
{
class DeferredTestReporter : public TestReporter
{
public:
virtual void ReportTestStart(TestDetails const& details);
virtual void ReportFailure(TestDetails const& details, char const* failure);
virtual void ReportTestFinish(TestDetails const& details, float secondsElapsed);
typedef std::vector< DeferredTestResult > DeferredTestResultList;
DeferredTestResultList& GetResults();
private:
DeferredTestResultList m_results;
};
}
#endif
#ifndef UNITTEST_DEFERREDTESTREPORTER_H
#define UNITTEST_DEFERREDTESTREPORTER_H
#include "TestReporter.h"
#include "DeferredTestResult.h"
#include "Config.h"
#include <vector>
namespace UnitTest
{
class DeferredTestReporter : public TestReporter
{
public:
virtual void ReportTestStart(TestDetails const& details);
virtual void ReportFailure(TestDetails const& details, char const* failure);
virtual void ReportTestFinish(TestDetails const& details, float secondsElapsed);
typedef std::vector< DeferredTestResult > DeferredTestResultList;
DeferredTestResultList& GetResults();
private:
DeferredTestResultList m_results;
};
}
#endif

View file

@ -1,6 +1,8 @@
#ifndef UNITTEST_DEFERREDTESTRESULT_H
#define UNITTEST_DEFERREDTESTRESULT_H
#include "Config.h"
#include <string>
#include <vector>

View file

@ -1,61 +1,59 @@
#ifndef UNITTEST_TESTRUNNER_H
#define UNITTEST_TESTRUNNER_H
#include "Test.h"
#include "TestList.h"
#include "CurrentTest.h"
namespace UnitTest {
class TestReporter;
class TestResults;
class Timer;
int RunAllTests();
struct True
{
bool operator()(const Test* const) const
{
return true;
}
};
class TestRunner
{
public:
explicit TestRunner(TestReporter& reporter);
~TestRunner();
template <class Predicate>
int RunTestsIf(TestList const& list, char const* suiteName,
const Predicate& predicate, int maxTestTimeInMs) const
{
Test* curTest = list.GetHead();
while (curTest != 0)
{
if (IsTestInSuite(curTest,suiteName) && predicate(curTest))
{
RunTest(m_result, curTest, maxTestTimeInMs);
}
curTest = curTest->next;
}
return Finish();
}
private:
TestReporter* m_reporter;
TestResults* m_result;
Timer* m_timer;
int Finish() const;
bool IsTestInSuite(const Test* const curTest, char const* suiteName) const;
void RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const;
};
}
#endif
#ifndef UNITTEST_TESTRUNNER_H
#define UNITTEST_TESTRUNNER_H
#include "Test.h"
#include "TestList.h"
#include "CurrentTest.h"
namespace UnitTest {
class TestReporter;
class TestResults;
class Timer;
int RunAllTests();
struct True
{
bool operator()(const Test* const) const
{
return true;
}
};
class TestRunner
{
public:
explicit TestRunner(TestReporter& reporter);
~TestRunner();
template <class Predicate>
int RunTestsIf(TestList const& list, char const* suiteName,
const Predicate& predicate, int maxTestTimeInMs) const
{
Test* curTest = list.GetHead();
while (curTest != 0)
{
if (IsTestInSuite(curTest, suiteName) && predicate(curTest))
RunTest(m_result, curTest, maxTestTimeInMs);
curTest = curTest->next;
}
return Finish();
}
private:
TestReporter* m_reporter;
TestResults* m_result;
Timer* m_timer;
int Finish() const;
bool IsTestInSuite(const Test* const curTest, char const* suiteName) const;
void RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const;
};
}
#endif