Update test console app 65/145265/2
authorchanywa <cbible.kim@samsung.com>
Tue, 22 Aug 2017 02:17:15 +0000 (11:17 +0900)
committerchanywa <cbible.kim@samsung.com>
Tue, 22 Aug 2017 02:56:15 +0000 (11:56 +0900)
Change-Id: I3411a40905bb151bcbcd26e9ffddc202b30783cc

test/maps_test.c [changed mode: 0755->0644]
test/maps_test.h [changed mode: 0755->0644]
test/maps_test_geocode.c
test/maps_test_geocode.h
test/maps_test_log.c [changed mode: 0755->0644]
test/maps_test_log.h
test/maps_test_search_place.c [changed mode: 0755->0644]
test/maps_test_search_place.h
test/maps_test_search_route.c
test/maps_test_util.c [changed mode: 0755->0644]
test/maps_test_util.h [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 06f19b9..eb825ae
@@ -7,18 +7,26 @@
 #include "maps_test_geocode.h"
 #include "maps_test_util.h"
 
+////////////////////////////////////////////////////////////
+
+#define DEFAULT_PROVIDER_NAME ""
+#define DEFAULT_PROVIDER_KEY  ""
+
+maps_test_logging_type g_logging_type = MAPS_TEST_LOGGING_CONSOLE;
+
+////////////////////////////////////////////////////////////
 
 maps_service_h maps_svc = NULL;
 maps_view_h maps_view = NULL;
 maps_test_state_type maps_test_state = MAPS_TEST_STATE_MAIN;
 maps_preference_h maps_pref = NULL;
 
-
 #define PROVIDER_NAME_LEN      512
 #define PROVIDER_KEY_LEN       1024
 
-char g_provider_name[PROVIDER_NAME_LEN+1] = "";
-char g_provider_key[PROVIDER_KEY_LEN+1] = "";
+char g_provider_name[PROVIDER_NAME_LEN+1] = DEFAULT_PROVIDER_NAME;
+char g_provider_key[PROVIDER_KEY_LEN+1] = DEFAULT_PROVIDER_KEY;
+char g_buffer[128];
 
 
 static int scanf_safety(const char *format, ...)
@@ -40,10 +48,17 @@ int maps_test_set_configuration()
        printf("Input provider name. [%s] : ", g_provider_name);
        scanf_safety("%s", &g_provider_name);
 
-       printf("Input provider key. [%s] : ", g_provider_key);
+       bool hide_key = (strlen(DEFAULT_PROVIDER_KEY) > 0 &&
+                                       !strncmp(g_provider_key, DEFAULT_PROVIDER_KEY, strlen(DEFAULT_PROVIDER_KEY)));
+       printf("Input provider key. [%s] : ", hide_key ? "*****" : g_provider_key);
        scanf_safety("%s", &g_provider_key);
 
-       return 0;
+       printf("Input how to print log [%s] (0:Off, 1:Console, 2:SDB, 3:All): ", get_logging_type_string(g_logging_type));
+       scanf_safety("%s", &g_buffer);
+       if (strlen(g_buffer) > 0)
+               g_logging_type = atoi(g_buffer);
+
+       return MAPS_ERROR_NONE;
 }
 
 int maps_test_create_maps_service()
@@ -55,15 +70,14 @@ int maps_test_create_maps_service()
                maps_service_set_user_consent(maps_svc, true);
                ret = maps_service_set_provider_key(maps_svc, g_provider_key);
        }
-       print_result(ret == MAPS_ERROR_NONE);
        return ret;
 }
 
 int maps_test_destroy_maps_service()
 {
        int ret = maps_service_destroy(maps_svc);
-       maps_svc = NULL;
-       print_result(ret == MAPS_ERROR_NONE);
+       if (ret == MAPS_ERROR_NONE)
+               maps_svc = NULL;
        return ret;
 }
 
@@ -94,9 +108,15 @@ void print_menu()
        printf("  2\t - Search Place By Address\n");
        printf("  3\t - Search Place By Area\n");
        printf("  4\t - Search Place List\n");
