Fix coding rule of parcel_utils.cc
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 15 Mar 2021 08:32:51 +0000 (17:32 +0900)
committer연정현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jungh.yeon@samsung.com>
Mon, 15 Mar 2021 22:56:22 +0000 (07:56 +0900)
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
test/unit_tests/parcel_utils.cc

index ad05a96..8adbede 100644 (file)
@@ -28,25 +28,26 @@ bool IS_STR_EQ(const char *a, const char *b) {
   return strcmp(a, b) == 0;
 }
 
-#define STR_EQ(str_a, str_b) do {                                              \
-    if (!IS_STR_EQ(str_a, str_b)) {                                            \
-      std::cout << #str_a << "(" << str_a << ") is not equal to "              \
-          << #str_b << "(" << str_b << ")" <<  std::endl;                      \
-      return false;                                                            \
-    }                                                                          \
+#define STR_EQ(str_a, str_b) do {                                            \
+    if (!IS_STR_EQ(str_a, str_b)) {                                          \
+      std::cout << #str_a << "(" << str_a << ") is not equal to "            \
+          << #str_b << "(" << str_b << ")" <<  std::endl;                    \
+      return false;                                                          \
+    }                                                                        \
 } while (0);
 
-#define INT_EQ(a, b) do {                                                      \
-    if (a != b) {                                                              \
-      std::cout << #a << "(" << a << ") is not equal to "                      \
-          << #b << "(" << b << ")" <<  std::endl;                              \
-      return false;                                                            \
-    }                                                                          \
+#define INT_EQ(a, b) do {                                                    \
+    if (a != b) {                                                            \
+      std::cout << #a << "(" << a << ") is not equal to "                    \
+          << #b << "(" << b << ")" <<  std::endl;                            \
+      return false;                                                          \
+    }                                                                        \
 } while (0);
 
 application_x *GetTestApplication(std::string appid) {
   application_x *application;
-  application = reinterpret_cast<application_x*>(calloc(1, sizeof(application_x)));
+  application =
+      reinterpret_cast<application_x*>(calloc(1, sizeof(application_x)));
 
   application->appid = strdup(appid.c_str());
   application->exec = strdup("test_exec");
@@ -160,7 +161,8 @@ application_x *GetTestApplication(std::string appid) {
   splashscreen->type = strdup("ttest_type");
   splashscreen->dpi = strdup("test_dpi");
   splashscreen->orientation = strdup("orientattest_orientation");
-  splashscreen->indicatordisplay = strdup("indicatordisptest_indicatordisplay");
+  splashscreen->indicatordisplay =
+      strdup("indicatordisptest_indicatordisplay");
   splashscreen->operation = strdup("operattest_operation");
   splashscreen->color_depth = strdup("color_detest_color_depth");
   application->splashscreens =
@@ -189,7 +191,8 @@ bool IsEqualApplication(application_x *applicationA,
   STR_EQ(applicationA->portraitimg, applicationB->portraitimg);
   STR_EQ(applicationA->landscapeimg, applicationB->landscapeimg);
   STR_EQ(applicationA->effectimage_type, applicationB->effectimage_type);
-  STR_EQ(applicationA->guestmode_visibility, applicationB->guestmode_visibility);
+  STR_EQ(applicationA->guestmode_visibility,
+      applicationB->guestmode_visibility);
   STR_EQ(applicationA->component, applicationB->component);
   STR_EQ(applicationA->permission_type, applicationB->permission_type);
   STR_EQ(applicationA->component_type, applicationB->component_type);
@@ -214,14 +217,17 @@ bool IsEqualApplication(application_x *applicationA,
   STR_EQ(applicationA->api_version, applicationB->api_version);
   STR_EQ(applicationA->for_all_users, applicationB->for_all_users);
   STR_EQ(applicationA->is_disabled, applicationB->is_disabled);
-  STR_EQ(applicationA->splash_screen_display, applicationB->splash_screen_display);
+  STR_EQ(applicationA->splash_screen_display,
+      applicationB->splash_screen_display);
   STR_EQ(applicationA->external_path, applicationB->external_path);
   STR_EQ(applicationA->package_system, applicationB->package_system);
   STR_EQ(applicationA->removable, applicationB->removable);
-  STR_EQ(applicationA->package_installed_time, applicationB->package_installed_time);
+  STR_EQ(applicationA->package_installed_time,
+      applicationB->package_installed_time);
   STR_EQ(applicationA->support_mode, applicationB->support_mode);
 
-  INT_EQ(g_list_length(applicationA->label), g_list_length(applicationB->label));
+  INT_EQ(g_list_length(applicationA->label),
+      g_list_length(applicationB->label));
   for (GList *a = applicationA->label, *b = applicationB->label;
       a && b; a = a->next, b = b->next) {
     label_x *label_a = reinterpret_cast<label_x *>(a->data);
@@ -231,7 +237,8 @@ bool IsEqualApplication(application_x *applicationA,
     STR_EQ(label_a->text, label_b->text);
   }
 
-  INT_EQ(g_list_length(applicationA->icon), g_list_length(applicationB->icon));
+  INT_EQ(g_list_length(applicationA->icon),
+      g_list_length(applicationB->icon));
   for (GList *a = applicationA->icon, *b = applicationB->icon;
       a && b; a = a->next, b = b->next) {
     icon_x *icon_a = reinterpret_cast<icon_x *>(a->data);
@@ -244,7 +251,8 @@ bool IsEqualApplication(application_x *applicationA,
     STR_EQ(icon_a->text, icon_b->text);
   }
 
-  INT_EQ(g_list_length(applicationA->image), g_list_length(applicationB->image));
+  INT_EQ(g_list_length(applicationA->image),
+      g_list_length(applicationB->image));
   for (GList *a = applicationA->image, *b = applicationB->image;
       a && b; a = a->next, b = b->next) {
     image_x *image_a = reinterpret_cast<image_x *>(a->data);
@@ -295,7 +303,8 @@ bool IsEqualApplication(application_x *applicationA,
 
   INT_EQ(g_list_length(applicationA->background_category),
       g_list_length(applicationB->background_category));
-  for (GList *a = applicationA->background_category, *b = applicationB->background_category;
+  for (GList *a = applicationA->background_category,
+      *b = applicationB->background_category;
       a && b; a = a->next, b = b->next) {
     char *background_category_a = reinterpret_cast<char *>(a->data);
     char *background_category_b = reinterpret_cast<char *>(b->data);
@@ -325,10 +334,13 @@ bool IsEqualApplication(application_x *applicationA,
 
   INT_EQ(g_list_length(applicationA->splashscreens),
       g_list_length(applicationB->splashscreens));
-  for (GList *a = applicationA->splashscreens, *b = applicationB->splashscreens;
+  for (GList *a = applicationA->splashscreens,
+      *b = applicationB->splashscreens;
       a && b; a = a->next, b = b->next) {
-    splashscreen_x *splashscreen_a = reinterpret_cast<splashscreen_x *>(a->data);
-    splashscreen_x *splashscreen_b = reinterpret_cast<splashscreen_x *>(b->data);
+    splashscreen_x *splashscreen_a =
+        reinterpret_cast<splashscreen_x *>(a->data);
+    splashscreen_x *splashscreen_b =
+        reinterpret_cast<splashscreen_x *>(b->data);
     STR_EQ(splashscreen_a->color_depth, splashscreen_b->color_depth);
     STR_EQ(splashscreen_a->dpi, splashscreen_b->dpi);
     STR_EQ(splashscreen_a->indicatordisplay, splashscreen_b->indicatordisplay);
@@ -343,7 +355,6 @@ bool IsEqualApplication(application_x *applicationA,
 
 bool IsEqualApplications(const std::vector<application_x *>& applicationsA,
     const std::vector<application_x *>& applicationsB) {
-  if (applicationsA.size() , applicationsB.size());
 
   for (unsigned int i = 0; i < applicationsA.size(); ++i) {
     if (!IsEqualApplication(applicationsA[i], applicationsB[i]))
@@ -412,34 +423,44 @@ package_x *GetTestPackage(std::string pkgid) {
 
   package->author = g_list_append(package->author, author);
 
-  description_x* description = reinterpret_cast<description_x*>(calloc(1, sizeof(description_x)));
+  description_x* description =
+      reinterpret_cast<description_x*>(calloc(1, sizeof(description_x)));
   description->name = strdup("test_name");
   description->text = strdup("test_text");
   description->lang = strdup("test_lang");
 
   package->description = g_list_append(package->description, description);
 
-  privilege_x* privilege = reinterpret_cast<privilege_x*>(calloc(1, sizeof(privilege_x)));
+  privilege_x* privilege =
+      reinterpret_cast<privilege_x*>(calloc(1, sizeof(privilege_x)));
   privilege->type = strdup("test_type");
   privilege->value = strdup("test_value");
 
   package->privileges = g_list_append(package->privileges, privilege);
 
-  appdefined_privilege_x* appdefined_privilege = reinterpret_cast<appdefined_privilege_x*>(calloc(1, sizeof(appdefined_privilege_x)));
+  appdefined_privilege_x* appdefined_privilege =
+      reinterpret_cast<appdefined_privilege_x*>(
+          calloc(1, sizeof(appdefined_privilege_x)));
   appdefined_privilege->type = strdup("test_type");
   appdefined_privilege->value = strdup("test_value");
   appdefined_privilege->license = strdup("test_license");
 
-  package->appdefined_privileges = g_list_append(package->appdefined_privileges, appdefined_privilege);
+  package->appdefined_privileges =
+      g_list_append(package->appdefined_privileges, appdefined_privilege);
 
-  appdefined_privilege_x* provides_appdefined_privileges = reinterpret_cast<appdefined_privilege_x*>(calloc(1, sizeof(appdefined_privilege_x)));
+  appdefined_privilege_x* provides_appdefined_privileges =
+      reinterpret_cast<appdefined_privilege_x*>(
+          calloc(1, sizeof(appdefined_privilege_x)));
   provides_appdefined_privileges->type = strdup("test_type");
   provides_appdefined_privileges->value = strdup("test_value");
   provides_appdefined_privileges->license = strdup("test_license");
 
-  package->provides_appdefined_privileges = g_list_append(package->provides_appdefined_privileges, provides_appdefined_privileges);
+  package->provides_appdefined_privileges =
+      g_list_append(package->provides_appdefined_privileges,
+          provides_appdefined_privileges);
 
-  dependency_x* dependency = reinterpret_cast<dependency_x*>(calloc(1, sizeof(dependency_x)));
+  dependency_x* dependency =
+      reinterpret_cast<dependency_x*>(calloc(1, sizeof(dependency_x)));
   dependency->depends_on = strdup("test_depends_on");
   dependency->type = strdup("test_type");
   dependency->required_version = strdup("test_required_version");
@@ -527,7 +548,8 @@ bool IsEqualPackage(package_x *packageA, package_x *packageB) {
     STR_EQ(author_a->text, author_b->text);
   }
 
-  INT_EQ(g_list_length(packageA->description), g_list_length(packageB->description));
+  INT_EQ(g_list_length(packageA->description),
+      g_list_length(packageB->description));
   for (GList *a = packageA->description, *b = packageB->description;
       a && b; a = a->next, b = b->next) {
     description_x *description_a = reinterpret_cast<description_x *>(a->data);
@@ -537,7 +559,8 @@ bool IsEqualPackage(package_x *packageA, package_x *packageB) {
     STR_EQ(description_a->text, description_b->text);
   }
 
-  INT_EQ(g_list_length(packageA->privileges), g_list_length(packageB->privileges));
+  INT_EQ(g_list_length(packageA->privileges),
+      g_list_length(packageB->privileges));
   for (GList *a = packageA->privileges, *b = packageB->privileges;
       a && b; a = a->next, b = b->next) {
     privilege_x *privilege_a = reinterpret_cast<privilege_x *>(a->data);
@@ -546,27 +569,36 @@ bool IsEqualPackage(package_x *packageA, package_x *packageB) {
     STR_EQ(privilege_a->value, privilege_b->value);
   }
 
-  INT_EQ(g_list_length(packageA->appdefined_privileges), g_list_length(packageB->appdefined_privileges));
-  for (GList *a = packageA->appdefined_privileges, *b = packageB->appdefined_privileges;
+  INT_EQ(g_list_length(packageA->appdefined_privileges),
+      g_list_length(packageB->appdefined_privileges));
+  for (GList *a = packageA->appdefined_privileges,
+      *b = packageB->appdefined_privileges;
       a && b; a = a->next, b = b->next) {
-    appdefined_privilege_x *privilege_a = reinterpret_cast<appdefined_privilege_x *>(a->data);
-    appdefined_privilege_x *privilege_b = reinterpret_cast<appdefined_privilege_x *>(b->data);
+    appdefined_privilege_x *privilege_a =
+        reinterpret_cast<appdefined_privilege_x *>(a->data);
+    appdefined_privilege_x *privilege_b =
+        reinterpret_cast<appdefined_privilege_x *>(b->data);
     STR_EQ(privilege_a->license, privilege_b->license);
     STR_EQ(privilege_a->type, privilege_b->type);
     STR_EQ(privilege_a->value, privilege_b->value);
   }
 
-  INT_EQ(g_list_length(packageA->provides_appdefined_privileges), g_list_length(packageB->provides_appdefined_privileges));
-  for (GList *a = packageA->provides_appdefined_privileges, *b = packageB->provides_appdefined_privileges;
+  INT_EQ(g_list_length(packageA->provides_appdefined_privileges),
+      g_list_length(packageB->provides_appdefined_privileges));
+  for (GList *a = packageA->provides_appdefined_privileges,
+      *b = packageB->provides_appdefined_privileges;
       a && b; a = a->next, b = b->next) {
-    appdefined_privilege_x *privilege_a = reinterpret_cast<appdefined_privilege_x *>(a->data);
-    appdefined_privilege_x *privilege_b = reinterpret_cast<appdefined_privilege_x *>(b->data);
+    appdefined_privilege_x *privilege_a =
+        reinterpret_cast<appdefined_privilege_x *>(a->data);
+    appdefined_privilege_x *privilege_b =
+        reinterpret_cast<appdefined_privilege_x *>(b->data);
     STR_EQ(privilege_a->license, privilege_b->license);
     STR_EQ(privilege_a->type, privilege_b->type);
     STR_EQ(privilege_a->value, privilege_b->value);
   }
 
-  INT_EQ(g_list_length(packageA->dependencies), g_list_length(packageB->dependencies));
+  INT_EQ(g_list_length(packageA->dependencies),
+      g_list_length(packageB->dependencies));
   for (GList *a = packageA->dependencies, *b = packageB->dependencies;
       a && b; a = a->next, b = b->next) {
     dependency_x *dependency_a = reinterpret_cast<dependency_x *>(a->data);
@@ -587,7 +619,8 @@ bool IsEqualPackage(package_x *packageA, package_x *packageB) {
     STR_EQ(plugin_a->plugin_type, plugin_b->plugin_type);
   }
 
-  INT_EQ(g_list_length(packageA->application), g_list_length(packageB->application));
+  INT_EQ(g_list_length(packageA->application),
+      g_list_length(packageB->application));
   for (GList *a = packageA->application, *b = packageB->application;
       a && b; a = a->next, b = b->next) {
     application_x *application_a = reinterpret_cast<application_x *>(a->data);
@@ -617,27 +650,32 @@ pkgmgrinfo_filter_x *GetTestFilter() {
   pkgmgrinfo_filter_x *filter;
   pkgmgrinfo_node_x *node;
   pkgmgrinfo_metadata_node_x *metadata_node;
-  filter = reinterpret_cast<pkgmgrinfo_filter_x*>(calloc(1, sizeof(pkgmgrinfo_filter_x)));
+  filter = reinterpret_cast<pkgmgrinfo_filter_x*>(
+      calloc(1, sizeof(pkgmgrinfo_filter_x)));
 
   filter->uid = 1234;
-  node = reinterpret_cast<pkgmgrinfo_node_x *>(calloc(1, sizeof(pkgmgrinfo_node_x)));
+  node = reinterpret_cast<pkgmgrinfo_node_x *>(
+      calloc(1, sizeof(pkgmgrinfo_node_x)));
   node->prop = 4321;
   node->key = strdup("test_key1");
   node->value = strdup("test_value1");
   filter->list = g_slist_append(filter->list, node);
 
-  node = reinterpret_cast<pkgmgrinfo_node_x *>(calloc(1, sizeof(pkgmgrinfo_node_x)));
+  node = reinterpret_cast<pkgmgrinfo_node_x *>(
+      calloc(1, sizeof(pkgmgrinfo_node_x)));
   node->prop = 4321;
   node->key = strdup("test_key2");
   node->value = strdup("test_value2");
   filter->list = g_slist_append(filter->list, node);
 
-  metadata_node = reinterpret_cast<pkgmgrinfo_metadata_node_x *>(calloc(1, sizeof(pkgmgrinfo_metadata_node_x)));
+  metadata_node = reinterpret_cast<pkgmgrinfo_metadata_node_x *>(
+      calloc(1, sizeof(pkgmgrinfo_metadata_node_x)));
   metadata_node->key = strdup("test_metadata_key1");
   metadata_node->value = strdup("test_metadata_value1");
   filter->list_metadata = g_slist_append(filter->list_metadata, metadata_node);
 
-  metadata_node = reinterpret_cast<pkgmgrinfo_metadata_node_x *>(calloc(1, sizeof(pkgmgrinfo_metadata_node_x)));
+  metadata_node = reinterpret_cast<pkgmgrinfo_metadata_node_x *>(
+      calloc(1, sizeof(pkgmgrinfo_metadata_node_x)));
   metadata_node->key = strdup("test_metadata_key2");
   metadata_node->value = strdup("test_metadata_value2");
   filter->list_metadata = g_slist_append(filter->list_metadata, metadata_node);
@@ -659,11 +697,14 @@ bool IsEqualFilter(const pkgmgrinfo_filter_x *filterA,
     STR_EQ(node_a->value, node_b->value);
   }
 
-  INT_EQ(g_slist_length(filterA->list_metadata), g_slist_length(filterB->list_metadata));
+  INT_EQ(g_slist_length(filterA->list_metadata),
+      g_slist_length(filterB->list_metadata));
   for (GSList *a = filterA->list_metadata, *b = filterB->list_metadata;
       a && b; a = a->next, b = b->next) {
-    pkgmgrinfo_metadata_node_x *node_a = reinterpret_cast<pkgmgrinfo_metadata_node_x *>(a->data);
-    pkgmgrinfo_metadata_node_x *node_b = reinterpret_cast<pkgmgrinfo_metadata_node_x *>(b->data);
+    pkgmgrinfo_metadata_node_x *node_a =
+        reinterpret_cast<pkgmgrinfo_metadata_node_x *>(a->data);
+    pkgmgrinfo_metadata_node_x *node_b =
+        reinterpret_cast<pkgmgrinfo_metadata_node_x *>(b->data);
     STR_EQ(node_a->key, node_b->key);
     STR_EQ(node_a->value, node_b->value);
   }
@@ -673,7 +714,8 @@ bool IsEqualFilter(const pkgmgrinfo_filter_x *filterA,
 
 pkgmgr_certinfo_x *GetTestCertInfo() {
   pkgmgr_certinfo_x *cert_info;
-  cert_info = reinterpret_cast<pkgmgr_certinfo_x*>(calloc(1, sizeof(pkgmgr_certinfo_x)));
+  cert_info = reinterpret_cast<pkgmgr_certinfo_x*>(
+      calloc(1, sizeof(pkgmgr_certinfo_x)));
 
   cert_info->for_all_users = 1;
   cert_info->pkgid = strdup("test_pkgid");