From: Thomas Markwalder Date: Fri, 15 Sep 2023 14:09:07 +0000 (-0400) Subject: [#3053] Additional review comments X-Git-Tag: Kea-2.5.2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f73d4d0dd3cd840153068610b7fd2402b28a2ee;p=thirdparty%2Fkea.git [#3053] Additional review comments src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc add use of SKIP_IF src/lib/testutils/gtest_utils.h fixed typo --- diff --git a/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc index e9506a729b..ffae89787c 100644 --- a/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc @@ -1069,33 +1069,21 @@ TEST_F(PgSqlGenericBackendTest, leaseCount) { // Verifies that v4 class lease counts are correctly adjusted // when leases have class lists. TEST_F(PgSqlLeaseMgrTest, classLeaseCount4) { - if (!LeaseMgrFactory::instance().isJsonSupported()) { - std::cout << "Skipped test because of lack of JSON support in the database." << std::endl; - return; - } - + SKIP_IF(!LeaseMgrFactory::instance().isJsonSupported()); testClassLeaseCount4(); } // Verifies that v6 IA_NA class lease counts are correctly adjusted // when leases have class lists. TEST_F(PgSqlLeaseMgrTest, classLeaseCount6_NA) { - if (!LeaseMgrFactory::instance().isJsonSupported()) { - std::cout << "Skipped test because of lack of JSON support in the database." << std::endl; - return; - } - + SKIP_IF(!LeaseMgrFactory::instance().isJsonSupported()); testClassLeaseCount6(Lease::TYPE_NA); } // Verifies that v6 IA_PD class lease counts are correctly adjusted // when leases have class lists. TEST_F(PgSqlLeaseMgrTest, classLeaseCount6_PD) { - if (!LeaseMgrFactory::instance().isJsonSupported()) { - std::cout << "Skipped test because of lack of JSON support in the database." << std::endl; - return; - } - + SKIP_IF(!LeaseMgrFactory::instance().isJsonSupported()); testClassLeaseCount6(Lease::TYPE_PD); } diff --git a/src/lib/testutils/gtest_utils.h b/src/lib/testutils/gtest_utils.h index 15a6f35cbc..66a88fa282 100644 --- a/src/lib/testutils/gtest_utils.h +++ b/src/lib/testutils/gtest_utils.h @@ -92,7 +92,7 @@ namespace test { /// if the given expression is true. This works around the lack of /// GTEST_SKIP prior to googletest 1.10. /// -/// @note This macro cannot be used in ::testingL:Test::SetUp() +/// @note This macro cannot be used in ::testing::Test::SetUp() /// to skip tests (unless running with googletest 1.10 or later). /// It must be used directly within the body of each unit test. /// @@ -103,7 +103,7 @@ namespace test { if (expression) { \ const auto info = ::testing::UnitTest::GetInstance()->current_test_info(); \ std::cerr << "SKIPPING: " << info->test_case_name() << ":" << info->name() \ - << ":" << #expression << " is true" << std::endl; \ + << ": '" << #expression << "' is true" << std::endl; \ return; \ } \ } @@ -113,7 +113,7 @@ namespace test { if (expression) { \ const auto info = ::testing::UnitTest::GetInstance()->current_test_info(); \ GTEST_SKIP() << "SKIPPING: " << info->test_case_name() << ":" << info->name() \ - << ":" << #expression << " is true"; \ + << ": '" << #expression << "' is true"; \ } \ } #endif