Add test case invalid parameter for get display name by pkgtype
[platform/core/security/privilege-info.git] / test / tc_privilege_info.c
old mode 100755 (executable)
new mode 100644 (file)
index c4f992b..97e28bd
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2014-2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <privilege_information.h>
@@ -21,11 +37,6 @@ static void __change_color_to_green()
        printf("%c[%d;%dm", 0x1B, BRIGHTNESS, GREEN);
 }
 
-static void __change_color_to_yellow()
-{
-       printf("%c[%d;%dm", 0x1B, BRIGHTNESS, YELLOW);
-}
-
 static void __change_color_to_origin()
 {
        printf("%c[%dm", 0x1B, 0);
@@ -51,39 +62,37 @@ static const char* __get_result_string(privilege_info_error_e ret)
 
 static void __check_get_privilege_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* display_name)
 {
-       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("--- expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
-               printf("not matched\n");
                __change_color_to_red();
-               printf("test fail\n");
+               printf("TEST RESULT: FAILED\n");
                fail_cnt++;
        } else {
-               printf("matched\n");
                if (result == PRVINFO_ERROR_NONE) {
                        if (display_name == NULL) {
-                               printf("display_name must not be NULL\n");
+                               printf("--- display_name must not be NULL\n");
                                __change_color_to_red();
-                               printf("test fail\n");
+                               printf("TEST RESULT: FAILED\n");
                                fail_cnt++;
                                __change_color_to_origin();
                                return;
                        } else {
-                               printf("display_name = %s\n", display_name);
+                               printf("--- display_name = %s\n", display_name);
                        }
                } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
                        if (display_name != NULL) {
-                               printf("display_name = %s\n", display_name);
-                               printf("display_name must be NULL\n");
+                               printf("--- display_name = %s\n", display_name);
+                               printf("--- display_name must be NULL\n");
                                __change_color_to_red();
-                               printf("test fail\n");
+                               printf("TEST RESULT: FAILED\n");
                                fail_cnt++;
                                __change_color_to_origin();
                                return;
                        }
                }
                __change_color_to_green();
-               printf("test success\n");
+               printf("TEST RESULT: SUCCESS\n");
                success_cnt++;
        }
        __change_color_to_origin();
