forked from Alepha/Alepha
Boolean test lambdas can now be used properly.
This commit is contained in:
@ -97,13 +97,28 @@ namespace Alepha::Hydrogen::Testing
|
|||||||
inline auto
|
inline auto
|
||||||
operator <= ( TestName name, std::function< Integer () > test )
|
operator <= ( TestName name, std::function< Integer () > test )
|
||||||
{
|
{
|
||||||
auto wrapper= [test]
|
if constexpr( std::is_same_v< Integer, bool > )
|
||||||
{
|
{
|
||||||
const int failures= test();
|
auto wrapper= [test]
|
||||||
if( failures > 0 ) throw TestFailureException{ failures };
|
{
|
||||||
};
|
if( not test )
|
||||||
|
{
|
||||||
|
throw TestFailureException{ 1 };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return name <= wrapper;
|
return name <= wrapper;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto wrapper= [test]
|
||||||
|
{
|
||||||
|
const int failures= test();
|
||||||
|
if( failures > 0 ) throw TestFailureException{ failures };
|
||||||
|
};
|
||||||
|
|
||||||
|
return name <= wrapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace exports
|
namespace exports
|
||||||
|
|||||||
Reference in New Issue
Block a user