示例#1
0
文件: module.c 项目: je-so/js-projekt
int unittest_task_module()
{
   if (test_initfree())    goto ONERR;
   if (test_query())       goto ONERR;
   if (test_generic())     goto ONERR;
   if (test_exec())        goto ONERR;

   return 0;
ONERR:
   return EINVAL;
}
示例#2
0
int main(int argc, char* argv[])
{
	int  ch, conn_timeout = 10, rw_timeout = 10;
	acl::string addr("127.0.0.1:6379");
	bool slice_req = false;

	while ((ch = getopt(argc, argv, "hs:C:I:S")) > 0)
	{
		switch (ch)
		{
		case 'h':
			usage(argv[0]);
			return 0;
		case 's':
			addr = optarg;
			break;
		case 'C':
			conn_timeout = atoi(optarg);
			break;
		case 'I':
			rw_timeout = atoi(optarg);
			break;
		case 'S':
			slice_req = true;
			break;
		default:
			break;
		}
	}

	acl::acl_cpp_init();
	acl::redis_client client(addr.c_str(), conn_timeout, rw_timeout);
	client.set_slice_request(slice_req);
	client.set_slice_respond(false);
	acl::redis_transaction redis(&client);

	bool ret;

	ret = test_multi(redis) && test_run_cmds(redis)
		&& test_exec(redis) && get_results(redis);

	printf("all cmds %s\r\n", ret ? "ok" : "failed");

#ifdef WIN32
	printf("enter any key to exit\r\n");
	getchar();
#endif
	return 0;
}