increase code coverage

This commit is contained in:
Michele Caini 2020-03-28 00:03:54 +01:00
parent 4d92e354be
commit 1f2b6ed23d
7 changed files with 23 additions and 32 deletions

View File

@ -8,7 +8,7 @@ TEST(Async, Send) {
bool checkAsyncEvent = false;
handle->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); });
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::AsyncEvent>([&checkAsyncEvent](const auto &, auto &hndl) {
ASSERT_FALSE(checkAsyncEvent);
@ -32,9 +32,8 @@ TEST(Async, Fake) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::AsyncHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::AsyncEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::AsyncEvent>([](auto &&...) { FAIL(); });
handle->send();
handle->close();

View File

@ -8,7 +8,7 @@ TEST(Check, StartAndStop) {
bool checkCheckEvent = false;
handle->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); });
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::CheckEvent>([&checkCheckEvent](const auto &, auto &hndl) {
ASSERT_FALSE(checkCheckEvent);
@ -33,9 +33,8 @@ TEST(Check, Fake) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::CheckHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::CheckEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::CheckEvent>([](auto &&...) { FAIL(); });
handle->start();
handle->close();

View File

@ -8,7 +8,7 @@ TEST(Idle, StartAndStop) {
bool checkIdleEvent = false;
handle->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); });
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::IdleEvent>([&checkIdleEvent](const auto &, auto &hndl) {
ASSERT_FALSE(checkIdleEvent);
@ -33,9 +33,8 @@ TEST(Idle, Fake) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::IdleHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::IdleEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::IdleEvent>([](auto &&...) { FAIL(); });
handle->start();
handle->close();

View File

@ -21,11 +21,9 @@ TEST(Loop, Functionalities) {
auto handle = loop->resource<uvw::PrepareHandle>();
auto req = loop->resource<uvw::WorkReq>([]{});
auto err = [](const auto &, auto &) { FAIL(); };
loop->on<uvw::ErrorEvent>(err);
req->on<uvw::ErrorEvent>(err);
handle->on<uvw::ErrorEvent>(err);
loop->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
req->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
ASSERT_TRUE(static_cast<bool>(handle));
ASSERT_TRUE(static_cast<bool>(req));

View File

@ -8,7 +8,7 @@ TEST(Prepare, StartAndStop) {
bool checkPrepareEvent = false;
handle->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); });
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::PrepareEvent>([&checkPrepareEvent](const auto &, auto &hndl) {
ASSERT_FALSE(checkPrepareEvent);
@ -33,9 +33,8 @@ TEST(Prepare, Fake) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::PrepareHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::PrepareEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::PrepareEvent>([](auto &&...) { FAIL(); });
handle->start();
handle->close();

View File

@ -6,9 +6,8 @@ TEST(Signal, Start) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::SignalHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::CheckEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::CheckEvent>([](auto &&...) { FAIL(); });
handle->start(2);
@ -27,9 +26,8 @@ TEST(Signal, OneShot) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::SignalHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::CheckEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::CheckEvent>([](auto &&...) { FAIL(); });
handle->oneShot(2);

View File

@ -10,8 +10,8 @@ TEST(Timer, StartAndStop) {
bool checkTimerNoRepeatEvent = false;
bool checkTimerRepeatEvent = false;
handleNoRepeat->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); });
handleRepeat->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); });
handleNoRepeat->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handleRepeat->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handleNoRepeat->on<uvw::TimerEvent>([&checkTimerNoRepeatEvent](const auto &, auto &handle) {
ASSERT_FALSE(checkTimerNoRepeatEvent);
@ -111,9 +111,8 @@ TEST(Timer, Fake) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::TimerHandle>();
auto l = [](const auto &, auto &) { FAIL(); };
handle->on<uvw::ErrorEvent>(l);
handle->on<uvw::TimerEvent>(l);
handle->on<uvw::ErrorEvent>([](auto &&...) { FAIL(); });
handle->on<uvw::TimerEvent>([](auto &&...) { FAIL(); });
handle->start(uvw::TimerHandle::Time{0}, uvw::TimerHandle::Time{0});
handle->close();