1
0
forked from Alepha/Alepha

Boolean test lambdas can now be used properly.

This commit is contained in:
2022-10-16 01:36:13 -04:00
parent deeb27cb9f
commit e170f3f172

View File

@ -96,6 +96,20 @@ namespace Alepha::Hydrogen::Testing
template< typename Integer, typename= std::enable_if_t< std::is_integral_v< Integer > > >
inline auto
operator <= ( TestName name, std::function< Integer () > test )
{
if constexpr( std::is_same_v< Integer, bool > )
{
auto wrapper= [test]
{
if( not test )
{
throw TestFailureException{ 1 };
}
};
return name <= wrapper;
}
else
{
auto wrapper= [test]
{
@ -105,6 +119,7 @@ namespace Alepha::Hydrogen::Testing
return name <= wrapper;
}
}
namespace exports
{