mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Build 35
- non-SFINAE IsStreamInsertable
This commit is contained in:
parent
9fff9e47d3
commit
dd52044374
@ -1,6 +1,6 @@
|
||||
![catch logo](https://raw.github.com/philsquared/Catch/Integration/catch-logo-small.png)
|
||||
|
||||
## CATCH v0.9 build 34 (integration branch)
|
||||
## CATCH v0.9 build 35 (integration branch)
|
||||
An automated test framework for C, C++ and Objective-C.
|
||||
|
||||
This branch may contain code that is experimental or not yet fully tested.
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace Catch {
|
||||
|
||||
// These numbers are maintained by a script
|
||||
Version libraryVersion( 0, 9, 34, "integration" );
|
||||
Version libraryVersion( 0, 9, 35, "integration" );
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
CatchSelfTest is a CATCH v0.9 b34 (integration) host application.
|
||||
CatchSelfTest is a CATCH v0.9 b35 (integration) host application.
|
||||
Run with -? for options
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -5263,6 +5263,18 @@ PASSED:
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
non streamable - with conv. op
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:345
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:349:
|
||||
PASSED:
|
||||
REQUIRE( s == "7" )
|
||||
with expansion:
|
||||
"7" == "7"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Anonymous test case 1
|
||||
-------------------------------------------------------------------------------
|
||||
@ -5519,11 +5531,11 @@ with message:
|
||||
boo!
|
||||
|
||||
===============================================================================
|
||||
111 test cases - 49 failed (705 assertions - 106 failed)
|
||||
112 test cases - 49 failed (706 assertions - 106 failed)
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
CatchSelfTest is a CATCH v0.9 b34 (integration) host application.
|
||||
CatchSelfTest is a CATCH v0.9 b35 (integration) host application.
|
||||
Run with -? for options
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -5840,7 +5852,7 @@ with expansion:
|
||||
13 test cases - 3 failed (40 assertions - 4 failed)
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="~dummy" errors="10" failures="78" tests="705" hostname="tbd" time="tbd" timestamp="tbd">
|
||||
<testsuite name="~dummy" errors="10" failures="78" tests="706" hostname="tbd" time="tbd" timestamp="tbd">
|
||||
<testcase classname="global" name="./succeeding/Approx/simple" time="tbd"/>
|
||||
<testcase classname="global" name="./succeeding/Approx/epsilon" time="tbd"/>
|
||||
<testcase classname="global" name="./succeeding/Approx/float" time="tbd"/>
|
||||
@ -6339,6 +6351,7 @@ TrickyTests.cpp:106
|
||||
<testcase classname="global" name="./succeeding/unimplemented static bool" time="tbd"/>
|
||||
<testcase classname="global" name="./succeeding/SafeBool" time="tbd"/>
|
||||
<testcase classname="global" name="Assertions then sections" time="tbd"/>
|
||||
<testcase classname="global" name="non streamable - with conv. op" time="tbd"/>
|
||||
<testcase classname="global" name="Anonymous test case 1" time="tbd"/>
|
||||
<testcase classname="global" name="Test case with one argument" time="tbd"/>
|
||||
<testcase classname="global" name="Variadic macros" time="tbd"/>
|
||||
@ -12023,6 +12036,17 @@ TrickyTests.cpp" line="335">
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="non streamable - with conv. op">
|
||||
TrickyTests.cpp" line="349">
|
||||
<Original>
|
||||
s == "7"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"7" == "7"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Anonymous test case 1">
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
@ -12252,9 +12276,9 @@ BDDTests.cpp" line="54">
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="599" failures="106"/>
|
||||
<OverallResults successes="600" failures="106"/>
|
||||
</Group>
|
||||
<OverallResults successes="599" failures="106"/>
|
||||
<OverallResults successes="600" failures="106"/>
|
||||
</Catch>
|
||||
[Started testing: CatchSelfTest]
|
||||
[Started group: '~dummy']
|
||||
@ -13980,6 +14004,10 @@ TrickyTests.cpp:335: Catch::isTrue( true ) succeeded for: true
|
||||
|
||||
[Finished: 'Assertions then sections' All tests passed (6 assertions in 1 test case)]
|
||||
|
||||
[Running: non streamable - with conv. op]
|
||||
TrickyTests.cpp:349: s == "7" succeeded for: "7" == "7"
|
||||
[Finished: 'non streamable - with conv. op' All tests passed (1 assertion in 1 test case)]
|
||||
|
||||
[Running: Anonymous test case 1]
|
||||
VariadicMacrosTests.cpp:14: succeeded
|
||||
[with message: anonymous test case]
|
||||
@ -14091,10 +14119,10 @@ BDDTests.cpp:67: succeeded
|
||||
[End of section: ' Given: A section name that is so long that it cannot fit in a single console width' 1 assertion passed]
|
||||
|
||||
[Finished: 'Scenario: This is a really long scenario name to see how the list command deals with wrapping' All tests passed (1 assertion in 1 test case)]
|
||||
[End of group: '~dummy'. 49 of 111 test cases failed (106 of 705 assertions failed)]
|
||||
[End of group: '~dummy'. 49 of 112 test cases failed (106 of 706 assertions failed)]
|
||||
|
||||
|
||||
[Testing completed. 49 of 111 test cases failed (106 of 705 assertions failed)]
|
||||
[Testing completed. 49 of 112 test cases failed (106 of 706 assertions failed)]
|
||||
|
||||
[Started testing: CatchSelfTest]
|
||||
[Started group: '~dummy']
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* CATCH v0.9 build 34 (integration branch)
|
||||
* Generated: 2013-04-20 21:05:02.595019
|
||||
* CATCH v0.9 build 35 (integration branch)
|
||||
* Generated: 2013-04-20 23:19:15.811241
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||
@ -555,7 +555,7 @@ private:
|
||||
|
||||
#elif __GNUC__ >= 3
|
||||
|
||||
#define CATCH_SFINAE
|
||||
// #define CATCH_SFINAE // Taking this out completely for now
|
||||
|
||||
#endif // __GNUC__ < 3
|
||||
|
||||
@ -572,8 +572,6 @@ private:
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
#ifdef CATCH_SFINAE
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct TrueType {
|
||||
@ -587,6 +585,8 @@ namespace Catch {
|
||||
char sizer[2];
|
||||
};
|
||||
|
||||
#ifdef CATCH_SFINAE
|
||||
|
||||
template<bool> struct NotABooleanExpression;
|
||||
|
||||
template<bool c> struct If : NotABooleanExpression<c> {};
|
||||
@ -597,10 +597,10 @@ namespace Catch {
|
||||
template<> struct SizedIf<sizeof(TrueType)> : TrueType {};
|
||||
template<> struct SizedIf<sizeof(FalseType)> : FalseType {};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // CATCH_SFINAE
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
@ -652,11 +652,13 @@ inline id performOptionalSelector( id obj, SEL sel ) {
|
||||
#endif
|
||||
|
||||
namespace Catch {
|
||||
|
||||
#ifdef CATCH_SFINAE
|
||||
|
||||
namespace Detail {
|
||||
|
||||
// SFINAE is currently disabled by default for all compilers.
|
||||
// If the non SFINAE version of IsStreamInsertable is ambiguous for you
|
||||
// and your compiler supports SFINAE, try #defining CATCH_SFINAE
|
||||
#ifdef CATCH_SFINAE
|
||||
|
||||
template<typename T>
|
||||
class IsStreamInsertableHelper {
|
||||
template<int N> struct TrueIfSizeable : TrueType {};
|
||||
@ -672,53 +674,47 @@ namespace Detail {
|
||||
template<typename T>
|
||||
struct IsStreamInsertable : IsStreamInsertableHelper<T>::type {};
|
||||
|
||||
template<typename T>
|
||||
void toStream( std::ostream& os, T const& value, typename IsStreamInsertable<T>::Enable* = 0 ) {
|
||||
os << value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void toStream( std::ostream& os, T const&, typename IsStreamInsertable<T>::Disable* = 0 ) {
|
||||
os << "{?}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct StringMaker {
|
||||
static std::string convert( T const& value ) {
|
||||
std::ostringstream oss;
|
||||
Detail::toStream( oss, value );
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
namespace Detail {
|
||||
struct BorgType {
|
||||
template<typename T> BorgType( T const& );
|
||||
};
|
||||
|
||||
struct NonStreamable {
|
||||
template<typename T> NonStreamable( const T& ){}
|
||||
TrueType& testStreamable( std::ostream& );
|
||||
FalseType testStreamable( FalseType );
|
||||
|
||||
FalseType operator<<( std::ostream const&, BorgType const& );
|
||||
|
||||
template<typename T>
|
||||
struct IsStreamInsertable {
|
||||
static std::ostream &s;
|
||||
static T const &t;
|
||||
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template<bool C>
|
||||
struct StringMakerBase {
|
||||
template<typename T>
|
||||
static std::string convert( T const& ) { return "{?}"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct StringMakerBase<true> {
|
||||
template<typename T>
|
||||
static std::string convert( T const& _value ) {
|
||||
std::ostringstream oss;
|
||||
oss << _value;
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace Detail
|
||||
|
||||
// If the type does not have its own << overload for ostream then
|
||||
// this one will be used instead
|
||||
inline std::ostream& operator << ( std::ostream& ss, Detail::NonStreamable ){
|
||||
return ss << "{?}";
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct StringMaker {
|
||||
static std::string convert( T const& value ) {
|
||||
std::ostringstream oss;
|
||||
oss << value;
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
struct StringMaker :
|
||||
Detail::StringMakerBase<Detail::IsStreamInsertable<T>::value> {};
|
||||
|
||||
template<typename T>
|
||||
struct StringMaker<T*> {
|
||||
@ -6159,7 +6155,7 @@ namespace Catch {
|
||||
namespace Catch {
|
||||
|
||||
// These numbers are maintained by a script
|
||||
Version libraryVersion( 0, 9, 34, "integration" );
|
||||
Version libraryVersion( 0, 9, 35, "integration" );
|
||||
}
|
||||
|
||||
// #included from: catch_text.hpp
|
||||
|
Loading…
Reference in New Issue
Block a user