bug fix
[framework/connectivity/nfc-manager.git] / TC / testcase / utc_net_nfc_client_nfc.c
1 #include <tet_api.h>
2
3 #include "net_nfc.h"
4 #include "net_nfc_typedef.h"
5 #include "net_nfc_util_private.h"
6
7 #ifdef SECURITY_SERVER
8 #include <security-server.h>
9 #endif
10
11
12 enum {
13         POSITIVE_TC_IDX = 0x01,
14         NEGATIVE_TC_IDX,
15 };
16 static void startup(void);
17 static void cleanup(void);
18
19 void (*tet_startup)(void) = startup;
20 void (*tet_cleanup)(void) = cleanup;
21
22 static void utc_net_nfc_initialize_p(void);
23 static void utc_net_nfc_initialize_n(void);
24 static void utc_net_nfc_deinitialize_p(void);
25 static void utc_net_nfc_deinitialize_n(void);
26 static void utc_net_nfc_set_response_callback_p(void);
27 static void utc_net_nfc_set_response_callback_n(void);
28 static void utc_net_nfc_unset_response_callback_p(void);
29 static void utc_net_nfc_unset_response_callback_n(void);
30
31 static void net_nfc_test_client_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data )
32 {
33 };
34
35
36
37 struct tet_testlist tet_testlist[] = {
38         { utc_net_nfc_initialize_p , POSITIVE_TC_IDX },
39         { utc_net_nfc_initialize_n , NEGATIVE_TC_IDX },
40         { utc_net_nfc_deinitialize_p, POSITIVE_TC_IDX },
41         { utc_net_nfc_deinitialize_n , NEGATIVE_TC_IDX},
42         { utc_net_nfc_set_response_callback_p, 1},
43         { utc_net_nfc_set_response_callback_n, 2 },
44         { utc_net_nfc_unset_response_callback_p, 1},
45         { utc_net_nfc_unset_response_callback_n, 2},
46         { NULL, 0 },
47 };
48
49 //this method is called only once in start
50 static void startup(void)
51 {
52         /* start of TC */
53 }
54
55 static void cleanup(void)
56 {
57         /* end of TC */
58 }
59 static void utc_net_nfc_initialize_p(void)
60 {
61         int ret ;
62
63         ret = net_nfc_initialize();
64         net_nfc_deinitialize();
65
66         dts_pass(__func__, "PASS");
67 }
68
69 static void utc_net_nfc_initialize_n(void)
70 {
71         int ret=0;
72
73         ret = net_nfc_initialize();
74         net_nfc_deinitialize();
75
76         dts_pass(__func__, "PASS");
77 }
78
79 static void utc_net_nfc_deinitialize_p(void)
80 {
81         int ret ;
82
83         net_nfc_initialize();
84         ret = net_nfc_deinitialize();
85
86         dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_deinitialize is failed");
87 }
88
89 static void utc_net_nfc_deinitialize_n(void)
90 {
91         int ret=0;
92
93         ret = net_nfc_deinitialize();
94
95         dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_deinitialize not allow null");
96 }
97
98 static void utc_net_nfc_set_response_callback_p(void)
99 {
100         int ret ;
101         //net_nfc_response_cb cb;
102
103         net_nfc_initialize();
104
105         ret = net_nfc_set_response_callback(net_nfc_test_client_cb, NULL);
106
107         net_nfc_unset_response_callback();
108
109         dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_set_response_callback is failed");
110 }
111
112 static void utc_net_nfc_set_response_callback_n(void)
113 {
114         int ret=0;
115
116         ret = net_nfc_set_response_callback(NULL, NULL);
117
118         dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_set_response_callback not allow null");
119 }
120
121 static void utc_net_nfc_unset_response_callback_p(void)
122 {
123         int ret ;
124         //net_nfc_response_cb cb;
125
126         net_nfc_initialize();
127
128         net_nfc_set_response_callback(net_nfc_test_client_cb, NULL);
129
130         ret = net_nfc_unset_response_callback();
131
132         net_nfc_deinitialize();
133
134         dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_unset_response_callback is failed");
135 }
136
137 static void utc_net_nfc_unset_response_callback_n(void)
138 {
139         int ret=0;
140
141         ret = net_nfc_unset_response_callback();
142
143         dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_unset_response_callback not allow null");
144 }