You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/11/10 13:14:34 UTC

[GitHub] [nifi-minifi-cpp] aminadinari19 commented on a change in pull request #934: MINIFICPP-1330-add conversion from microseconds

aminadinari19 commented on a change in pull request #934:
URL: https://github.com/apache/nifi-minifi-cpp/pull/934#discussion_r520551885



##########
File path: libminifi/test/unit/PropertyTests.cpp
##########
@@ -22,6 +22,39 @@
 #include "../../include/core/Property.h"
 #include "utils/StringUtils.h"
 #include "../TestBase.h"
+namespace {
+enum class ParsingStatus { ParsingFail , ParsingSuccessful , ValuesMatch };
+enum class ConversionTestTarget { MS, NS };
+
+ParsingStatus checkTimeValue(const std::string &input, int64_t t1, core::TimeUnit t2) {
+  int64_t TimeVal;
+  core::TimeUnit unit;
+  bool parsing_succeeded = org::apache::nifi::minifi::core::Property::StringToTime(input, TimeVal, unit);
+  if (parsing_succeeded) {
+    if (TimeVal == t1 && unit == t2) {
+      return ParsingStatus::ValuesMatch;
+    } else {
+      return ParsingStatus::ParsingSuccessful;
+    }
+  } else {
+    return ParsingStatus::ParsingFail;
+  }
+}
+
+bool conversionTest(uint64_t number, core::TimeUnit unit, uint64_t check, ConversionTestTarget conversionUnit) {
+  uint64_t out;
+  bool returnStatus;

Review comment:
       Yeah that is always a better method. Will keep that in mind :)




----------------------------------------------------------------
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