diff options
| author | Phil Nash | 2014-01-07 17:25:27 +0000 |
|---|---|---|
| committer | Phil Nash | 2014-01-07 17:25:27 +0000 |
| commit | e091018514bc7d63e672b360aff0df1340f5ce13 (patch) | |
| tree | 89f40875f187634c4c01142f07e314c2909127c1 /projects | |
| parent | 440a47011fc5052d15f82a82f8704fc5320f67f7 (diff) | |
| download | catch3-e091018514bc7d63e672b360aff0df1340f5ce13.tar.gz | |
Fixes toString() for function pointers and added support for member function pointers.
- thanks to Malcolm Noyes for supplying sample code on which the solution here was based
Diffstat (limited to 'projects')
6 files changed, 51 insertions, 9 deletions
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 52b4db55..3bf4d6c2 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -750,5 +750,5 @@ with expansion: "first" == "second" =============================================================================== -122 test cases - 36 failed (675 assertions - 91 failed) +123 test cases - 36 failed (676 assertions - 91 failed) diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 81ee03db..64ed0577 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -6366,7 +6366,21 @@ TrickyTests.cpp:<line number>: PASSED: REQUIRE( a == &foo ) with expansion: - 1 == 1 + 0x<hex digits> == 0x<hex digits> + +------------------------------------------------------------------------------- +Comparing member function pointers +------------------------------------------------------------------------------- +TrickyTests.cpp:<line number> +............................................................................... + +TrickyTests.cpp:<line number>: +PASSED: + CHECK( m == &S::f ) +with expansion: + 0x<hex digits> + == + 0x<hex digits> ------------------------------------------------------------------------------- pointer to class @@ -7144,5 +7158,5 @@ with expansion: true =============================================================================== -122 test cases - 51 failed (694 assertions - 110 failed) +123 test cases - 51 failed (695 assertions - 110 failed) diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index e28449ca..58a1d151 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ <testsuites> - <testsuite name="~_" errors="10" failures="100" tests="694" hostname="tbd" time="{duration}" timestamp="tbd"> + <testsuite name="~_" errors="10" failures="100" tests="695" hostname="tbd" time="{duration}" timestamp="tbd"> <testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/> @@ -514,6 +514,7 @@ TrickyTests.cpp:<line number> <testcase classname="Assertions then sections" name="A section/Another other section" time="{duration}"/> <testcase classname="global" name="non streamable - with conv. op" time="{duration}"/> <testcase classname="global" name="Comparing function pointers" time="{duration}"/> + <testcase classname="global" name="Comparing member function pointers" time="{duration}"/> <testcase classname="global" name="pointer to class" time="{duration}"/> <testcase classname="global" name="X/level/0/a" time="{duration}"/> <testcase classname="global" name="X/level/0/b" time="{duration}"/> diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 9bebc628..efbb16d3 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -6637,7 +6637,20 @@ there" a == &foo </Original> <Expanded> - 1 == 1 + 0x<hex digits> == 0x<hex digits> + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Comparing member function pointers"> + <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > + <Original> + m == &S::f + </Original> + <Expanded> + 0x<hex digits> +== +0x<hex digits> </Expanded> </Expression> <OverallResult success="true"/> @@ -7405,7 +7418,7 @@ there" </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="584" failures="110"/> + <OverallResults successes="585" failures="110"/> </Group> - <OverallResults successes="584" failures="110"/> + <OverallResults successes="585" failures="110"/> </Catch> diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 624ba264..f8af61c2 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -356,6 +356,20 @@ TEST_CASE( "Comparing function pointers", "[Tricky][function pointer]" ) REQUIRE( a == &foo ); } +struct S +{ + void f() {} +}; + + +TEST_CASE( "Comparing member function pointers", "[Tricky][member function pointer]" ) +{ + typedef void (S::*MF)(); + MF m = &S::f; + + CHECK( m == &S::f ); +} + class ClassName {}; TEST_CASE( "pointer to class", "[Tricky]" ) diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index e8848237..e61b82de 100644 --- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -581,7 +581,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = ""; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = "\"$(PROJECT_DIR)/../../../include\""; @@ -624,7 +624,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = ""; SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = "\"$(PROJECT_DIR)/../../../include\""; }; |