-       printf("  5\t - Geocode\n");
-       printf("  6\t - Reverse Geocode\n");
-       printf("  7\t - Route\n");
+       printf("  5\t - Search Place & Cancel\n");
+       printf("  6\t - Geocode\n");
+       printf("  7\t - Reverse Geocode\n");
+       printf("  8\t - Multi-reverse Geocode\n");
+       printf("  9\t - Route\n");
+       printf("----------------------------------------\n");
+       printf("  A\t - Stress Test - Search Place\n");
+       printf("  B\t - Stress Test - Geocode\n");
+       printf("  E\t - Stress Test - Route\n");
        printf("----------------------------------------\n");
        printf("  x\t - Exit\n");
        printf("========================================\n");
@@ -110,13 +130,19 @@ int maps_test_startup()
 
 int maps_test_finish()
 {
-       int ret = maps_test_destroy_maps_service();
+       int ret = 0;
+       if (maps_svc) {
+               ret = maps_service_destroy(maps_svc);
+               maps_svc = NULL;
+       }
+       print_result(ret);
        return ret;
 }
 
 bool run_command(char cmd)
 {
-       int ret = 0;
+       int ret = 0, i;
+
        switch ((int)maps_test_state) {
        case MAPS_TEST_STATE_MAIN:
                switch (cmd) {
@@ -129,19 +155,37 @@ bool run_command(char cmd)
                case '2': ret = maps_test_search_place_by_address(maps_svc); break;
                case '3': ret = maps_test_search_place_by_area(maps_svc); break;
                case '4': ret = maps_test_search_place_list(maps_svc); break;
-               case '5': ret = maps_test_geocode(maps_svc); break;
-               case '6': ret = maps_test_reverse_geocode(maps_svc); break;
-               case '7': ret = maps_test_search_route(maps_svc); break;
-
+               case '5': ret = maps_test_search_place_cancel(maps_svc); break;
+               case '6': ret = maps_test_geocode(maps_svc); break;
+               case '7': ret = maps_test_reverse_geocode(maps_svc); break;
+               case '8': ret = maps_test_multi_reverse_geocode(maps_svc); break;
+               case '9': ret = maps_test_search_route(maps_svc); break;
+
+               case 'A':
+                       for (i = 0 ; i < 100; i++) {
+                               ret = maps_test_search_place(maps_svc);
+                               g_usleep(100000);
+                       }
+                       break;
+               case 'B':
+                       for (i = 0 ; i < 100; i++) {
+                               ret = maps_test_geocode(maps_svc);
+                               g_usleep(100000);
+                       }
+                       break;
+               case 'E':
+                       for (i = 0 ; i < 100; i++) {
+                               ret = maps_test_search_route(maps_svc);
+                               g_usleep(100000);
+                       }
+                       break;
                case 'x': return false;
                case '\0': print_menu(); break;
                default: printf("Unknown command\n"); break;
                }
                break;
        }
-       if (ret != 0)
-               printf("Error = 0x%X\n", ret);
-
+       print_result(ret);
        return true;
 }
 
@@ -157,7 +201,8 @@ void *test_thread(void *data)
        };
 
        maps_test_finish();
-       exit(0);
+       g_main_loop_quit(data);
+       g_main_loop_unref(data);
        return NULL;
 }
 
@@ -169,7 +214,7 @@ int main(int argc, char **argv)
        g_type_init();
 #endif
        mainloop = g_main_loop_new(NULL, FALSE);
-       g_thread_new("capi-maps-service-test", &test_thread, NULL);
+       g_thread_new("capi-maps-service-test", &test_thread, mainloop);
        g_main_loop_run(mainloop);
 
        return 0;
old mode 100755 (executable)
new mode 100644 (file)
index 61aa095..6823d1f
@@ -38,6 +38,9 @@ extern maps_preference_h maps_pref;
 #endif
 
 
+
+#if 1
+
 #undef LOG_TAG
 #define LOG_TAG "MST_SERVICE"
 #define LOGD(fmt, args...) printf("%s(%d) "fmt"\n", __FUNCTION__, __LINE__, ##args)
@@ -75,4 +78,48 @@ extern maps_preference_h maps_pref;
        if (lv.strval) { free(lv.strval); lv.strval = NULL; } \
        lv.intval = 0; lv.dblval = 0.; lv.longval = 0;
 
