patch tizen_2.0_build
[framework/api/haptic.git] / TC / testcase / utc_system_haptic_basic.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 <stdio.h>
19 #include <tet_api.h>
20 #include <haptic.h>
21
22 #define API_NAME_HAPTIC_GET_DEVICE_COUNT "haptic_get_count"
23 #define API_NAME_HAPTIC_INITALIZE "haptic_initialize"
24 #define API_NAME_HAPTIC_DEINITALIZE "haptic_deinitialize"
25
26 static void startup(void);
27 static void cleanup(void);
28
29 void (*tet_startup)(void) = startup;
30 void (*tet_cleanup)(void) = cleanup;
31
32
33 static void utc_haptic_get_count_p(void);
34 static void utc_haptic_initialize_p(void);
35 static void utc_haptic_deinitialize_p(void);
36 static void utc_haptic_deinitialize_n(void);
37
38 enum {
39         POSITIVE_TC_IDX = 0x01,
40         NEGATIVE_TC_IDX,
41 };
42
43 struct tet_testlist tet_testlist[] = {
44     { utc_haptic_get_count_p, POSITIVE_TC_IDX},
45     { utc_haptic_initialize_p, POSITIVE_TC_IDX},
46     { utc_haptic_deinitialize_p, POSITIVE_TC_IDX},
47     { utc_haptic_deinitialize_n, NEGATIVE_TC_IDX},
48         { NULL, 0},
49 };
50
51 static void startup(void)
52 {
53         
54 }
55
56 static void cleanup(void)
57 {
58         /* end of TC */
59 }
60
61 static void utc_haptic_get_count_p(void)
62 {
63     int cnt, err;
64     err = haptic_get_count(&cnt);
65
66     if(err < 0 ){
67         dts_fail(API_NAME_HAPTIC_GET_DEVICE_COUNT);
68     }
69     else{
70         dts_pass(API_NAME_HAPTIC_GET_DEVICE_COUNT);
71     }
72 }
73
74 static void utc_haptic_initialize_p(void)
75 {
76     int err = haptic_initialize();
77     haptic_deinitialize();
78
79     if(err < 0){
80         dts_fail(API_NAME_HAPTIC_INITALIZE);
81     }
82     else{
83         dts_pass(API_NAME_HAPTIC_INITALIZE);
84     }
85 }
86
87 static void utc_haptic_deinitialize_p(void)
88 {
89     int err;
90
91     haptic_initialize();
92     err = haptic_deinitialize();
93
94     if(err < 0){
95         dts_fail(API_NAME_HAPTIC_DEINITALIZE);
96     }
97     else{
98         dts_pass(API_NAME_HAPTIC_DEINITALIZE);
99     }
100 }
101
102 static void utc_haptic_deinitialize_n(void)
103 {
104     int err;
105
106     err = haptic_deinitialize();
107
108     if(err < 0){
109         dts_pass(API_NAME_HAPTIC_DEINITALIZE);
110     }
111     else{
112         dts_fail(API_NAME_HAPTIC_DEINITALIZE);
113     }
114 }