Git init
[framework/system/dlog.git] / TC / unit / utc_ApplicationFW___dlog_vprint_func.c
1 #include <stdarg.h>
2 #include <tet_api.h>
3 #include "dlog.h"
4 #define LOG_BUF_SIZE 1024
5 static void startup(void);
6 static void cleanup(void);
7
8 void (*tet_startup)(void) = startup;
9 void (*tet_cleanup)(void) = cleanup;
10
11 static void utc_ApplicationFW___dlog_vprint_func_01(void);
12 static void utc_ApplicationFW___dlog_vprint_func_02(void);
13
14 enum {
15         POSITIVE_TC_IDX = 0x01,
16         NEGATIVE_TC_IDX,
17 };
18
19 struct tet_testlist tet_testlist[] = {
20         { utc_ApplicationFW___dlog_vprint_func_01, POSITIVE_TC_IDX },
21         { utc_ApplicationFW___dlog_vprint_func_02, NEGATIVE_TC_IDX },
22         { NULL, 0 }
23 };
24
25 static int pid;
26 char *fmt = "dlog test message for tetware\n";
27
28 static void startup(void)
29 {
30 }
31
32 static void cleanup(void)
33 {
34 }
35 /**
36  * @brief Positive test case of __dlog_vprint()
37  */
38 void utc_ApplicationFW___dlog_vprint_func_01(void)
39 {
40         int r = 0;
41         char buf[LOG_BUF_SIZE];
42         va_list ap;
43
44         /*      va_start(ap, fmt);*/
45
46         r = __dlog_vprint(LOG_ID_MAIN, DLOG_DEBUG, "DLOG_TEST", buf, ap );
47         /*      va_end(ap);*/
48
49         if (r<0) {
50                 tet_printf("__dlog_vprint() failed in positive test case");
51                 tet_result(TET_FAIL);
52                 return;
53         }
54         tet_result(TET_PASS);
55 }
56
57 /**
58  * @brief Negative test case of ug_init __dlog_vprint()
59  */
60 void utc_ApplicationFW___dlog_vprint_func_02(void)
61 {
62         int r = 0;
63         char buf[LOG_BUF_SIZE];
64         va_list ap;
65 //      va_start(ap, fmt);
66
67         r = __dlog_vprint(LOG_ID_MAX, DLOG_DEBUG,"DLOG_TEST", fmt, ap );
68 //      va_end(ap);
69
70         if (r>=0) {
71                 tet_printf("__dlog_vprint() failed in negative test case");
72                 tet_result(TET_FAIL);
73                 return;
74         }
75         tet_result(TET_PASS);
76 }