Exemple #1
0
int
main (int argc, char **argv)
{
	test_init (argc, argv, xmlrpc_entries);

	if (!uri) {
		apache_init ();
		uri = default_uri;
	}

	srand (time (NULL));

	session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);

	if (!test_sum ())
		errors++;
	if (!test_countBools ())
		errors++;
	if (!test_md5sum ())
		errors++;
	if (!test_dateChange ())
		errors++;
	if (!test_echo ())
		errors++;
	if (!test_fault_malformed ())
		errors++;
	if (!test_fault_method ())
		errors++;
	if (!test_fault_args ())
		errors++;

	soup_test_session_abort_unref (session);

	test_cleanup ();
	return errors != 0;
}
Exemple #2
0
int main(int argc, char* argv[])
{
	int  ch, n = 1, conn_timeout = 10, rw_timeout = 10;
	acl::string addr("127.0.0.1:6379"), cmd;
	bool slice_req = false;

	while ((ch = getopt(argc, argv, "hs:n:C:I:a:S")) > 0)
	{
		switch (ch)
		{
		case 'h':
			usage(argv[0]);
			return 0;
		case 's':
			addr = optarg;
			break;
		case 'n':
			n = atoi(optarg);
			break;
		case 'C':
			conn_timeout = atoi(optarg);
			break;
		case 'I':
			rw_timeout = atoi(optarg);
			break;
		case 'a':
			cmd = 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);
	acl::redis_connection redis(&client);

	bool ret;

	if (cmd == "auth")
		ret = test_auth(redis);
	else if (cmd == "echo")
		ret = test_echo(redis, n);
	else if (cmd == "ping")
		ret = test_ping(redis, n);
	else if (cmd == "quit")
		ret = test_quit(redis);
	else if (cmd == "select")
		ret = test_select(redis, n);
	else if (cmd == "all")
	{
		ret = test_auth(redis)
			&& test_echo(redis, n)
			&& test_ping(redis, n)
			&& test_select(redis, n)
			&& test_quit(redis);
	}
	else
	{
		printf("unknown cmd: %s\r\n", cmd.c_str());
		ret = false;
	}

	printf("cmd: %s %s\r\n", cmd.c_str(), ret ? "ok" : "failed");

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