nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #918: MINIFICPP-1383 fix intdiv_ceil
Date Fri, 02 Oct 2020 11:25:02 GMT

szaszm commented on a change in pull request #918:
URL: https://github.com/apache/nifi-minifi-cpp/pull/918#discussion_r498763716



##########
File path: libminifi/test/unit/GeneralUtilsTest.cpp
##########
@@ -32,18 +32,20 @@ TEST_CASE("GeneralUtils::make_unique", "[make_unique]") {
   REQUIRE("test string" == *pstr);
 }
 
-TEST_CASE("GeneralUtils::intdiv_ceil", "[intdiv_ceil]") {
-  REQUIRE(0 == utils::intdiv_ceil(0, 1));
-  REQUIRE(0 == utils::intdiv_ceil(0, 2));
-  REQUIRE(1 == utils::intdiv_ceil(1, 2));
-  REQUIRE(1 == utils::intdiv_ceil(1, 3));
-  REQUIRE(1 == utils::intdiv_ceil(3, 3));
-  REQUIRE(2 == utils::intdiv_ceil(4, 3));
-  REQUIRE(2 == utils::intdiv_ceil(4, 3));
-  REQUIRE(0 == utils::intdiv_ceil(-1, 3));
-  REQUIRE(-1 == utils::intdiv_ceil(-3, 3));
-  REQUIRE(-1 == utils::intdiv_ceil(-4, 3));
-}
+static_assert(0 == utils::intdiv_ceil(0, 1), "");
+static_assert(0 == utils::intdiv_ceil(0, 2), "");
+static_assert(1 == utils::intdiv_ceil(1, 2), "");
+static_assert(1 == utils::intdiv_ceil(1, 3), "");
+static_assert(1 == utils::intdiv_ceil(3, 3), "");
+static_assert(2 == utils::intdiv_ceil(4, 3), "");
+static_assert(2 == utils::intdiv_ceil(4, 3), "");

Review comment:
       thanks for pointing out, fixed in 585e874

##########
File path: libminifi/test/unit/GeneralUtilsTest.cpp
##########
@@ -32,18 +32,20 @@ TEST_CASE("GeneralUtils::make_unique", "[make_unique]") {
   REQUIRE("test string" == *pstr);
 }
 
-TEST_CASE("GeneralUtils::intdiv_ceil", "[intdiv_ceil]") {
-  REQUIRE(0 == utils::intdiv_ceil(0, 1));
-  REQUIRE(0 == utils::intdiv_ceil(0, 2));
-  REQUIRE(1 == utils::intdiv_ceil(1, 2));
-  REQUIRE(1 == utils::intdiv_ceil(1, 3));
-  REQUIRE(1 == utils::intdiv_ceil(3, 3));
-  REQUIRE(2 == utils::intdiv_ceil(4, 3));
-  REQUIRE(2 == utils::intdiv_ceil(4, 3));
-  REQUIRE(0 == utils::intdiv_ceil(-1, 3));
-  REQUIRE(-1 == utils::intdiv_ceil(-3, 3));
-  REQUIRE(-1 == utils::intdiv_ceil(-4, 3));
-}
+static_assert(0 == utils::intdiv_ceil(0, 1), "");
+static_assert(0 == utils::intdiv_ceil(0, 2), "");
+static_assert(1 == utils::intdiv_ceil(1, 2), "");
+static_assert(1 == utils::intdiv_ceil(1, 3), "");
+static_assert(1 == utils::intdiv_ceil(3, 3), "");
+static_assert(2 == utils::intdiv_ceil(4, 3), "");
+static_assert(2 == utils::intdiv_ceil(4, 3), "");
+static_assert(0 == utils::intdiv_ceil(-1, 3), "");
+static_assert(-1 == utils::intdiv_ceil(-3, 3), "");
+static_assert(-1 == utils::intdiv_ceil(-4, 3), "");
+static_assert(2 == utils::intdiv_ceil(-4, -3), "");
+static_assert(2 == utils::intdiv_ceil(-5, -3), "");
+static_assert(0 == utils::intdiv_ceil(1, -3), "");
+static_assert(-1 == utils::intdiv_ceil(5, -3), "");

Review comment:
       done in 585e874




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message