@@ -92,32 +101,30 @@ static void __check_get_privilege_display_name_result(privilege_info_error_e exp
 
 static void __check_get_privilege_description_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* description)
 {
-       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("--- expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
-               printf("not matched\n");
                __change_color_to_red();
-               printf("test fail\n");
+               printf("TEST RESULT: FAILED\n");
                fail_cnt++;
        } else {
-          printf("matched\n");
           if (result == PRVINFO_ERROR_NONE) {
                        if (description == NULL) {
-                               printf("description must not be NULL\n");
+                               printf("--- description must not be NULL\n");
                                __change_color_to_red();
-                               printf("test fail\n");
+                               printf("TEST RESULT: FAILED\n");
                                fail_cnt++;
                                __change_color_to_origin();
                                return;
                        } else {
-                               printf("description = %s\n", description);
+                               printf("--- description = %s\n", description);
                        }
                } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
                        if (description != NULL) {
-                               printf("description = %s\n", description);
-                               printf("description must be NULL\n");
+                               printf("--- description = %s\n", description);
+                               printf("--- description must be NULL\n");
                                __change_color_to_red();
-                               printf("test fail\n");
+                               printf("TEST RESULT: FAILED\n");
                                fail_cnt++;
                                __change_color_to_origin();
                                return;
@@ -125,7 +132,7 @@ static void __check_get_privilege_description_result(privilege_info_error_e expe
                }
 
                __change_color_to_green();
-               printf("test success\n");
+               printf("TEST RESULT: SUCCESS\n");
                success_cnt++;
        }
        __change_color_to_origin();
@@ -133,40 +140,39 @@ static void __check_get_privilege_description_result(privilege_info_error_e expe
 
 static void __check_get_privacy_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* privacy_display)
 {
-       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("--- expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
-               printf("not matched\n");
                __change_color_to_red();
-               printf("test fail\n");
+               printf("TEST RESULT: FAILED\n");
                fail_cnt++;
        } else {
-               printf("matched\n");
                if (privacy_display != NULL)
-                       printf("privacy_display_name = %s\n", privacy_display);
+                       printf("--- privacy_display_name = %s\n", privacy_display);
                else
-                       printf("privacy_display_name is NULL.\n");
+                       printf("--- privacy_display_name is NULL.\n");
                __change_color_to_green();
-               printf("test success\n");
+               printf("TEST RESULT: SUCCESS\n");
                success_cnt++;
        }
        __change_color_to_origin();
 }
 
-static void __test_privilege_info_get_display_name()
+static void __test_positive_privilege_info_get_display_name()
 {
        int ret;
        char* display_name = NULL;
 
-       printf("-----------------------------------------------------------\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/window.priority.set\n");
        ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
 
        printf("-----------------------------------------------------------\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -174,10 +180,18 @@ static void __test_privilege_info_get_display_name()
        ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/mediacapture", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Not existing privilege\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+       free(display_name);
+}
+
+static void __test_negative_privilege_info_get_display_name()
+{
+       int ret;
+       char * display_name = NULL;
+
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- Not existing privilege\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -185,10 +199,10 @@ static void __test_privilege_info_get_display_name()
        ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Invalid parameter\n");
-       printf("api_version : NULL\n");
-       printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- Invalid parameter\n");
+       printf("--- api_version : NULL\n");
+       printf("--- privilege : http://tizen.org/privilege/window.priority.set\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -199,22 +213,22 @@ static void __test_privilege_info_get_display_name()
        free(display_name);
 }
 
-static void __test_privilege_info_get_display_name_by_pkgtype()
+static void __test_positive_privilege_info_get_display_name_by_pkgtype()
 {
        int ret;
        char* display_name = NULL;
 
-       printf("-----------------------------------------------------------\n");
-       printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/window.priority.set\n");
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
 
-       printf("-----------------------------------------------------------\n");
-       printf("pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -222,11 +236,19 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Mismatched package type: write WEB as NATIVE\n");
-       printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       free(display_name);
+}
+
+static void __test_negative_privilege_info_get_display_name_by_pkgtype()
+{
+       int ret;
+       char* display_name = NULL;
+
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- Mismatched package type: write WEB as NATIVE\n");
+       printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -234,11 +256,10 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
 
-
-       printf("-----------------------------------------------------------\n");
-       printf("Not existing privilege\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- Not existing privilege\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -246,10 +267,10 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Invalid parameter\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       printf("TEST NAME: %s #3\n",__func__);
+       printf("--- Invalid parameter\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (display_name != NULL) {
                free(display_name);
                display_name = NULL;
@@ -257,23 +278,36 @@ static void __test_privilege_info_get_display_name_by_pkgtype()
        ret = privilege_info_get_display_name_by_pkgtype(NULL, "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
        __check_get_privilege_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, display_name);
 
+       printf("TEST NAME: %s #4\n",__func__);
+       printf("--- Invalid parameter\n");
+       printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NONE\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
+       if (display_name != NULL) {
+               free(display_name);
+               display_name = NULL;
+       }
+       ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NONE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
+       __check_get_privilege_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, display_name);
+
        free(display_name);
 }
 
-static void __test_privilege_info_get_description()
+
+static void __test_positive_privilege_info_get_description()
 {
        int ret;
        char* description = NULL;
 
-       printf("-----------------------------------------------------------\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/window.priority.set\n");
        ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/window.priority.set", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -281,10 +315,18 @@ static void __test_privilege_info_get_description()
        ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/mediacapture", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Not existing privilege\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+       free(description);
+}
+
+static void __test_negative_privilege_info_get_description()
+{
+       int ret;
+       char* description = NULL;
+
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- Not existing privilege\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -292,10 +334,10 @@ static void __test_privilege_info_get_description()
        ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Invalid parameter\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- Invalid parameter\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -306,20 +348,20 @@ static void __test_privilege_info_get_description()
        free(description);
 }
 
-static void __test_privilege_info_get_description_by_pkgtype()
+static void __test_positive_privilege_info_get_description_by_pkgtype()
 {
        int ret;
        char* description = NULL;
 
-       printf("-----------------------------------------------------------\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/window.priority.set\n");
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -327,11 +369,19 @@ static void __test_privilege_info_get_description_by_pkgtype()
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Mismatched package type: write WEB as NATIVE\n");
-       printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/mediacapture\n");
+       free(description);
+}
+
+static void __test_negative_privilege_info_get_description_by_pkgtype()
+{
+       int ret;
+       char* description = NULL;
+
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- Mismatched package type: write WEB as NATIVE\n");
+       printf("--- pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/mediacapture\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -339,10 +389,10 @@ static void __test_privilege_info_get_description_by_pkgtype()
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Not existing privilege\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- Not existing privilege\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -350,10 +400,10 @@ static void __test_privilege_info_get_description_by_pkgtype()
        ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
        __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
 
-       printf("-----------------------------------------------------------\n");
-       printf("Invalid parameter\n");
-       printf("api_version : 2.3\n");
-       printf("privilege : NULL\n");
+       printf("TEST NAME: %s #3\n",__func__);
+       printf("--- Invalid parameter\n");
+       printf("--- api_version : 2.3\n");
+       printf("--- privilege : NULL\n");
        if (description != NULL) {
                free(description);
                description = NULL;
@@ -364,76 +414,86 @@ static void __test_privilege_info_get_description_by_pkgtype()
        free(description);
 }
 
-static void __test_privilege_info_get_privacy_display_name()
+static void __test_positive_privilege_info_get_privacy_display_name()
 {
        int ret;
        char* privacy_display_name = NULL;
 
-       printf("-----------------------------------------------------------\n");
-       printf("Invalid parameter\n");
-       printf("no input privilege\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- Privacy related privilege\n");
+       printf("--- privilege: http://tizen.org/privilege/account.read\n");
+       ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/account.read", &privacy_display_name);
+       __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name);
+
+       free(privacy_display_name);
+}
+
+static void __test_negative_privilege_info_get_privacy_display_name()
+{
+       int ret;
+       char* privacy_display_name = NULL;
+
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- Invalid parameter\n");
+       printf("--- no input privilege\n");
        ret = privilege_info_get_privacy_display_name(NULL, &privacy_display_name);
-       __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name);
+       __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name);
 
        if (privacy_display_name != NULL) {
                free(privacy_display_name);
                privacy_display_name = NULL;
        }
 
-       printf("-----------------------------------------------------------\n");
-       printf("Not a privacy related privilege\n");
-       printf("privilege: http://tizen.org/privilege/internet\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- Not a privacy related privilege\n");
+       printf("--- privilege: http://tizen.org/privilege/internet\n");
        ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/internet", &privacy_display_name);
-       __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name);
+       __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name);
 
        if (privacy_display_name != NULL) {
                free(privacy_display_name);
                privacy_display_name = NULL;
        }
 
-       printf("-----------------------------------------------------------\n");
-       printf("Not existing privilege\n");
-       printf("privilege: http://tizen.org/privilege/wrong.privilege.name\n");
+       printf("TEST NAME: %s #3\n",__func__);
+       printf("--- Not existing privilege\n");
+       printf("--- privilege: http://tizen.org/privilege/wrong.privilege.name\n");
        ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/wrong.privilege.name", &privacy_display_name);
-       __check_get_privacy_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, privacy_display_name);
+       __check_get_privacy_display_name_result(PRVINFO_ERROR_NOT_SUPPORTED, ret, privacy_display_name);
 
        if (privacy_display_name != NULL) {
                free(privacy_display_name);
                privacy_display_name = NULL;
        }
 
-       printf("-----------------------------------------------------------\n");
-       printf("Privacy related privilege\n");
-       printf("privilege: http://tizen.org/privilege/account.read\n");
-       ret = privilege_info_get_privacy_display_name("http://tizen.org/privilege/account.read", &privacy_display_name);
-       __check_get_privacy_display_name_result(PRVINFO_ERROR_NONE, ret, privacy_display_name);
-
        free(privacy_display_name);
 }
 
 static void __check_privilege_info_get_privilege_info(privilege_info_error_e expected_result, privilege_info_error_e result, GList* privilege_info_list, int return_result)
 {
-       printf("expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
+       printf("--- expected : %s\n  result : %s\n", __get_result_string(expected_result), __get_result_string(result));
 
        if (expected_result != result) {
-               __change_color_to_yellow();
-               printf("not matched\n");
+               __change_color_to_red();
+               printf("TEST RESULT: FAILED\n");
+               fail_cnt++;
                __change_color_to_origin();
        } else {
                __change_color_to_green();
-               printf("matched\n");
+               printf("TEST RESULT: SUCCESS\n");
+               success_cnt++;
                __change_color_to_origin();
        }
 
-       printf("return_result = %d\n", return_result);
+       printf("--- return_result = %d\n", return_result);
        GList* l;
        if (result == PRVINFO_ERROR_NONE) {
                for (l = privilege_info_list; l != NULL; l = l->next) {
                        privilege_info_s* privilege_info = (privilege_info_s*)l->data;
 
-                       printf("privilege_info->privilege_name = %s\n", privilege_info->privilege_name);
-                       printf("privilege_info->display_name = %s\n", privilege_info->display_name);
-                       printf("privilege_info->description = %s\n", privilege_info->description);
+                       printf("--- privilege_info->privilege_name = %s\n", privilege_info->privilege_name);
+                       printf("--- privilege_info->display_name = %s\n", privilege_info->display_name);
+                       printf("--- privilege_info->description = %s\n", privilege_info->description);
                        printf("\n");
                }
        }
@@ -441,18 +501,18 @@ static void __check_privilege_info_get_privilege_info(privilege_info_error_e exp
        printf("\n");
 }
 
-static void __test_privilege_info_get_privilege_info_list()
+static void __test_positive_privilege_info_get_privilege_info_list()
 {
        GList* privilege_name_list = NULL;
        GList* privilege_info_list = NULL;
        privilege_consumer_return_code_e return_result;
        int ret;
 
-       printf("case : SUCCESS\n");
-       printf("locale : ko_KR.UTF8\n");
-       printf("privilege name : http://tizen.org/privilege/call\n");
-       printf("privilege name : http://tizen.org/privilege/content.read\n");
-       printf("privilege name : http://tizen.org/privilege/filesystem.read\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- locale : ko_KR.UTF8\n");
+       printf("--- privilege name : http://tizen.org/privilege/call\n");
+       printf("--- privilege name : http://tizen.org/privilege/content.read\n");
+       printf("--- privilege name : http://tizen.org/privilege/filesystem.read\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read");
@@ -465,11 +525,11 @@ static void __test_privilege_info_get_privilege_info_list()
        privilege_info_list = NULL;
        printf("-----------------------------------------------------------\n");
 
-       printf("case : SUCCESS2\n");
-       printf("locale : ko_KR.UTF8\n");
-       printf("privilege name : http://tizen.org/privilege/call\n");
-       printf("privilege name : http://tizen.org/privilege/systemsettings.admin\n");
-       printf("privilege name : http://tizen.org/privilege/bookmark.admin\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- locale : ko_KR.UTF8\n");
+       printf("--- privilege name : http://tizen.org/privilege/call\n");
+       printf("--- privilege name : http://tizen.org/privilege/systemsettings.admin\n");
+       printf("--- privilege name : http://tizen.org/privilege/bookmark.admin\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/systemsettings.admin");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/bookmark.admin");
@@ -482,11 +542,11 @@ static void __test_privilege_info_get_privilege_info_list()
        privilege_info_list = NULL;
        printf("-----------------------------------------------------------\n");
 
-       printf("case : SUCCESS3\n");
-       printf("locale : ko_KR.UTF8\n");
-       printf("privilege name : http://tizen.org/privilege/call\n");
-       printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n");
-       printf("privilege name : http://tizen.org/privilege/account.xxx\n");
+       printf("TEST NAME: %s #3\n",__func__);
+       printf("--- locale : ko_KR.UTF8\n");
+       printf("--- privilege name : http://tizen.org/privilege/call\n");
+       printf("--- privilege name : http://tizen.org/privilege/alarm.xxxx\n");
+       printf("--- privilege name : http://tizen.org/privilege/account.xxx\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx");
@@ -498,12 +558,21 @@ static void __test_privilege_info_get_privilege_info_list()
        privilege_info_free_privilege_info_list(privilege_info_list);
        privilege_info_list = NULL;
        printf("-----------------------------------------------------------\n");
+}
+
+static void __test_negative_privilege_info_get_privilege_info_list()
+{
+       GList* privilege_name_list = NULL;
+       GList* privilege_info_list = NULL;
+       privilege_consumer_return_code_e return_result;
+       int ret;
 
-       printf("case : UNKNOWN_LOCAL_CODE\n");
-       printf("locale : xx_XX.UTF8\n");
-       printf("privilege name : http://tizen.org/privilege/call\n");
-       printf("privilege name : http://tizen.org/privilege/content.read\n");
-       printf("privilege name : http://tizen.org/privilege/filesystem.read\n");
+       printf("TEST NAME: %s #1\n",__func__);
+       printf("--- UNKNOWN_LOCAL_CODE\n");
+       printf("--- locale : xx_XX.UTF8\n");
+       printf("--- privilege name : http://tizen.org/privilege/call\n");
+       printf("--- privilege name : http://tizen.org/privilege/content.read\n");
+       printf("--- privilege name : http://tizen.org/privilege/filesystem.read\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read");
@@ -514,13 +583,13 @@ static void __test_privilege_info_get_privilege_info_list()
        privilege_name_list = NULL;
        privilege_info_free_privilege_info_list(privilege_info_list);
        privilege_info_list = NULL;
-       printf("-----------------------------------------------------------\n");
 
-       printf("case : INVAILD_PARAMETER\n");
-       printf("locale : ko_KR.UTF8\n");
-       printf("privilege name : http://tizen.org/privilege/xxxx\n");
-       printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n");
-       printf("privilege name : http://tizen.org/privilege/account.xxx\n");
+       printf("TEST NAME: %s #2\n",__func__);
+       printf("--- INVAILD_PARAMETER\n");
+       printf("--- locale : ko_KR.UTF8\n");
+       printf("--- privilege name : http://tizen.org/privilege/xxxx\n");
+       printf("--- privilege name : http://tizen.org/privilege/alarm.xxxx\n");
+       printf("--- privilege name : http://tizen.org/privilege/account.xxx\n");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/xxxx");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx");
        privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx");
@@ -532,40 +601,33 @@ static void __test_privilege_info_get_privilege_info_list()
        privilege_info_free_privilege_info_list(privilege_info_list);
        privilege_info_list = NULL;
        printf("-----------------------------------------------------------\n");
-
 }
 
 int main()
 {
-       __change_color_to_yellow();
-       printf("Test function : privilege_info_get_display_name\n");
        __change_color_to_origin();
-       __test_privilege_info_get_display_name();
+       __test_positive_privilege_info_get_display_name();
+       __test_negative_privilege_info_get_display_name();
 
-       __change_color_to_yellow();
-       printf("Test function : privilege_info_get_display_name_by_pkgtype\n");
        __change_color_to_origin();
-       __test_privilege_info_get_display_name_by_pkgtype();
+       __test_positive_privilege_info_get_display_name_by_pkgtype();
+       __test_negative_privilege_info_get_display_name_by_pkgtype();
 
-       __change_color_to_yellow();
-       printf("Test function : privilege_info_get_description\n");
        __change_color_to_origin();
-       __test_privilege_info_get_description();
+       __test_positive_privilege_info_get_description();
+       __test_negative_privilege_info_get_description();
 
-       __change_color_to_yellow();
-       printf("Test function : privilege_info_get_description_by_pkgtype\n");
        __change_color_to_origin();
-       __test_privilege_info_get_description_by_pkgtype();
+       __test_positive_privilege_info_get_description_by_pkgtype();
+       __test_negative_privilege_info_get_description_by_pkgtype();
 
-       __change_color_to_yellow();
-       printf("Test function : privilege_info_get_privacy_display_name\n");
        __change_color_to_origin();
-       __test_privilege_info_get_privacy_display_name();
+       __test_positive_privilege_info_get_privacy_display_name();
+       __test_negative_privilege_info_get_privacy_display_name();
 
-       __change_color_to_yellow();
-       printf("Test function : privilege_info_get_privilege_info_list\n");
        __change_color_to_origin();
-       __test_privilege_info_get_privilege_info_list();
+       __test_positive_privilege_info_get_privilege_info_list();
+       __test_negative_privilege_info_get_privilege_info_list();
 
        __change_color_to_green();
        printf("Test Complete\n");