示例#1
0
int
main()
{
  gsl_rng *r = gsl_rng_alloc(gsl_rng_default);

  test_memcpy(10, 10, 0.2, r);
  test_memcpy(10, 15, 0.3, r);
  test_memcpy(53, 213, 0.4, r);
  test_memcpy(920, 2, 0.2, r);
  test_memcpy(2, 920, 0.3, r);

  test_getset(20, 20, 0.3, r);
  test_getset(30, 20, 0.3, r);
  test_getset(15, 210, 0.3, r);

  test_transpose(50, 50, 0.5, r);
  test_transpose(10, 40, 0.3, r);
  test_transpose(40, 10, 0.3, r);
  test_transpose(57, 13, 0.2, r);

  test_ops(20, 20, 0.2, r);
  test_ops(50, 20, 0.3, r);
  test_ops(20, 50, 0.3, r);
  test_ops(76, 43, 0.4, r);

  test_io_ascii(30, 30, 0.3, r);
  test_io_ascii(20, 10, 0.2, r);
  test_io_ascii(10, 20, 0.2, r);
  test_io_ascii(34, 78, 0.3, r);

  test_io_binary(50, 50, 0.3, r);
  test_io_binary(25, 10, 0.2, r);
  test_io_binary(10, 25, 0.2, r);
  test_io_binary(101, 253, 0.3, r);

  gsl_rng_free(r);

  exit (gsl_test_summary());
} /* main() */
示例#2
0
文件: test.c 项目: atantet/gsl
int
main()
{
  gsl_rng *r = gsl_rng_alloc(gsl_rng_default);
  
  test_memcpy(10, 10, r);
  test_memcpy(10, 15, r);
  test_memcpy(53, 213, r);
  test_memcpy(920, 2, r);
  test_memcpy(2, 920, r);

  test_getset(20, 20, r);
  test_getset(30, 20, r);
  test_getset(15, 210, r);

  test_ops(20, 20, r);
  test_ops(50, 20, r);
  test_ops(20, 50, r);
  test_ops(76, 43, r);

  /** Test compresion (spcompress.c) with duplicates and transposition (spswap.c) */
  test_compress(15, 5, 0.2, r);

  /** Test manipulation (spmanip.c)*/
  test_manip(5, 8, 0.2, r);
  
  /** Test tests (spprop.c) */
  test_prop(5, 5, 0.5, 0.5, r);

  /** Test Input/Output */
  //fprintf(stdout, "Testing Input/Output:\nInput matrix (summing duplicate):\n");
  //test_io(stdin, stdout);

  gsl_rng_free(r);

  exit (gsl_test_summary());
} /* main() */
示例#3
0
文件: test.c 项目: FMX/gsl
int
main()
{
  gsl_rng *r = gsl_rng_alloc(gsl_rng_default);

  test_memcpy(10, 10, r);
  test_memcpy(10, 15, r);
  test_memcpy(53, 213, r);
  test_memcpy(920, 2, r);
  test_memcpy(2, 920, r);

  test_getset(20, 20, r);
  test_getset(30, 20, r);
  test_getset(15, 210, r);

  test_ops(20, 20, r);
  test_ops(50, 20, r);
  test_ops(20, 50, r);
  test_ops(76, 43, r);

  gsl_rng_free(r);

  exit (gsl_test_summary());
} /* main() */
示例#4
0
int main(int argc, char* argv[])
{
	int  ch, n = 1, conn_timeout = 10, rw_timeout = 10, ttl = 10;
	acl::string addr("127.0.0.1:6379"), cmd;

	while ((ch = getopt(argc, argv, "hs:n:C:I:a:t:")) > 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 't':
			ttl = atoi(optarg);
			break;
		default:
			break;
		}
	}

	acl::acl_cpp_init();
	acl::log::stdout_open(true);
	acl::redis_client client(addr.c_str(), conn_timeout, rw_timeout);
	acl::redis_string option(&client);

	bool ret;

	if (cmd == "set")
		ret = test_set(option, n);
	else if (cmd == "setex")
		ret = test_setex(option, n, ttl);
	else if (cmd == "setnx")
		ret = test_setnx(option, n);
	else if (cmd == "append")
		ret = test_append(option, n);
	else if (cmd == "get")
		ret = test_get(option, n);
	else if (cmd == "getset")
		ret = test_getset(option, n);
	else if (cmd == "strlen")
		ret = test_strlen(option, n);
	else if (cmd == "mset")
		ret = test_mset(option, n);
	else if (cmd == "mget")
		ret = test_mget(option, n);
	else if (cmd == "msetnx")
		ret = test_msetnx(option, n);
	else if (cmd == "setrange")
		ret = test_setrange(option, n);
	else if (cmd == "getrange")
		ret = test_getrange(option, n);
	else if (cmd == "setbit")
		ret = test_setbit(option, n);
	else if (cmd == "getbit")
		ret = test_getbit(option, n);
	else if (cmd == "bitcount")
		ret = test_bitcount(option, n);
	else if (cmd == "bitop_and")
		ret = test_bitop_and(option, n);
	else if (cmd == "bitop_or")
		ret = test_bitop_or(option, n);
	else if (cmd == "bitop_xor")
		ret = test_bitop_xor(option, n);
	else if (cmd == "incr")
		ret = test_incr(option, n);
	else if (cmd == "incrby")
		ret = test_incrby(option, n);
	else if (cmd == "incrbyfloat")
		ret = test_incrbyfloat(option, n);
	else if (cmd == "decr")
		ret = test_decr(option, n);
	else if (cmd == "decrby")
		ret = test_decrby(option, n);
	else if (cmd == "all")
	{
		ret = test_set(option, n)
			&& test_setex(option, n, ttl)
			&& test_setnx(option, n)
			&& test_append(option, n)
			&& test_get(option, n)
			&& test_getset(option, n)
			&& test_strlen(option, n)
			&& test_mset(option, n)
			&& test_mget(option, n)
			&& test_msetnx(option, n)
			&& test_setrange(option, n)
			&& test_getrange(option, n)
			&& test_setbit(option, n)
			&& test_getbit(option, n)
			&& test_bitcount(option, n)
			&& test_bitop_and(option, n)
			&& test_bitop_or(option, n)
			&& test_bitop_xor(option, n)
			&& test_incr(option, n)
			&& test_incrby(option, n)
			&& test_incrbyfloat(option, n)
			&& test_decr(option, n)
			&& test_decrby(option, n);
	}
	else
	{
		ret = false;
		printf("unknown cmd: %s\r\n", cmd.c_str());
	}

	if (ret == true)
		printf("test OK!\r\n");
	else
		printf("test failed!\r\n");

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