forked from Alepha/Alepha
Permit std::nothrow_t
for no throwing cases, in addition to std::type_identity< void >
.
This commit is contained in:
@ -129,8 +129,9 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
requires( not SameAs< T, void > )
|
||||||
BasicUniversalHandler( std::type_identity< T > ) : impl
|
BasicUniversalHandler( std::type_identity< T > ) : impl
|
||||||
{
|
{
|
||||||
[]( Invoker invoker, const std::string &comment )
|
[]( Invoker invoker, const std::string &comment )
|
||||||
@ -150,6 +151,27 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
}
|
}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
requires( SameAs< T, std::type_identity< void > > or SameAs< T, std::nothrow_t > )
|
||||||
|
BasicUniversalHandler( T ) : impl
|
||||||
|
{
|
||||||
|
[]( Invoker invoker, const std::string &comment )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::ignore= invoker();
|
||||||
|
std::cout << " " << C::testPass << "PASSED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
|
return TestResult::Passed;
|
||||||
|
}
|
||||||
|
catch( const T & )
|
||||||
|
{
|
||||||
|
std::cout << " " << C::testFail << "FAILED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
|
return TestResult::Failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{}
|
||||||
|
|
||||||
template< DerivedFrom< std::exception > T >
|
template< DerivedFrom< std::exception > T >
|
||||||
BasicUniversalHandler( const T exemplar ) : impl
|
BasicUniversalHandler( const T exemplar ) : impl
|
||||||
{
|
{
|
||||||
@ -251,6 +273,7 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
requires( not SameAs< T, void > )
|
||||||
BasicUniversalHandler( std::type_identity< T > ) : impl
|
BasicUniversalHandler( std::type_identity< T > ) : impl
|
||||||
{
|
{
|
||||||
[]( Invoker invoker, const std::string &comment )
|
[]( Invoker invoker, const std::string &comment )
|
||||||
@ -270,6 +293,27 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
}
|
}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
requires( SameAs< T, std::type_identity< void > > or SameAs< T, std::nothrow_t > )
|
||||||
|
BasicUniversalHandler( T ) : impl
|
||||||
|
{
|
||||||
|
[]( Invoker invoker, const std::string &comment )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::ignore= invoker();
|
||||||
|
std::cout << " " << C::testPass << "PASSED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
|
return TestResult::Passed;
|
||||||
|
}
|
||||||
|
catch( const T & )
|
||||||
|
{
|
||||||
|
std::cout << " " << C::testFail << "FAILED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
|
return TestResult::Failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{}
|
||||||
|
|
||||||
template< DerivedFrom< std::exception > T >
|
template< DerivedFrom< std::exception > T >
|
||||||
BasicUniversalHandler( const T exemplar ) : impl
|
BasicUniversalHandler( const T exemplar ) : impl
|
||||||
{
|
{
|
||||||
@ -370,8 +414,9 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
requires( not SameAs< T, void > )
|
||||||
BasicUniversalHandler( std::type_identity< T > ) : impl
|
BasicUniversalHandler( std::type_identity< T > ) : impl
|
||||||
{
|
{
|
||||||
[]( Invoker invoker, const std::string &comment )
|
[]( Invoker invoker, const std::string &comment )
|
||||||
@ -391,6 +436,27 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
}
|
}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
requires( SameAs< T, std::type_identity< void > > or SameAs< T, std::nothrow_t > )
|
||||||
|
BasicUniversalHandler( T ) : impl
|
||||||
|
{
|
||||||
|
[]( Invoker invoker, const std::string &comment )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::ignore= invoker();
|
||||||
|
std::cout << " " << C::testPass << "PASSED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
|
return TestResult::Passed;
|
||||||
|
}
|
||||||
|
catch( const T & )
|
||||||
|
{
|
||||||
|
std::cout << " " << C::testFail << "FAILED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
|
return TestResult::Failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{}
|
||||||
|
|
||||||
template< DerivedFrom< std::exception > T >
|
template< DerivedFrom< std::exception > T >
|
||||||
BasicUniversalHandler( const T exemplar ) : impl
|
BasicUniversalHandler( const T exemplar ) : impl
|
||||||
{
|
{
|
||||||
@ -660,7 +726,7 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExceptionCases
|
struct ExceptionCases_real
|
||||||
{
|
{
|
||||||
using Invoker= std::function< void () >;
|
using Invoker= std::function< void () >;
|
||||||
struct ExceptionHandler
|
struct ExceptionHandler
|
||||||
@ -684,6 +750,23 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
requires( SameAs< T, std::type_identity< void > > or SameAs< T, std::nothrow_t > )
|
||||||
|
ExceptionHandler( T ) : impl
|
||||||
|
{
|
||||||
|
[]( Invoker invoker )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
invoker();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch( const T & ) { return false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{}
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
requires( not SameAs< T, void > )
|
||||||
ExceptionHandler( std::type_identity< T > ) : impl
|
ExceptionHandler( std::type_identity< T > ) : impl
|
||||||
{
|
{
|
||||||
[]( Invoker invoker )
|
[]( Invoker invoker )
|
||||||
@ -748,7 +831,7 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
|
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
ExceptionCases( std::initializer_list< TestDescription > initList )
|
ExceptionCases_real( std::initializer_list< TestDescription > initList )
|
||||||
: tests( initList ) {}
|
: tests( initList ) {}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -814,6 +897,9 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
// retire the `ExceptionCases` and `ExecutionCases` forms and replace them with an alias to `UniversalCases`.
|
// retire the `ExceptionCases` and `ExecutionCases` forms and replace them with an alias to `UniversalCases`.
|
||||||
using Cases= ExecutionCases;
|
using Cases= ExecutionCases;
|
||||||
//using Cases= UniversalCases;
|
//using Cases= UniversalCases;
|
||||||
|
|
||||||
|
using ExceptionCases= ExceptionCases_real;
|
||||||
|
//using ExceptionCases= UniversalCases;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DISABLED
|
#ifdef DISABLED
|
||||||
|
@ -42,7 +42,11 @@ static auto init= enroll <=[]
|
|||||||
{
|
{
|
||||||
{ "Complete var",
|
{ "Complete var",
|
||||||
{ "$H$ $W$", { { "H", lambaste<="Hello" }, { "W", lambaste<="World" } }, '$' },
|
{ "$H$ $W$", { { "H", lambaste<="Hello" }, { "W", lambaste<="World" } }, '$' },
|
||||||
{}
|
std::nothrow
|
||||||
|
},
|
||||||
|
{ "Complete var",
|
||||||
|
{ "$H$ $W$", { { "H", lambaste<="Hello" }, { "W", lambaste<="World" } }, '$' },
|
||||||
|
std::type_identity< void >{}
|
||||||
},
|
},
|
||||||
{ "Incomplete var",
|
{ "Incomplete var",
|
||||||
{ "$H$ $W", { { "H", lambaste<="Hello" }, { "W", lambaste<="World" } }, '$' },
|
{ "$H$ $W", { { "H", lambaste<="Hello" }, { "W", lambaste<="World" } }, '$' },
|
||||||
|
Reference in New Issue
Block a user