mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Unit test for delegate initialisation with non-capturing lambda as a constexpr function pointer
This commit is contained in:
parent
58c57b0a52
commit
deb26318fb
@ -539,7 +539,7 @@ namespace
|
||||
#if ETL_USING_CPP17
|
||||
TEST_FIXTURE(SetupFixture, test_make_delegate_free_moveableonly_constexpr)
|
||||
{
|
||||
constexpr auto d = etl::make_delegate<&free_moveableonly>();
|
||||
constexpr auto d = etl::make_delegate<&free_moveableonly>);
|
||||
|
||||
MoveableOnlyData data;
|
||||
data.d = VALUE1;
|
||||
@ -564,6 +564,20 @@ namespace
|
||||
CHECK(parameter_correct);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_constexpr_lambda_int)
|
||||
{
|
||||
constexpr auto lambda = [](int i, int j) { function_called = FunctionCalled::Lambda_Called; parameter_correct = (i == VALUE1) && (j == VALUE2); };
|
||||
constexpr void(*func_ptr)(int, int) = lambda;
|
||||
|
||||
auto d = etl::delegate<void(int, int)>::create<func_ptr>();
|
||||
|
||||
d(VALUE1, VALUE2);
|
||||
|
||||
CHECK(function_called == FunctionCalled::Lambda_Called);
|
||||
CHECK(parameter_correct);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_lambda_int_create)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user