martinzink commented on code in PR #1473: URL: https://github.com/apache/nifi-minifi-cpp/pull/1473#discussion_r1063430431
########## libminifi/test/unit/ResourceQueueTests.cpp: ########## @@ -76,20 +81,39 @@ TEST_CASE("Resource limitation is not set to the resource queue", "[utils::Resou } TEST_CASE("resource returns when it goes out of scope", "[utils::ResourceQueue]") { - auto queue = utils::ResourceQueue<int>::create(std::nullopt, nullptr); + using std::chrono::steady_clock; + auto queue = utils::ResourceQueue<steady_clock::time_point>::create([]{ return std::make_unique<steady_clock::time_point>(steady_clock::time_point::min()); }); + { + auto resource = queue->getResource(); + CHECK(*resource == steady_clock::time_point::min()); + *resource = steady_clock::now(); + } + { + auto resource = queue->getResource(); + CHECK(*resource != steady_clock::time_point::min()); + } +} + +TEST_CASE("resource resets when it goes out of scope", "[utils::ResourceQueue]") { + using std::chrono::steady_clock; + auto queue = utils::ResourceQueue<steady_clock::time_point>::create([]{ return std::make_unique<steady_clock::time_point>(steady_clock::time_point::min()); }, + std::nullopt, + [](steady_clock::time_point& resource){ resource = steady_clock::time_point::max();}); Review Comment: Good idea, I've changed this and also included some additional checks aswell in https://github.com/apache/nifi-minifi-cpp/pull/1473/commits/5279824fbde23389279cce46b2859f979d93044f -- 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. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org