+#else
+
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "MAPS_TEST"
+//#define LOGD(fmt, args...) log_print(DLOG_DEBUG, LOG_TAG, "%s(%d) "fmt"\n", __FUNCTION__, __LINE__, ##args)
+//#define LOGE(fmt, args...) log_print(DLOG_DEBUG, LOG_TAG, "%s(%d) "fmt"\n", __FUNCTION__, __LINE__, ##args)
+#define ENTER_FUNC  log_print(DLOG_DEBUG, LOG_TAG, "ENTER FUNC : %s (%d)\n", __FUNCTION__, __LINE__);
+#define EXIT_FUNC   log_print(DLOG_DEBUG, LOG_TAG, "EXIT FUNC  : %s (%d)\n", __FUNCTION__, __LINE__);
+
+
+#define SEL_STR(name, str) (name && *name ? name : str)
+
+
+
+#define LOG_PREFIX  "    "
+
+#define LOG_VARIABLES() \
+       logval_type lv; lv.strval = NULL; lv.intval = 0; lv.dblval = 0; lv.longval = 0;
+
+#define LOG_START_TITLE(fmt, args...) {\
+       log_print(DLOG_DEBUG, LOG_TAG, "\n"); \
+       log_print(DLOG_DEBUG, LOG_TAG, "================================================================================\n"); \
+       log_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##args); \
+       log_print(DLOG_DEBUG, LOG_TAG, "--------------------------------------------------------------------------------\n"); \
+}
+
+#define LOG_START(fmt, args...) \
+       if (fmt && *fmt && strlen(fmt) > 0) log_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##args);
+
+#define LOG_PRINT(fmt, args...) { \
+       if (fmt && *fmt) log_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##args); \
+       if (lv.strval) { free(lv.strval); lv.strval = NULL; } \
+       lv.intval = 0; lv.dblval = 0.; lv.longval = 0; }
+
+#define LOG_FINISH(fmt, args...) \
+       if (fmt && *fmt) log_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##args); \
+       if (lv.strval) { free(lv.strval); lv.strval = NULL; } \
+       lv.intval = 0; lv.dblval = 0.; lv.longval = 0;
+
+#endif
+
+
 #endif /*MAPS_TEST_H*/
index 1176e69..2b860ed 100644 (file)
@@ -8,12 +8,18 @@ static void startup()
 {
 }
 
-static void cleanup(bool result)
+static void cleanup()
 {
-       print_result(result);
+}
+
+static void cleanup_callback(int error)
+{
+       print_result(error);
+       cleanup();
 }
 
 
+
 /*
  *
  *     callback functions for APIs
@@ -27,8 +33,7 @@ static bool __maps_test_geocode_cb(maps_error_e error, int request_id,
        LOG_START_TITLE("%s [%d/%d] ", (user_data ? (char*)user_data : __FUNCTION__), MIN(index+1, total), total);
 
        if (error) {
-               LOGD("error=%d", error);
-               cleanup(false);
+               cleanup_callback(error);
                return false;
        }
 
@@ -37,7 +42,7 @@ static bool __maps_test_geocode_cb(maps_error_e error, int request_id,
        LOG_FINISH("");
 
        if (index == total - 1)
-               cleanup(true);
+               cleanup_callback(error);
        return true;
 }
 
@@ -49,7 +54,7 @@ int maps_test_geocode(maps_service_h maps_svc)
        error = maps_service_geocode(maps_svc, "Berlin", maps_pref, __maps_test_geocode_cb, "Geocoding with Berlin", &request_id);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
        return error;
 }
 
@@ -60,8 +65,7 @@ static void __maps_test_reverse_geocode_cb(maps_error_e error, int request_id,
        LOG_START_TITLE("%s [%d/%d] ", (user_data ? (char*)user_data : __FUNCTION__), MIN(index+1, total), total);
 
        if (error) {
-               LOGD("error=%d", error);
-               cleanup(false);
+               cleanup_callback(error);
                return;
        }
 
@@ -70,7 +74,7 @@ static void __maps_test_reverse_geocode_cb(maps_error_e error, int request_id,
        LOG_FINISH("");
 
        if (index == total - 1)
-               cleanup(true);
+               cleanup_callback(error);
 }
 
 int maps_test_reverse_geocode(maps_service_h maps_svc)
@@ -82,7 +86,60 @@ int maps_test_reverse_geocode(maps_service_h maps_svc)
                        __maps_test_reverse_geocode_cb, "Reverse-geocoding with [12.944594, 77.554303]", &request_id);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
+       return error;
+}
+
+
+
+
+
+
+
+
+
+static bool __maps_test_multi_reverse_geocode_cb(maps_error_e error, int request_id, int total,
+       maps_address_list_h address_list, void *user_data)
+{
+       LOG_VARIABLES();
+
+       LOG_START_TITLE("%s [%d] ", (user_data ? (char*)user_data : __FUNCTION__), total);
+
+       if (error) {
+               cleanup_callback(error);
+               return false;
+       }
+
+       log_address("", address_list);
+       maps_address_list_destroy(address_list);
+       LOG_FINISH("");
+
+       cleanup_callback(error);
+       return true;
+}
+
+int maps_test_multi_reverse_geocode(maps_service_h maps_svc)
+{
+       startup();
+       int request_id = 0, error;
+
+       maps_coordinates_h coordinates[3];
+       maps_coordinates_create(52.5309, 13.3845, &coordinates[0]);
+       maps_coordinates_create(50.1618996, 8.5334997, &coordinates[1]);
+       maps_coordinates_create(40.72962607104243, -73.98685008095087, &coordinates[2]);
+
+       maps_coordinates_list_h coordinates_list;
+       maps_coordinates_list_create(&coordinates_list);
+       maps_coordinates_list_append(coordinates_list, coordinates[0]);
+       maps_coordinates_list_append(coordinates_list, coordinates[1]);
+       maps_coordinates_list_append(coordinates_list, coordinates[2]);
+
+       error = maps_service_multi_reverse_geocode(maps_svc, coordinates_list, maps_pref,
+                       __maps_test_multi_reverse_geocode_cb, "Multi-reverse Geocoding", &request_id);
+       maps_coordinates_list_destroy(coordinates_list);
+
+       if (error != MAPS_ERROR_NONE)
+               cleanup();
        return error;
 }
 
index 2f25023..8072b0a 100644 (file)
@@ -4,4 +4,6 @@
 int maps_test_geocode(maps_service_h maps_svc);
 int maps_test_reverse_geocode(maps_service_h maps_svc);
 
+int maps_test_multi_reverse_geocode(maps_service_h maps_svc);
+
 #endif /*__MAPS_TEST_GEOCODE_H__*/
