phrocker commented on a change in pull request #472: MINIFICPP-710 - Fix errors 
in Property StringToInt conversion
URL: https://github.com/apache/nifi-minifi-cpp/pull/472#discussion_r246974404
 
 

 ##########
 File path: libminifi/test/unit/PropertyTests.cpp
 ##########
 @@ -107,3 +107,28 @@ TEST_CASE("Test Trimmer Left", "[testTrims]") {
   REQUIRE(test.c_str()[1] == ' ');
 }
 
+TEST_CASE("Test int conversion", "[testStringToInt]") {
+  using org::apache::nifi::minifi::core::Property;
+
+  uint64_t uint64_var = 0;
+  REQUIRE(Property::StringToInt("-2", uint64_var) == false);  // Negative 
shouldn't be converted to uint
 
 Review comment:
   I realize 710 kind of had a different focus, but your comment on the prior 
PR in which you mentioned this was to open 707 in hopes of opening a discussion 
for better dealing with this. For example, it may be the case where sometimes a 
negative value makes sense AND the conversion make sense. I will do some 
research, as I know these cases exist. In others, that is NOT true. 
   
   While the above test is totally valid from the perspective of 710, the hope 
was that we could discuss and more intelligently handle these cases, perhaps 
with the validators themselves. What is your perspective? Would you rather fix 
the low hanging fruit and move on or discuss alternatives?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to