Redo unit tests for MonitorGetEntriesRequest in ProtocolMonitorGet 55/238955/7
authorZofia Abramowska <z.abramowska@samsung.com>
Mon, 20 Jul 2020 17:21:56 +0000 (19:21 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Wed, 12 Aug 2020 09:05:44 +0000 (11:05 +0200)
* squash positive test cases

Change-Id: Ida7226e6692548d181cff18f18633d10ce2f6f36

test/common/protocols/monitor/getentriesrequest.cpp

index c7f6a8ade2de36b3e84e8d5bfad0c0440faab8d3..eb5850bc0796135bf47b05249c12603f8889da4b 100644 (file)
@@ -42,16 +42,12 @@ namespace {
 
 template<>
 void compare(const Cynara::MonitorGetEntriesRequest &req1,
-             const Cynara::MonitorGetEntriesRequest &req2) {
+             const Cynara::MonitorGetEntriesRequest &req2)
+{
     EXPECT_EQ(req1.bufferSize(), req2.bufferSize());
     EXPECT_EQ(req1.sequenceNumber(), req2.sequenceNumber());
 }
 
-static const uint64_t BUFF_SIZE_MIN = 0;
-static const uint64_t BUFF_SIZE_1 = 1;
-static const uint64_t BUFF_SIZE_MAX = CYNARA_MAX_MONITOR_BUFFER_SIZE;
-static const uint64_t BUFF_SIZE_HALF = (BUFF_SIZE_MAX + BUFF_SIZE_MIN) / 2;
-
 } /* namespace anonymous */
 
 using namespace Cynara;
@@ -60,101 +56,25 @@ using namespace TestDataCollection;
 
 /* *** compare by objects test cases *** */
 
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to 0
- * @test    Expected result:
- * - buffer size is 0
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest01) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_MIN, SN::min);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    testRequest(request, protocol);
-}
-
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to 1
- * @test    Expected result:
- * - buffer size is 1
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest02) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_1, SN::min_1);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    testRequest(request, protocol);
-}
-
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to half max value
- * @test    Expected result:
- * - buffer size is half max value
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest03) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_HALF, SN::mid);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    testRequest(request, protocol);
-}
-
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to max value
- * @test    Expected result:
- * - buffer size is max value
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest04) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_MAX, SN::max);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    testRequest(request, protocol);
+TEST(ProtocolMonitorGet, MonitorGetEntriesRequestPositive) {
+    for (auto &size : Monitor::BufferSize::all) {
+        for (auto &sequenceNumber : SN::all) {
+            auto request = std::make_shared<MonitorGetEntriesRequest>(size, sequenceNumber);
+            auto protocol = std::make_shared<ProtocolMonitorGet>();
+            testRequest(request, protocol);
+        }
+    }
 }
 
 /* *** compare by serialized data test cases *** */
 
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to 0
- * @test    Expected result:
- * - buffer size is 0
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest05) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_MIN, SN::min);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    binaryTestRequest(request, protocol);
-}
-
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to 1
- * @test    Expected result:
- * - buffer size is 1
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest06) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_1, SN::min_1);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    binaryTestRequest(request, protocol);
-}
-
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to half max value
- * @test    Expected result:
- * - buffer size is half max value
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest07) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_HALF, SN::mid);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    binaryTestRequest(request, protocol);
-}
-
-/**
- * @brief   Verify if MonitorGetEntriesRequest is properly (de)serialized with buffer size set
- *          to max value
- * @test    Expected result:
- * - buffer size is max value
- */
-TEST(ProtocolMonitorGet, MonitorGetEntriesRequest08) {
-    auto request = std::make_shared<MonitorGetEntriesRequest>(BUFF_SIZE_MAX, SN::max);
-    auto protocol = std::make_shared<ProtocolMonitorGet>();
-    binaryTestRequest(request, protocol);
+TEST(ProtocolMonitorGet, MonitorGetEntriesRequestBinaryPositive) {
+    for (auto &size : Monitor::BufferSize::all) {
+        for (auto &sequenceNumber : SN::all) {
+            auto request = std::make_shared<MonitorGetEntriesRequest>(size, sequenceNumber);
+            auto protocol = std::make_shared<ProtocolMonitorGet>();
+            binaryTestRequest(request, protocol);
+        }
+    }
 }