61aa0951255760cfec5357ffecb2a4d0c8b4f352
[platform/core/api/maps-service.git] / test / maps_test.h
1 #ifndef MAPS_TEST_H
2 #define MAPS_TEST_H
3
4
5 #include <maps_service.h>
6 #include <maps_service_internal.h>
7
8
9 typedef enum {
10         MAPS_TEST_STATE_MAIN,
11         MAPS_TEST_STATE_CONFIG,
12         MAPS_TEST_STATE_AUTOTEST,
13         MAPS_TEST_STATE_MANUALTEST,
14 } maps_test_state_type;
15
16 typedef enum {
17         MAPS_TEST_SUBSTATE_AUTO_SEARCH_PLACE,
18         MAPS_TEST_SUBSTATE_AUTO_SEARCH_PLACE_BY_ADDRESS,
19 } maps_test_substate_type;
20
21 typedef struct {
22         char *strval;
23         int intval;
24         double dblval;
25         long longval;
26 } logval_type;
27
28 extern maps_service_h maps_svc;
29 extern maps_preference_h maps_pref;
30
31
32 #ifndef MIN
33 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
34 #endif
35
36 #ifndef MAX
37 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
38 #endif
39
40
41 #undef LOG_TAG
42 #define LOG_TAG "MST_SERVICE"
43 #define LOGD(fmt, args...) printf("%s(%d) "fmt"\n", __FUNCTION__, __LINE__, ##args)
44 #define LOGE(fmt, args...) printf("%s(%d) "fmt"\n", __FUNCTION__, __LINE__, ##args)
45 #define ENTER_FUNC  printf("ENTER FUNC : %s (%d)\n", __FUNCTION__, __LINE__);
46 #define EXIT_FUNC   printf("EXIT FUNC  : %s (%d)\n", __FUNCTION__, __LINE__);
47
48
49 #define SEL_STR(name, str) (name && *name ? name : str)
50
51
52
53 #define LOG_PREFIX  "    "
54
55 #define LOG_VARIABLES() \
56         logval_type lv; lv.strval = NULL; lv.intval = 0; lv.dblval = 0; lv.longval = 0;
57
58 #define LOG_START_TITLE(fmt, args...) {\
59         printf("\n"); \
60         printf("================================================================================\n"); \
61         printf(fmt"\n", ##args); \
62         printf("--------------------------------------------------------------------------------\n"); \
63 }
64
65 #define LOG_START(fmt, args...) \
66         if (fmt && *fmt && strlen(fmt) > 0) printf(fmt"\n", ##args);
67
68 #define LOG_PRINT(fmt, args...) { \
69         if (fmt && *fmt) printf(fmt"\n", ##args); \
70         if (lv.strval) { free(lv.strval); lv.strval = NULL; } \
71         lv.intval = 0; lv.dblval = 0.; lv.longval = 0; }
72
73 #define LOG_FINISH(fmt, args...) \
74         if (fmt && *fmt) printf(fmt"\n", ##args); \
75         if (lv.strval) { free(lv.strval); lv.strval = NULL; } \
76         lv.intval = 0; lv.dblval = 0.; lv.longval = 0;
77
78 #endif /*MAPS_TEST_H*/