Merge "Add LCOV macro for coverage" into tizen
[platform/core/api/connection.git] / unittest / utc-connection-common.h
index e1293d5..c87641f 100755 (executable)
 #define FEATURE_ETHERNET                       "http://tizen.org/feature/network.ethernet"
 #define FEATURE_TELEPHONY                      "http://tizen.org/feature/network.telephony"
 #define FEATURE_BT_TETHERING                   "http://tizen.org/feature/network.tethering.bluetooth"
+#define FEATURE_ROUTE                          "http://tizen.org/feature/network.route"
 #define CALLBACK_RETURN                                "callback return"
 
-GMainLoop *g_pMainLoop;
-guint g_nTimeoutId;
-int g_CallbackRet;
-
-bool wifi_supported;
-bool telephony_supported;
-bool bt_tethering_supported;
-bool ethernet_supported;
-bool all_features_not_supported;
-
-connection_profile_h profile_cellular;
-connection_profile_h profile_wifi;
-connection_profile_h profile_temp;
-connection_h connection;
-
-#define RUN_GMAIN_LOOP {\
-       g_pMainLoop = g_main_loop_new(NULL, false);\
-       g_nTimeoutId = g_timeout_add(GMAINTIMEOUT, test_connection_timeout_callback, g_pMainLoop);\
-       if (COMMON_DEBUG) {\
-               PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] Run mainloop [%p]",\
-                       __LINE__, __FUNCTION__, g_pMainLoop);\
-       }\
-       g_main_loop_run(g_pMainLoop);\
-       g_source_remove(g_nTimeoutId);\
-       g_pMainLoop = NULL;\
+extern GMainLoop *g_pMainLoop;
+extern guint g_nTimeoutId;
+extern int g_CallbackRet;
+
+extern bool wifi_supported;
+extern bool telephony_supported;
+extern bool bt_tethering_supported;
+extern bool ethernet_supported;
+extern bool route_supported;
+extern bool all_features_not_supported;
+
+extern connection_profile_h profile_cellular;
+extern connection_profile_h profile_wifi;
+extern connection_profile_h profile_temp;
+extern connection_h connection;
+
+#define RUN_GMAIN_LOOP { \
+       g_pMainLoop = g_main_loop_new(NULL, false); \
+       g_nTimeoutId = g_timeout_add(GMAINTIMEOUT, test_connection_timeout_callback, g_pMainLoop); \
+       if (COMMON_DEBUG) { \
+               PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] Run mainloop [%p]", \
+                               __LINE__, __FUNCTION__, g_pMainLoop); \
+       } \
+       g_main_loop_run(g_pMainLoop); \
+       g_source_remove(g_nTimeoutId); \
+       g_pMainLoop = NULL; \
 }
 
-#define QUIT_GMAIN_LOOP {\
-       if (g_pMainLoop)\
-{\
-       if (COMMON_DEBUG) {\
-               PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] Quit mainloop [%p]",\
-                       __LINE__, __FUNCTION__, g_pMainLoop);\
-       }\
-       g_main_loop_quit(g_pMainLoop);\
-}\
+#define QUIT_GMAIN_LOOP { \
+       if (g_pMainLoop) { \
+               if (COMMON_DEBUG) { \
+                       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] Quit mainloop [%p]", \
+                                       __LINE__, __FUNCTION__, g_pMainLoop); \
+               } \
+               g_main_loop_quit(g_pMainLoop); \
+       } \
 }
 
-#define FREE_RESOURCE(var) {\
-       if(var != NULL) {\
-               g_free(var);\
-               var = NULL;\
-       }\
+#define FREE_RESOURCE(var) { \
+       if (var != NULL) { \
+               g_free(var); \
+               var = NULL; \
+       } \
 }
 
-#define PRINT_RETURN(api, ret) {\
-       if (COMMON_DEBUG) {\
-               PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s returned = %s",\
-                       __LINE__, __FUNCTION__, api, connection_get_error(ret));\
-       }\
+#define PRINT_RETURN(api, ret) { \
+       if (COMMON_DEBUG) { \
+               PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s returned = %s", \
+                               __LINE__, __FUNCTION__, api, connection_get_error(ret)); \
+       } \
 }
 
-#define CHECK_RETURN(api, ret, val) {\
-       if (ret != val) {\
-               if (COMMON_DEBUG) {\
-                       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s failed, error returned = %s",\
-                               __LINE__, __FUNCTION__, api, connection_get_error(ret));\
-               }\
-               return 1;\
-       } else {\
-               if (COMMON_DEBUG) {\
-                       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s",\
-                               __LINE__, __FUNCTION__, api);\
-               }\
-       }\
-}
-
-#define DEBUG_LOG {\
-       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] ***** DEBUG *****", __LINE__, __FUNCTION__);\
+#define CHECK_RETURN(api, ret, val) ({ \
+       if (ret != val) { \
+               if (COMMON_DEBUG) { \
+                       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s failed, error returned = %s", \
+                                       __LINE__, __FUNCTION__, api, connection_get_error(ret)); \
+               } \
+               return 1; \
+       } else { \
+               if (COMMON_DEBUG) { \
+                       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s", \
+                                       __LINE__, __FUNCTION__, api); \
+               } \
+       } \
+})
+
+#define DEBUG_LOG { \
+       PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] ***** DEBUG *****", __LINE__, __FUNCTION__); \
 }
 
 gboolean test_connection_timeout_callback(gpointer data);