old mode 100755 (executable)
new mode 100644 (file)
index c62c4b5..c23e863
@@ -149,3 +149,24 @@ void log_place_rating(char *prefix, maps_place_rating_h rating)
 
        LOG_FINISH("%s}", prefix);
 }
+
+
+
+extern maps_test_logging_type g_logging_type;
+
+void log_print(int level, const char *tag, const char *format, ...)
+{
+       maps_test_logging_type type = g_logging_type;
+       if (type == MAPS_TEST_LOGGING_NONE) return;
+
+       va_list args;
+       va_start(args, format);
+       if (type == MAPS_TEST_LOGGING_CONSOLE || type == MAPS_TEST_LOGGING_ALL)
+               printf(format, args);
+       #if 0
+       if (type == MAPS_TEST_LOGGING_SDB || type == MAPS_TEST_LOGGING_ALL)
+               dlog_print(level, tag, format, args);
+       #endif
+       va_end(args);
+}
+
index 336947a..d9f64ab 100644 (file)
@@ -4,6 +4,14 @@
 #include <maps_service.h>
 
 
+typedef enum
+{
+       MAPS_TEST_LOGGING_NONE,
+       MAPS_TEST_LOGGING_CONSOLE,
+       MAPS_TEST_LOGGING_SDB,
+       MAPS_TEST_LOGGING_ALL,
+} maps_test_logging_type;
+
 
 void log_address(char *prefix, maps_address_h address);
 void log_area(char *prefix, maps_area_h area);
@@ -13,6 +21,6 @@ void log_place_rating(char *prefix, maps_place_rating_h rating);
 void log_place_link_object(char *prefix, char *title, maps_place_link_object_h link);
 void log_place_media(char *prefix, maps_place_media_h media);
 
-
+void log_print(int level, const char *tag, const char *format, ...);
 
 #endif /*__MST_SERVICE_LOG_H__*/
old mode 100755 (executable)
new mode 100644 (file)
index 1c72a88..fc1b2dd
@@ -18,10 +18,8 @@ static void startup()
        maps_place_filter_create(&maps_place_filter);
 }
 
-static void cleanup(bool result)
+static void cleanup()
 {
-       print_result(result);
-
        unlimited_cnt = 0;
        if (--ref_cnt > 0) return;
 
@@ -30,6 +28,11 @@ static void cleanup(bool result)
        maps_place_filter = NULL;
 }
 
+static void cleanup_callback(int error)
+{
+       print_result(error);
+       cleanup();
+}
 
 
 
