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



##########
File path: libminifi/test/archive-tests/CompressContentTests.cpp
##########
@@ -91,851 +91,826 @@ class ReadCallback: public 
org::apache::nifi::minifi::InputStreamCallback {
   int archive_buffer_size_;
 };
 
-TEST_CASE("CompressFileGZip", "[compressfiletest1]") {
-  try {
-    std::ofstream expectfile;
-    expectfile.open(EXPECT_COMPRESS_CONTENT);
+class CompressDecompressionTestController : public TestController{
+protected:
+  static std::string tempDir;
+  static std::string raw_content_path;
+  static std::string compressed_content_path;
+  static TestController global_controller;
+public:
+  class RawContent{
+    std::string content_;
+    RawContent(std::string&& content_): content_(std::move(content_)) {}
+    friend class CompressDecompressionTestController;
+  public:
+    bool operator==(const std::string& actual) const noexcept {
+      return content_ == actual;
+    }
+    bool operator!=(const std::string& actual) const noexcept {
+      return content_ != actual;
+    }
+  };
 
-    std::mt19937 gen(std::random_device { }());
+  std::string rawContentPath() const {
+    return raw_content_path;
+  }
+
+  std::string compressedPath() const {
+    return compressed_content_path;
+  }
+
+  RawContent getRawContent() const {;
+    std::ifstream file;
+    file.open(raw_content_path, std::ios::binary);
+    std::string contents((std::istreambuf_iterator<char>(file)), 
std::istreambuf_iterator<char>());
+    file.close();
+    return {std::move(contents)};
+  }
+
+  virtual ~CompressDecompressionTestController() = 0;
+};
+
+CompressDecompressionTestController::~CompressDecompressionTestController() {}

Review comment:
       Thanks for teaching me something new. :) 




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to