Skip to content

Commit

Permalink
test: add null tests for ufunction
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Sep 26, 2024
1 parent d51231a commit 40f4d79
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/t-ufunction-11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST_CASE("Basic")
CHECK(func(4) == 9);

auto f2 = std::move(func);
CHECK(!func);
CHECK_FALSE(func);
CHECK(f2(1) == 6);
}

Expand All @@ -63,4 +63,20 @@ TEST_CASE("from copy")
itlib::ufunction<int(int, int)> f2(func);
CHECK(f(1, 2) == 3);
CHECK(f2(10, 20) == 30);
}
}

TEST_CASE("from null") {
{
itlib::ufunction<void()> f;
CHECK_FALSE(f);
}
{
itlib::ufunction<void()> f = nullptr;
CHECK_FALSE(f);
}
{
void (*fp)() = nullptr;
itlib::ufunction<void()> f = fp;
CHECK_FALSE(f);
}
}

0 comments on commit 40f4d79

Please sign in to comment.