PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/fbus/service_manager_test.c

http://ftk.googlecode.com/
C | 65 lines | 29 code | 7 blank | 29 comment | 8 complexity | 180ca3d6ce0355edea3de2674b00250e MD5 | raw file
 1/*
 2 * File: 
 3 * Author:  Li XianJing <xianjimli@hotmail.com>
 4 * Brief:   
 5 *
 6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
 7 *
 8 * Licensed under the Academic Free License version 2.1
 9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 */
24
25/*
26 * History:
27 * ================================================================
28 * 2010-07-25 Li XianJing <xianjimli@hotmail.com> created
29 *
30 */
31
32#include "ftk_globals.h"
33#include "ftk_allocator_default.h"
34#include "fbus_service_manager.h"
35
36int main(int argc, char* argv[])
37{
38	int j = 0;
39	int i = 0;
40	int nr = 0;
41	FBusServiceInfo info = {0};
42	FBusServiceManager* thiz = NULL;
43	
44#ifndef USE_STD_MALLOC
45	ftk_set_allocator((ftk_allocator_default_create()));
46#endif
47	
48	for(j = 0; j < 1000; j++)
49	{
50		thiz = fbus_service_manager_create();
51		
52		assert(fbus_service_manager_get_nr(thiz, &nr) == RET_OK);
53		for(i = 0; i < nr; i++)
54		{
55			assert(fbus_service_manager_get(thiz, i, &info) == RET_OK);
56			assert(fbus_service_manager_start(thiz, info.name) == RET_OK);
57			assert(fbus_service_manager_query(thiz,  info.name, &info) == RET_OK);
58			assert(fbus_service_manager_start(thiz, info.name) == RET_OK);
59			assert(fbus_service_manager_stop(thiz, info.name) == RET_OK);
60		}
61		fbus_service_manager_destroy(thiz);
62	}
63
64	return 0;
65}