@@ -288,8 +291,7 @@ static bool __maps_service_search_place_cb(maps_error_e error, int request_id ,
        LOG_START_TITLE("%s [%d/%d] ", (user_data ? (char*)user_data : __FUNCTION__), MIN(index+1, total), total);
 
        if (error) {
-               LOG_PRINT("error=%d", error);
-               cleanup(false);
+               cleanup_callback(error);
                return false;
        }
 
@@ -299,7 +301,7 @@ static bool __maps_service_search_place_cb(maps_error_e error, int request_id ,
        LOG_FINISH("");
 
        if (index == total - 1)
-               cleanup(true);
+               cleanup_callback(error);
        return true;
 }
 
@@ -320,12 +322,12 @@ static void __maps_service_search_place_list_cb(maps_error_e error,
                 int request_id, int total, maps_place_list_h place_list, void *user_data)
 {
        if (error) {
-               LOGD("error=%d", error);
-               cleanup(false);
+               print_result(error);
+               cleanup_callback(error);
                return;
        }
        maps_place_list_foreach(place_list, __maps_place_cb, user_data);
-       cleanup(true);
+       cleanup_callback(error);
 }
 
 
@@ -354,7 +356,7 @@ int maps_test_search_place(maps_service_h maps_svc)
        maps_coordinates_destroy(coordinates);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
        return error;
 }
 
@@ -378,7 +380,7 @@ int maps_test_search_place_by_address(maps_service_h maps_svc)
        maps_area_destroy(area);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
        return error;
 }
 
@@ -389,8 +391,8 @@ int maps_test_search_place_by_area(maps_service_h maps_svc)
 
        maps_coordinates_h top_left, bottom_right;
        maps_area_h area;
-       maps_coordinates_create(15.665354, 74.311523, &top_left);
-       maps_coordinates_create(10.617418, 79.145508, &bottom_right);
+       maps_coordinates_create(52.51605, 12.37691, &top_left);
+       maps_coordinates_create(54.12351, 14.22351, &bottom_right);
        maps_area_create_rectangle(top_left, bottom_right, &area);
 
        error = maps_service_search_place_by_area(maps_svc, area, maps_place_filter, maps_pref,
@@ -401,7 +403,7 @@ int maps_test_search_place_by_area(maps_service_h maps_svc)
        maps_area_destroy(area);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
        return error;
 }
 
@@ -423,6 +425,30 @@ int maps_test_search_place_list(maps_service_h maps_svc)
        maps_area_destroy(area);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
+       return error;
+}
+
+
+int maps_test_search_place_cancel(maps_service_h maps_svc)
+{
+       startup();
+       int request_id = 0, error;
+
+       maps_coordinates_h coordinates;
+       maps_coordinates_create(48.85784, 2.29516, &coordinates);
+
+       maps_place_filter_set_place_name(maps_place_filter, "Berlin");
+       maps_preference_set_property(maps_pref, MAPS_PLACE_FILTER_SORT_BY, "distance");
+
+       error = maps_service_search_place(maps_svc, coordinates, 5, maps_place_filter, maps_pref,
+                       __maps_service_search_place_cb, "Search Place", &request_id);
+
+       maps_service_cancel_request(maps_svc, request_id);
+       maps_coordinates_destroy(coordinates);
+
+       if (error != MAPS_ERROR_NONE)
+               cleanup();
        return error;
 }
+
index 18ba40a..663a825 100755 (executable)
@@ -9,4 +9,6 @@ int maps_test_search_place_by_area(maps_service_h maps_svc);
 
 int maps_test_search_place_list(maps_service_h maps_svc);
 
+int maps_test_search_place_cancel(maps_service_h maps_svc);
+
 #endif /*__MAPS_TEST_SEARCH_PLACE_H__*/
index 73f82e2..6bab323 100644 (file)
@@ -10,12 +10,15 @@ static void startup()
 {
 }
 
-static void cleanup(bool result)
+static void cleanup()
 {
-       print_result(result);
 }
 
-
+static void cleanup_callback(int error)
+{
+       print_result(error);
+       cleanup();
+}
 
 
 
