Fix redefinition and expression of macro 36/264736/1 accepted/tizen/6.5/unified/20211028.115055 accepted/tizen/unified/20211001.001342 submit/tizen/20210929.051143 submit/tizen_6.5/20211028.163201 tizen_6.5.m2_release
authortaemin.yeom <taemin.yeom@samsung.com>
Wed, 29 Sep 2021 04:50:27 +0000 (13:50 +0900)
committertaemin.yeom <taemin.yeom@samsung.com>
Wed, 29 Sep 2021 04:50:27 +0000 (13:50 +0900)
Change-Id: I7c4fe6eaf34371fd00f4520bd02f466cbe549c34
Signed-off-by: taemin.yeom <taemin.yeom@samsung.com>
haltest/main.cpp
haltest/sensor-device.cpp
haltest/sensor-haltest.h

index a142e3e..a0da52b 100644 (file)
@@ -13,12 +13,6 @@ protected:
        }
 
        void SetUp() override {
-        int ret_val = check_feature_all();
-        if (!ret_val) {
-            SKIP_MESSAGE("All sensor features are false");
-            GTEST_SKIP();
-            return;
-        }
     }
        void TearDown() override {}
 };
index ed28660..2856c8f 100644 (file)
@@ -23,12 +23,6 @@ public:
        }
 
        void SetUp() override {
-               int ret_val = check_feature_all();
-               if (!ret_val) {
-                       SKIP_MESSAGE("All sensor features are false");
-                       GTEST_SKIP();
-                       return;
-               }
        }
        void TearDown() override{}
 };
@@ -36,21 +30,18 @@ public:
 int SENSOR_DEV::device_count = 0;
 device_registry_t SENSOR_DEV::devices;
 
-#define SKIP_NO_FEATURE() \
-       if (!check_feature_all()) { \
-                       return; \
-       }
-
 #define SKIP_NO_DEV() \
+do { \
        if (device_count <= 0) { \
                SKIP_MESSAGE("There is no sensor devices."); \
                return; \
-       }
+       } \
+} while (0)
 
 TEST_F(SENSOR_DEV, get_poll_fdP)
 {
-       SKIP_NO_FEATURE()
-       SKIP_NO_DEV()
+       SKIP_NO_FEATURE();
+       SKIP_NO_DEV();
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
                EXPECT_NE((*it)->get_poll_fd(), 0);
@@ -62,8 +53,8 @@ TEST_F(SENSOR_DEV, get_sensorsP)
        const sensor_info_t *sensors = nullptr;
        int ret_func;
 
-       SKIP_NO_FEATURE()
-       SKIP_NO_DEV()
+       SKIP_NO_FEATURE();
+       SKIP_NO_DEV();
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
                ret_func = (*it)->get_sensors(&sensors);
@@ -74,8 +65,8 @@ TEST_F(SENSOR_DEV, get_sensorsP)
 
 TEST_F(SENSOR_DEV, get_sensorsN)
 {
-       SKIP_NO_FEATURE()
-       SKIP_NO_DEV()
+       SKIP_NO_FEATURE();
+       SKIP_NO_DEV();
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
                EXPECT_EQ((*it)->get_sensors(nullptr), -EINVAL);
@@ -162,8 +153,8 @@ TEST_F(SENSOR_DEV, get_dataP)
        sensor_data_t *data = NULL;
        const sensor_info_t *sensors = nullptr;
 
-       SKIP_NO_FEATURE()
-       SKIP_NO_DEV()
+       SKIP_NO_FEATURE();
+       SKIP_NO_DEV();
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
                EXPECT_GE((*it)->get_sensors(&sensors), 1);
@@ -178,8 +169,8 @@ TEST_F(SENSOR_DEV, get_dataN)
        int length = 0;
        sensor_data_t *data = NULL;
 
-       SKIP_NO_FEATURE()
-       SKIP_NO_DEV()
+       SKIP_NO_FEATURE();
+       SKIP_NO_DEV();
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
                EXPECT_EQ((*it)->get_data(0, &data, &length), -EINVAL);
index bd4ec43..a1f2e9f 100644 (file)
@@ -21,7 +21,7 @@
 #include <string.h>
 
 #if (GTEST_VERSION_MAJOR < 1 || (GTEST_VERSION_MAJOR == 1 && GTEST_VERSION_MINOR < 10))
-#define GTEST_SKIP() ;
+#define GTEST_SKIP()
 // hack gtest internal for print message
 namespace testing
 {
@@ -54,9 +54,13 @@ do { \
 } while (0)
 
 #define SKIP_NO_FEATURE() \
+do { \
        if (!check_feature_all()) { \
+            SKIP_MESSAGE("All sensor features are false"); \
+            GTEST_SKIP(); \
                        return; \
-       }
+       } \
+} while (0)
 
 // SetUp/TearDown function for a testsuite differ by gtest version
 #if (GTEST_VERSION_MAJOR >= 2 || (GTEST_VERSION_MAJOR == 1 && GTEST_VERSION_MINOR >= 10))