Initialize Tizen 2.3
[framework/system/deviced.git] / test / testcase / utc_system_deviced_storage.c
1 /*
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4  * PROPRIETARY/CONFIDENTIAL
5  *
6  * This software is the confidential and proprietary information of SAMSUNG
7  * ELECTRONICS ("Confidential Information"). You agree and acknowledge that
8  * this software is owned by Samsung and you shall not disclose such
9  * Confidential Information and shall use it only in accordance with the terms
10  * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG
11  * make no representations or warranties about the suitability of the software,
12  * either express or implied, including but not limited to the implied
13  * warranties of merchantability, fitness for a particular purpose, or
14  * non-infringement. SAMSUNG shall not be liable for any damages suffered by
15  * licensee arising out of or related to this software.
16  *
17  */
18 #include <tet_api.h>
19 #include <dd-storage.h>
20
21 #define API_NAME_STORAGE_GET_PATH "storage_get_path"
22
23 static void startup(void);
24 static void cleanup(void);
25
26 void (*tet_startup)(void) = startup;
27 void (*tet_cleanup)(void) = cleanup;
28
29
30 static void utc_system_deviced_storage_get_path_p_1(void);
31 static void utc_system_deviced_storage_get_path_p_2(void);
32 static void utc_system_deviced_storage_get_path_p_3(void);
33 static void utc_system_deviced_storage_get_path_n_1(void);
34 static void utc_system_deviced_storage_get_path_n_2(void);
35 static void utc_system_deviced_storage_get_path_n_3(void);
36
37 enum {
38         POSITIVE_TC_IDX = 0x01,
39         NEGATIVE_TC_IDX,
40 };
41
42 struct tet_testlist tet_testlist[] = {
43         { utc_system_deviced_storage_get_path_p_1, POSITIVE_TC_IDX },
44         { utc_system_deviced_storage_get_path_p_2, POSITIVE_TC_IDX },
45         { utc_system_deviced_storage_get_path_p_3, POSITIVE_TC_IDX },
46         { utc_system_deviced_storage_get_path_n_1, NEGATIVE_TC_IDX },
47         { utc_system_deviced_storage_get_path_n_2, NEGATIVE_TC_IDX },
48         { utc_system_deviced_storage_get_path_n_3, NEGATIVE_TC_IDX },
49         { NULL, 0 },
50 };
51
52
53 static void startup(void)
54 {
55 }
56
57 static void cleanup(void)
58 {
59 }
60
61 /**
62  * @brief Positive test case of storage_get_path()
63  */
64 static void utc_system_deviced_storage_get_path_p_1(void)
65 {
66         char path[40];
67         int ret;
68
69         ret = storage_get_path(STORAGE_DEFAULT, path, sizeof(path));
70         dts_check_eq(API_NAME_STORAGE_GET_PATH, ret, 0, "Default storage");
71 }
72
73 /**
74  * @brief Positive test case of storage_get_path()
75  */
76 static void utc_system_deviced_storage_get_path_p_2(void)
77 {
78         char path[40];
79         int ret;
80
81         ret = storage_get_path(STORAGE_INTERNAL, path, sizeof(path));
82         dts_check_eq(API_NAME_STORAGE_GET_PATH, ret, 0, "Internal storage");
83 }
84
85 /**
86  * @brief Positive test case of storage_get_path()
87  */
88 static void utc_system_deviced_storage_get_path_p_3(void)
89 {
90         char path[40];
91         int ret;
92
93         ret = storage_get_path(STORAGE_EXTERNAL, path, sizeof(path));
94         dts_check_eq(API_NAME_STORAGE_GET_PATH, ret, 0, "External storage");
95 }
96
97 /**
98  * @brief Negative test case of storage_get_path()
99  */
100 static void utc_system_deviced_storage_get_path_n_1(void)
101 {
102         char path[40];
103         int ret;
104
105         ret = storage_get_path(-1, path, sizeof(path));
106         dts_check_ne(API_NAME_STORAGE_GET_PATH, ret, 0);
107 }
108
109 /**
110  * @brief Negative test case of storage_get_path()
111  */
112 static void utc_system_deviced_storage_get_path_n_2(void)
113 {
114         char path[40];
115         int ret;
116
117         ret = storage_get_path(STORAGE_DEFAULT, NULL, sizeof(path));
118         dts_check_ne(API_NAME_STORAGE_GET_PATH, ret, 0);
119 }
120
121 /**
122  * @brief Negative test case of storage_get_path()
123  */
124 static void utc_system_deviced_storage_get_path_n_3(void)
125 {
126         char path[40];
127         int ret;
128
129         ret = storage_get_path(STORAGE_DEFAULT, path, -1);
130         dts_check_ne(API_NAME_STORAGE_GET_PATH, ret, 0);
131 }