-
Notifications
You must be signed in to change notification settings - Fork 178
Required macro as for loop (with issues fixed) #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
0e14178
Merge pull request #1 from paleozogt/master
1420866
Closes #2
pjohnmeyer 7985b39
Merged googlecode branch, closes #3
pjohnmeyer dca2b86
Setting up an initial .gitattributes to start dealing with line endings
pjohnmeyer b982592
Fix inadvertent 'crlt' for .vcxproj
pjohnmeyer 4108d5e
Normalized line endings
pjohnmeyer df208ee
Compare char* with char* to fix OS X build with clang.
33e90e6
CHECK_EQUAL no longer crashes if string pointers are NULL.
pjohnmeyer 3a5205f
Added test verifying that UNITTEST_TIME_CONSTRAINT works in TEST_FIXT…
pjohnmeyer 79172d0
Refactored SlowTestWithTimeExemptionPass into two tests, defined in t…
pjohnmeyer 0f5e457
Merge pull request #25 from pjohnmeyer/fixCheckEqualExplodesIfNull
pjohnmeyer 8faa479
Merge pull request #26 from pjohnmeyer/fixUnitTestTimeConstraintExemp…
pjohnmeyer 1c714a4
Changed all parameters to TestReporterStdout::ReportSummary to be con…
pjohnmeyer a695db5
Merge pull request #27 from pjohnmeyer/declarationDefinitionMismatch
pjohnmeyer 4c366ee
Changed sprintf to snprintf in MemoryOutStream::FormatToStream. Remov…
pjohnmeyer e6c9311
Merge pull request #28 from pjohnmeyer/fixCheckEqualCrashForLargeNumbers
pjohnmeyer 3f5d9bd
Converted integral stream testing to min/max/mid style. Added hard-co…
pjohnmeyer d598bdd
Merge pull request #29 from pjohnmeyer/removeSizeDependenciesFromTest…
pjohnmeyer 18a9a2f
Fixes compile error with MSC.
rioki 4266528
Adds Visual Studio 2010 project files.
rioki 426d749
Adds .gitignore.
rioki dff0c44
Merge pull request #31 from rioki/master
pjohnmeyer af145fb
Add .what() to error message when standard exception is raised in CHECK.
pjohnmeyer 09e6ef7
Add .what() to error message when standard exception is raised in CHE…
pjohnmeyer c622c65
Add .what() to error message when standard exception is raised in CHE…
pjohnmeyer bad0e9c
Refactor common logic for CHECK tests into a fixture and add separate…
pjohnmeyer a94b9a8
Improve CheckFixture method names.
pjohnmeyer 76766c1
Refactor TestExceptions CheckEqual tests to use a fixture and add add…
pjohnmeyer 8e7ed23
Refactor TestExceptions CheckClose tests to use a fixture and add add…
pjohnmeyer 2dadab1
Add .what() to error reporting for std::exceptions in CHECK_ARRAY_CLOSE.
pjohnmeyer 6ea94ee
Add .what() to error reporting for std::exceptions in CHECK_ARRAY_EQUAL.
pjohnmeyer 7a3dcad
Add .what() to error reporting for std::exceptions in CHECK_ARRAY2D_C…
pjohnmeyer e87a1f3
Group all exception tests into suites and normalize indentation.
pjohnmeyer 0f9b667
Merge pull request #33 from pjohnmeyer/addingWhatToCheckMessages
pjohnmeyer 83a9d97
Change default MemoryOutStream to be a std::ostringstream.
pjohnmeyer 1fa77e1
Add install targets and install path customization.
pjohnmeyer d1be00a
Revert "Add install targets and install path customization."
pjohnmeyer a527c4a
Add install targets and install path customization.
pjohnmeyer d9b212b
Move unittestpp.h to src/UnitTestPP.h and add src/UnitTest++.h.
pjohnmeyer afa6d87
Move config.h to src/Config.h.
pjohnmeyer c77b187
Ensure all headers, including platform, are being installed.
pjohnmeyer d847324
Move src to UnitTest++ and move src/tests to tests.
pjohnmeyer 8879b8c
Rename COPYING to LICENSE; delete NEWS since it was empty anyway.
pjohnmeyer 1daf030
Delete COPYING (previously renamed to LICENSE).
pjohnmeyer 0f3df6f
Rename README to README.md
pjohnmeyer 8bcd6f8
Add Markdown formatting to README.md
pjohnmeyer 3bfb8b6
- Fixed include path in CMakeLists.txt
pjohnmeyer e3f7e53
Merge pull request #34 from pjohnmeyer/version1.4CompatibilityFixes
pjohnmeyer 3a12a31
Add support and project files for Visual Studio 2012
pjohnmeyer 49f6d85
Add *.bat as eol=crlf.
pjohnmeyer 6c1c587
Add strip_cmake.bat for deleting "extra" files generated by CMake.
pjohnmeyer 5b363d9
Generate new Visual Studio 2010 projects.
pjohnmeyer 87b0e15
Generate new Visual Studio 2008 projects.
pjohnmeyer ed6d924
Remove old TestUnitTest++ 2010 project files.
pjohnmeyer f79e71a
Generate new Visual Studio 2005 projects.
pjohnmeyer 44fb013
Remove old Visual Studio 2005 projects.
pjohnmeyer 4a466f8
Generate new Visual Studio 2003 projects.
pjohnmeyer 6daa0b3
Remove missed Visual Studio 2005 file.
pjohnmeyer f74f15e
Remove old Visual Studio 2003 project files.
pjohnmeyer dbc44ed
Merge pull request #35 from pjohnmeyer/master
pjohnmeyer d56123c
Fixed autotools
qdii 6389e93
Added license (MIT)
qdii b5725ae
Remove COPYING inadvertently merged from #38
pjohnmeyer c59c754
Add .gitignore for Xcode projects
9c58d1b
Add a new Xcode 4.6 project
f01953a
Add UnitTest++ source to the project
093ef7e
Add a target for TestUnitTest++
5bc3ff8
Update TestUnitTest++ to use existing code
5b3fc9e
Merge pull request #40 from chris-frederick/xcode_project
pjohnmeyer 488b03c
Remove old docs folder.
pjohnmeyer 117e485
Add https://github.com/unittest-cpp/unittest-cpp.wiki.git as submodul…
pjohnmeyer a205841
Add Documentation, Pre-requisites, and Downloading instructions to ma…
pjohnmeyer 17b1a45
Add link to contributor graph under 'Contributors'.
pjohnmeyer c9b2005
Incorporate new commits in wiki.
pjohnmeyer b2de87d
Incorporate latest wiki docs.
pjohnmeyer a77b61a
Merge pull request #41 from pjohnmeyer/documentationUpdates
pjohnmeyer b4539f4
Fix spelling error in README
pjohnmeyer 4ab7aa4
Add changes required to compile with MS VC6
martinmoene c42e68b
Add 'empty' builds directory per the wiki. (The folder is not actuall…
pjohnmeyer a4686b2
Merge remote-tracking branch 'remotes/upstream/master'
martinmoene d684f5e
Adapt MemoryOutStream for VC6 __int64 type
martinmoene 3f301ee
Integrating test failure in to QtCreator IDE build errors
de52aa1
Merge pull request #43 from martinmoene/master
pjohnmeyer 49764ce
Fix autotools configuration
magicant 9ad680a
Merge pull request #46 from lijoantony/master
pjohnmeyer aa78440
Merge pull request #48 from magicant/autotools
pjohnmeyer e76d25a
Replace absolute paths with relative paths in Visual Studio project f…
pjohnmeyer 472b528
Fix crash bug in msvc
warmist eba7e6d
Merge pull request #53 from warmist/patch-1
pjohnmeyer a2639ea
fix broken tests
nlap bd3b6e2
keep absolute path
nlap d482831
Merge branch 'novawave-master'
pjohnmeyer 9218ffc
Reformatted code from #54.
pjohnmeyer 856d881
Introducing additional functionality to allow client code to stop a u…
ohz10 c8522b0
Bug Fix: ensure we stop unit test execution when an unexpected except…
ohz10 0526331
Introducing additional functionality to allow client code to stop a unit
ohz10 dc065a3
Revert "Bug Fix: ensure we stop unit test execution when an unexpecte…
ohz10 bb339cf
Revert "Introducing additional functionality to allow client code to …
ohz10 6e4a1a5
Use for loop to achieve REQUIRE with no parens
pjohnmeyer 61676e5
This commit addresses two issues:
ohz10 e75f66b
Eliminating 'unused exception variable' warnings.
ohz10 cf5c33f
Merge with upstream master.
ohz10 4f90f7c
Merge branch 'upstream' into develop
ohz10 f5a778b
Merge branch 'develop' into RequiredMacroAsForLoop
ohz10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef UNITTEST_REQUIREMACROS_H | ||
#define UNITTEST_REQUIREMACROS_H | ||
|
||
#include "RequiredCheckTestReporter.h" | ||
|
||
#ifdef REQUIRE | ||
#error UnitTest++ redefines REQUIRE | ||
#endif | ||
|
||
#ifndef UNITTEST_NO_EXCEPTIONS | ||
#define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.next(); ) | ||
#endif | ||
|
||
#ifdef UNITTEST_NO_EXCEPTIONS | ||
#define REQUIRE | ||
#endif | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "RequiredCheckTestReporter.h" | ||
|
||
#include "CurrentTest.h" | ||
#include "TestResults.h" | ||
|
||
namespace UnitTest { | ||
|
||
RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults* results) | ||
: m_results(results) | ||
, m_throwingReporter(0) | ||
, m_continue(0) | ||
{ | ||
if(m_results) | ||
{ | ||
m_throwingReporter.setDecorated(m_results->m_testReporter); | ||
m_results->m_testReporter = &m_throwingReporter; | ||
} | ||
} | ||
|
||
RequiredCheckTestReporter::~RequiredCheckTestReporter() | ||
{ | ||
if(m_results) m_results->m_testReporter = m_throwingReporter.getDecorated(); | ||
} | ||
|
||
bool RequiredCheckTestReporter::next() | ||
{ | ||
return m_continue++ == 0; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H | ||
#define UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H | ||
|
||
#include "HelperMacros.h" | ||
#include "ThrowingTestReporter.h" | ||
|
||
namespace UnitTest { | ||
|
||
class TestResults; | ||
|
||
// This RAII class decorates the current TestReporter with | ||
// a version that throws after reporting a failure. | ||
class UNITTEST_LINKAGE RequiredCheckTestReporter | ||
{ | ||
public: | ||
explicit RequiredCheckTestReporter(TestResults* results); | ||
~RequiredCheckTestReporter(); | ||
|
||
bool next(); | ||
|
||
private: | ||
TestResults* m_results; | ||
ThrowingTestReporter m_throwingReporter; | ||
int m_continue; | ||
}; | ||
} | ||
|
||
#endif | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "ThrowingTestReporter.h" | ||
#include "AssertException.h" | ||
|
||
namespace UnitTest { | ||
|
||
ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter) | ||
: m_decoratedReporter(decoratedReporter) | ||
{ | ||
} | ||
|
||
//virtual | ||
ThrowingTestReporter::~ThrowingTestReporter() | ||
{ | ||
} | ||
|
||
//virtual | ||
void ThrowingTestReporter::ReportTestStart(TestDetails const& test) | ||
{ | ||
if(m_decoratedReporter) m_decoratedReporter->ReportTestStart(test); | ||
} | ||
|
||
//virtual | ||
void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure) | ||
{ | ||
if(m_decoratedReporter) m_decoratedReporter->ReportFailure(test, failure); | ||
throw AssertException(); | ||
} | ||
|
||
//virtual | ||
void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) | ||
{ | ||
if(m_decoratedReporter) m_decoratedReporter->ReportTestFinish(test, secondsElapsed); | ||
} | ||
|
||
//virtual | ||
void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) | ||
{ | ||
if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); | ||
} | ||
|
||
TestReporter* ThrowingTestReporter::getDecorated() const | ||
{ | ||
return m_decoratedReporter; | ||
} | ||
|
||
void ThrowingTestReporter::setDecorated(TestReporter* reporter) | ||
{ | ||
m_decoratedReporter = reporter; | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef UNITTEST_THROWINGTESTREPORTER_H | ||
#define UNITTEST_THROWINGTESTREPORTER_H | ||
|
||
#include "TestReporter.h" | ||
|
||
namespace UnitTest { | ||
|
||
// A TestReporter that throws when ReportFailure is called. Otherwise it | ||
// forwards the calls to a decorated TestReporter | ||
class ThrowingTestReporter : public TestReporter | ||
{ | ||
public: | ||
explicit ThrowingTestReporter(TestReporter* reporter); | ||
|
||
virtual ~ThrowingTestReporter(); | ||
virtual void ReportTestStart(TestDetails const& test); | ||
virtual void ReportFailure(TestDetails const& test, char const* failure); | ||
virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed); | ||
virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed); | ||
|
||
TestReporter* getDecorated() const; | ||
void setDecorated(TestReporter* reporter); | ||
|
||
private: | ||
TestReporter* m_decoratedReporter; | ||
}; | ||
} | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have avoided using friend here and introduced a getter/setter instead. I wanted to avoid signature changes to existing classes exported in shared libraries. (This is admittedly probably a silly concern, and I'm happy to change this).