summaryrefslogtreecommitdiff
path: root/TC/unit/utc_SensorFW_sf_register_event_func.c
blob: dc7548ea2639ba59a0e4c3518da4f3c0b3b57d86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <tet_api.h>
#include <sensor.h>

int handle = 0;

void my_callback_func(unsigned int event_type, sensor_event_data_t *event , void *data)
{
}


static void startup(void);
static void cleanup(void);

void (*tet_startup)(void) = startup;
void (*tet_cleanup)(void) = cleanup;

static void utc_SensorFW_sf_register_event_func_01(void);
static void utc_SensorFW_sf_register_event_func_02(void);

enum {
	POSITIVE_TC_IDX = 0x01,
	NEGATIVE_TC_IDX,
};

struct tet_testlist tet_testlist[] = {
	{ utc_SensorFW_sf_register_event_func_01, POSITIVE_TC_IDX },
	{ utc_SensorFW_sf_register_event_func_02, NEGATIVE_TC_IDX },
	{ NULL, 0},
};

static void startup(void)
{
	handle = sf_connect(ACCELEROMETER_SENSOR);
	
}

static void cleanup(void)
{
	sf_disconnect(handle);
}

/**
 * @brief Positive test case of sf_register_event()
 */
static void utc_SensorFW_sf_register_event_func_01(void)
{
	int r = 0;


   	r = sf_register_event(handle, ACCELEROMETER_EVENT_ROTATION_CHECK, NULL,  my_callback_func,NULL);

	if (r < 0) {
		tet_infoline("sf_register_event() failed in positive test case");
		tet_result(TET_FAIL);
		return;
	}
	tet_result(TET_PASS);
}

/**
 * @brief Negative test case of ug_init sf_register_event()
 */
static void utc_SensorFW_sf_register_event_func_02(void)
{
	int r = 0;

	r = sf_register_event(400, ACCELEROMETER_EVENT_ROTATION_CHECK, NULL,  my_callback_func,NULL);
	
	if (r > 0) {
		tet_infoline("sf_register_event() failed in negative test case");
		tet_result(TET_FAIL);
		return;
	}
	tet_result(TET_PASS);
}