@@ -194,7 +197,8 @@ static bool __maps_service_search_route_cb(maps_error_e error,
        LOG_START_TITLE("%s [%d/%d] ", (user_data ? (char*)user_data : __FUNCTION__), MIN(index+1, total), total);
 
        if (error) {
-               cleanup(false);
+               print_result(error);
+               cleanup_callback(error);
                return false;
        }
 
@@ -204,7 +208,7 @@ static bool __maps_service_search_route_cb(maps_error_e error,
        LOG_FINISH("");
 
        if (index == total - 1)
-               cleanup(true);
+               cleanup_callback(error);
        return true;
 }
 
@@ -225,7 +229,7 @@ int maps_test_search_route(maps_service_h maps_svc)
        maps_coordinates_destroy(dest);
 
        if (error != MAPS_ERROR_NONE)
-               cleanup(false);
+               cleanup();
        return error;
 }
 
old mode 100755 (executable)
new mode 100644 (file)
index 0511d79..86dd3b8
@@ -34,10 +34,43 @@ const char* get_distance_unit_string(maps_distance_unit_e distance_unit)
        return distance_unit_string[distance_unit];
 }
 
-void print_result(bool result)
+const char* get_maps_error_string(int error)
 {
-       if (result)
-               printf("Ok\n");
+       switch (error) {
+       case MAPS_ERROR_NONE:                  return "MAPS_ERROR_NONE";
+       case MAPS_ERROR_PERMISSION_DENIED:     return "MAPS_ERROR_PERMISSION_DENIED";
+       case MAPS_ERROR_OUT_OF_MEMORY:         return "MAPS_ERROR_OUT_OF_MEMORY";
+       case MAPS_ERROR_INVALID_PARAMETER:     return "MAPS_ERROR_INVALID_PARAMETER";
+       case MAPS_ERROR_NOT_SUPPORTED:         return "MAPS_ERROR_NOT_SUPPORTED";
+       case MAPS_ERROR_CONNECTION_TIME_OUT:   return "MAPS_ERROR_CONNECTION_TIME_OUT";
+       case MAPS_ERROR_NETWORK_UNREACHABLE:   return "MAPS_ERROR_NETWORK_UNREACHABLE";
+       case MAPS_ERROR_INVALID_OPERATION:     return "MAPS_ERROR_INVALID_OPERATION";
+       case MAPS_ERROR_KEY_NOT_AVAILABLE:     return "MAPS_ERROR_KEY_NOT_AVAILABLE";
+       case MAPS_ERROR_RESOURCE_BUSY:         return "MAPS_ERROR_RESOURCE_BUSY";
+       case MAPS_ERROR_CANCELED:              return "MAPS_ERROR_CANCELED";
+       case MAPS_ERROR_UNKNOWN:               return "MAPS_ERROR_UNKNOWN";
+       case MAPS_ERROR_USER_NOT_CONSENTED:    return "MAPS_ERROR_USER_NOT_CONSENTED";
+       case MAPS_ERROR_SERVICE_NOT_AVAILABLE: return "MAPS_ERROR_SERVICE_NOT_AVAILABLE";
+       case MAPS_ERROR_NOT_FOUND:             return "MAPS_ERROR_NOT_FOUND";
+       }
+       return "Unknow error code";
+}
+
+const char* get_logging_type_string(maps_test_logging_type type)
+{
+       switch (type) {
+       case MAPS_TEST_LOGGING_NONE:    break;
+       case MAPS_TEST_LOGGING_CONSOLE: return "Console";
+       case MAPS_TEST_LOGGING_SDB:     return "SDB";
+       case MAPS_TEST_LOGGING_ALL:     return "All";
+       }
+       return "Off";
+}
+
+void print_result(int error)
+{
+       if (error == MAPS_ERROR_NONE)
+               printf("## Ok\n");
        else
-               printf("Fail\n");
+               printf("## Fail (%s)\n", get_maps_error_string(error));
 }
old mode 100755 (executable)
new mode 100644 (file)
index 1d8ab64..5f314e7
@@ -2,12 +2,15 @@
 #define __MAPS_TEST_UTIL_H__
 
 #include <maps_route.h>
+#include "maps_test_log.h"
 
 const char* get_direction_string(maps_route_direction_e direction);
 const char* get_turn_type_string(maps_route_turn_type_e turn_type);
 const char* get_transport_string(maps_route_transport_mode_e transport);
 const char* get_distance_unit_string(maps_distance_unit_e distance_unit);
 
-void print_result(bool result);
+const char* get_maps_error_string(int error);
+void print_result(int error);
+const char* get_logging_type_string(maps_test_logging_type type);
 
 #endif /*__MAPS_TEST_UTIL_H__*/