Skip to content

Commit 40f4d79

Browse files
committed
test: add null tests for ufunction
1 parent d51231a commit 40f4d79

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

test/t-ufunction-11.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ TEST_CASE("Basic")
4040
CHECK(func(4) == 9);
4141

4242
auto f2 = std::move(func);
43-
CHECK(!func);
43+
CHECK_FALSE(func);
4444
CHECK(f2(1) == 6);
4545
}
4646

@@ -63,4 +63,20 @@ TEST_CASE("from copy")
6363
itlib::ufunction<int(int, int)> f2(func);
6464
CHECK(f(1, 2) == 3);
6565
CHECK(f2(10, 20) == 30);
66-
}
66+
}
67+
68+
TEST_CASE("from null") {
69+
{
70+
itlib::ufunction<void()> f;
71+
CHECK_FALSE(f);
72+
}
73+
{
74+
itlib::ufunction<void()> f = nullptr;
75+
CHECK_FALSE(f);
76+
}
77+
{
78+
void (*fp)() = nullptr;
79+
itlib::ufunction<void()> f = fp;
80+
CHECK_FALSE(f);
81+
}
82+
}

0 commit comments

Comments
 (0)