Exemplo n.º 1
0
void
test_get (charT opt, const char *cname, const char *tname)
{
    // test local money format
    test_get (opt, cname, tname, false);

    // test international money format
    test_get (opt, cname, tname, true);
}
Exemplo n.º 2
0
int main(int argc, char **argv) {
  grpc_test_init(argc, argv);
  grpc_iomgr_init();

  test_get(0);
  test_get(1);

  /* test_post(0); */
  /* test_post(1); */

  grpc_iomgr_shutdown();

  return 0;
}
Exemplo n.º 3
0
int do_test_getters(const char *test_parm)
{
	(void)test_parm;

    //SYSCALL(getpagesize);

    //SYSCALL(personality);



    TEST_GET(gettid);
    TEST_GET(getpid);

    TEST_GET(getuid);
    TEST_GET(getuid32);

    TEST_GET(getpgrp);
    TEST_GET(getppid);

    TEST_GET(getegid);
    TEST_GET(getegid32);

    TEST_GET(geteuid);
    TEST_GET(geteuid32);

    TEST_GET(getgid);
    TEST_GET(getgid32);

	test_get( "getpgid", getpgid(getpid()) );


	return 0;
}
Exemplo n.º 4
0
/* the main program... */
int main(int argc,char *argv[])
{
  char *srcdir;
  char fname[100];
  struct sigaction act;
  /* build the name of the file */
  srcdir=getenv("srcdir");
  if (srcdir==NULL)
    srcdir=".";
  snprintf(fname,sizeof(fname),"%s/nslcd-test.conf",srcdir);
  fname[sizeof(fname)-1]='\0';
  /* initialize configuration */
  cfg_init(fname);
  /* partially initialize logging */
  log_setdefaultloglevel(LOG_DEBUG);
  /* ignore SIGPIPE */
  memset(&act,0,sizeof(struct sigaction));
  act.sa_handler=SIG_IGN;
  sigemptyset(&act.sa_mask);
  act.sa_flags=SA_RESTART|SA_NOCLDSTOP;
  assert(sigaction(SIGPIPE,&act,NULL)==0);
  /* do tests */
  test_search();
  test_get();
  test_get_values();
  test_get_rdnvalues();
  test_two_searches();
  test_threads();
  test_connections();
  test_escape();
  return 0;
}
Exemplo n.º 5
0
int main()
{
    int exit_status = EXIT_FAILURE;
    YAAF_Init(NULL);


    if (test_put_remove() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_put_remove() failed\n");
        goto exit;
    }

    if (test_put_remove_put_remove() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_put_remove_put_remove() failed\n");
        goto exit;
    }

    if (test_get() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_get() failed\n");
        goto exit;
    }

    if (test_iter() != YAAF_SUCCESS)
    {
        fprintf(stderr, "test_get() failed\n");
        goto exit;
    }

    exit_status = YAAF_SUCCESS;
exit:
    YAAF_Shutdown();
    return exit_status;
}
Exemplo n.º 6
0
int main() {
    test_get();
	test_set();
	test_write_out();
    
    std::cout << "All tests finished! \n";
    return 0;
}
Exemplo n.º 7
0
void
test_long_double (charT, const char *cname)
{
    if (rw_enabled ("long double"))
        test_get (charT (0 /* long double argument */),
                  cname, "long double");
    else
        rw_note (0, __FILE__, __LINE__, "long double test disabled");
}
Exemplo n.º 8
0
int main(int argc, char **argv) {
  grpc_closure destroyed;
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
  gpr_subprocess *server;
  char *me = argv[0];
  char *lslash = strrchr(me, '/');
  char *args[5];
  int port = grpc_pick_unused_port_or_die();

  GPR_ASSERT(argc <= 2);
  if (argc == 2) {
    args[0] = gpr_strdup(argv[1]);
  } else {
    /* figure out where we are */
    char *root;
    if (lslash) {
      root = gpr_malloc((size_t)(lslash - me + 1));
      memcpy(root, me, (size_t)(lslash - me));
      root[lslash - me] = 0;
    } else {
      root = gpr_strdup(".");
    }
    gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
    gpr_free(root);
  }

  /* start the server */
  args[1] = "--port";
  gpr_asprintf(&args[2], "%d", port);
  args[3] = "--ssl";
  server = gpr_subprocess_create(4, (const char **)args);
  GPR_ASSERT(server);
  gpr_free(args[0]);
  gpr_free(args[2]);

  gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
                               gpr_time_from_seconds(5, GPR_TIMESPAN)));

  grpc_test_init(argc, argv);
  grpc_init();
  grpc_httpcli_context_init(&g_context);
  grpc_pollset_init(&g_pollset);

  test_get(port);
  test_post(port);

  grpc_httpcli_context_destroy(&g_context);
  grpc_closure_init(&destroyed, destroy_pollset, &g_pollset);
  grpc_pollset_shutdown(&exec_ctx, &g_pollset, &destroyed);
  grpc_exec_ctx_finish(&exec_ctx);
  grpc_shutdown();

  gpr_subprocess_destroy(server);

  return 0;
}
Exemplo n.º 9
0
void
test_string (charT, const char *cname)
{
    if (rw_enabled ("basic_string"))
        test_get (charT (1 /* basic_string argument */),
                  cname, "basic_string");
    else
        rw_note (0, __FILE__, __LINE__,
                 "basic_string<%s> test disabled", cname);
}
Exemplo n.º 10
0
int main (int argc, char ** argv)
{
	printf ("🐪 Camel Tests\n");
	printf ("===============\n\n");

	init (argc, argv);

	test_basics ();
	test_get ();

	printf ("\nResults: %d Test%s done — %d error%s.\n", nbTest, nbTest != 1 ? "s" : "", nbError, nbError != 1 ? "s" : "");

	return nbError;
}
Exemplo n.º 11
0
int main (int argc, char *argv[])
{

    plan (31);

    test_put (); // 3
    test_get (); // 8
    test_watch (); // 7
    test_unwatch (); // 2
    test_commit (); // 7
    test_getroot (); // 2
    test_setroot (); // 2

    done_testing();
    return (0);
}
int main() {
    try {
        //auto start = std::chrono::system_clock::now();
        test_get();
        test_post();
        test_put();
        test_delete();
        test_connectfail();
        //auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start);
        //std::cout << elapsed.count() << std::endl;
    } catch (const std::exception& e) {
        std::cout << e.what() << std::endl;
        return 1;
    }
    return 0;
}
Exemplo n.º 13
0
		void test_static_array()
		{
			test_constructor_destructor();
			test_copy_constructor();
			test_move_constructor();
			test_size();
			test_deep_copy();
			test_reconstruct_element();
			test_reconstruct_array();
			test_zero_array();
			test_get();
			test_first_last();
			test_get_range();
			test_internal_array();
			test_range_copy();
		}
Exemplo n.º 14
0
int main()
{
	int choice;

	char *menu[] = {
		"1---get by id.\n",
		"2---del by id.\n",
		"3---add user.\n",
		"4---alter user.\n",
		"0---quit.\n",
		NULL
	};

	show_menu(menu);

	printf("please choice: ");
	scanf("%d", &choice);

	while(1)
	{
		switch(choice)
		{
			case 1:
				test_get();
				break;
			case 2:
				test_del();
				break;
			case 3:
				test_add();
				break;
			case 4:
				test_alter();
				break;
			case 0:
				exit(0);
			default:
				break;
		}
		printf("---------------------------------\n");
		printf("please choice: ");
		scanf("%d", &choice);
	}
	
	return 0;
}
Exemplo n.º 15
0
int
main (int   argc,
      char *argv[])
{
	/* run tests in legacy (pre-session support) mode */
	setenv ("UPSTART_NO_SESSIONS", "1", 1);

	test_add ();
	test_append ();
	test_set ();
	test_lookup ();
	test_get ();
	test_getn ();
	test_all_valid ();
	test_expand ();

	return 0;
}
Exemplo n.º 16
0
int main( int argc, char *argv[] )
{
	struct mem_server server;
	int ret;

	if( argc < 3 )
	{
		fprintf( stderr, "Usage : %s -server_ip -server_port\n", argv[0] );
		return -1;
	}

	mem_set_error_handler( error_handler );

	{
		/* startup the winsock */
		WSADATA wd;
		WSAStartup( MAKEWORD( 2, 0 ), &wd );
	}

	ret = mem_connect( &server, argv[1], atoi( argv[2] ) );
	
	/* test */
	{
		test_stats( &server );
		test_set( &server );
		test_add( &server );
		test_replace( &server );
		/*test_delete( &server, "TestSet" );*/
		test_get( &server );

		test_inc_dec( &server );
	}

	mem_disconnect( &server );
	/* shutdown the winsock */
	WSACleanup();
	return 0;
}
Exemplo n.º 17
0
int main()
{
    int i;

    init();
    test_not_found();
    test_add();
    test_get();
    for (i = 0; i < 5; i++) {
        test_remove();
    }

#ifdef _USE_TIRPC
    test_not_found_6();
    test_add_6();
    test_get_6();
    for (i = 0; i < 5; i++) {
        test_remove_6();
    }
#endif

    return 0;
}
Exemplo n.º 18
0
	virtual void* run()
	{
		bool ret;
		acl::redis cmd;
		cmd.set_cluster(&cluster_, max_conns_);

		for (int i = 0; i < n_; i++)
		{
			if (cmd_ == "set")
				ret = test_set(cmd, i);
			else if (cmd_ == "get")
				ret = test_get(cmd, i);
			else if (cmd_ == "del")
				ret = test_del(cmd, i);
			else if (cmd_ == "expire")
				ret = test_expire(cmd, i);
			else if (cmd_ == "ttl")
				ret = test_ttl(cmd, i);
			else if (cmd_ == "exists")
				ret = test_exists(cmd, i);
			else if (cmd_ == "type")
				ret = test_type(cmd, i);
			else if (cmd_ == "all")
			{
				if (test_set(cmd, i) == false
					|| test_get(cmd, i) == false
					|| test_exists(cmd, i) == false
					|| test_type(cmd, i) == false
					|| test_expire(cmd, i) == false
					|| test_ttl(cmd, i) == false
					|| test_del(cmd, i) == false)
				{
					ret = false;
				}
				else
					ret = true;
			}
			else
			{
				printf("unknown cmd: %s\r\n", cmd_.c_str());
				break;
			}

			if (ret == false)
			{
				printf("cmd: %s error, tid: %lu\r\n",
					cmd_.c_str(), thread_self());
				break;
			}

			if (i > 0 && i % 1000 == 0)
			{
				char tmp[128];
				acl::safe_snprintf(tmp, sizeof(tmp), "%d", i);
				acl::meter_time(__FILE__, __LINE__, tmp);
			}
		}

		locker_.lock();
		__threads_exit++;
		locker_.unlock();

		return NULL;
	}
Exemplo n.º 19
0
int main(void) {
    test_init();
    test_put();
    test_get();
    return 0;
}
Exemplo n.º 20
0
STATIC int
test_mod(test_pars_t *tp, pdu_t *pdu, iscsi_pdu_kind_t kind, int rxtx, int err)
{
	mod_desc_t *mod;
	uint32_t mpoff, off;
	int i, rc = 0, s;

	tp->pdu_count[kind][rxtx]++;
	tp->pdu_count[ANY_PDU][rxtx]++;

	do {
		if ((mod = TAILQ_FIRST(&tp->mods)) == NULL) {
			return check_loss(tp, rxtx);
		}
		if (mod->pars.which_pdu != ANY_PDU &&
		    mod->pars.which_pdu != kind) {
			return check_loss(tp, rxtx);
		}
		mpoff = mod->pars.pdu_offset;

		switch (mod->pars.which_offset) {
		case ABSOLUTE_ANY:
			off = tp->pdu_count[ANY_PDU][CNT_TX] +
				  tp->pdu_count[ANY_PDU][CNT_RX];
			break;
		case RELATIVE_ANY:
			off = (tp->pdu_count[ANY_PDU][CNT_TX] +
				   tp->pdu_count[ANY_PDU][CNT_RX]) -
				(tp->pdu_last[ANY_PDU][CNT_TX] + tp->pdu_last[ANY_PDU][CNT_RX]);
			break;

		case ABSOLUTE_PDUKIND:
			off = tp->pdu_count[kind][rxtx];
			break;
		case RELATIVE_PDUKIND:
			off = tp->pdu_count[kind][rxtx] - tp->pdu_last[kind][rxtx];
			break;

		case ABSOLUTE_TX:
			if (rxtx != CNT_TX)
				return check_loss(tp, rxtx);
			off = tp->pdu_count[ANY_PDU][CNT_TX];
			break;
		case RELATIVE_TX:
			if (rxtx != CNT_TX)
				return check_loss(tp, rxtx);
			off = tp->pdu_count[ANY_PDU][CNT_TX] -
				  tp->pdu_last[ANY_PDU][CNT_TX];
			break;

		case ABSOLUTE_RX:
			if (rxtx != CNT_RX)
				return check_loss(tp, rxtx);
			off = tp->pdu_count[ANY_PDU][CNT_RX];
			break;
		case RELATIVE_RX:
			if (rxtx != CNT_RX)
				return check_loss(tp, rxtx);
			off = tp->pdu_count[ANY_PDU][CNT_RX] -
				  tp->pdu_last[ANY_PDU][CNT_RX];
			break;

		default:
			/* bad offset - skip this entry */
			mpoff = off = 0;
			break;
		}

		DEB(1, ("test_mod: kind=%d, rxtx=%d, pdukind=%d, mpoff=%d, "
				"whichoff=%d, off=%d\n", kind, rxtx, mod->pars.which_pdu,
				mpoff, mod->pars.which_offset, off));

		if (!off || (mpoff != 0 && mpoff < off)) {
			/* This might happen in some cases. Just discard the modification. */
			s = splbio();
			TAILQ_REMOVE(&tp->mods, mod, link);
			splx(s);

			update_options(tp, mod);

			if (mod->pars.options & ISCSITEST_OPT_WAIT_FOR_COMPLETION) {
				mod->pars.status = ISCSI_STATUS_TEST_MODIFICATION_SKIPPED;
				wakeup(mod);
			}
			free(mod, M_TEMP);
		}
	} while (mpoff && mpoff < off);

	if (mpoff > off)
		return check_loss(tp, rxtx);

	DEB(1, ("test_mod: opt=%x, pdu_ptr=%x, num_mods=%d\n", mod->pars.options,
			(int) mod->pdu_ptr, mod->pars.num_pdu_mods));

	if (mod->pdu_ptr)
		test_get(pdu, mod, err);

	if (mod->pars.options & ISCSITEST_OPT_DISCARD_PDU)
		rc = 1;
	else if (check_loss(tp, rxtx))
		rc = 1;
	else if (mod->pars.num_pdu_mods) {
		if (!(mod->pars.options & ISCSITEST_OPT_MOD_PERMANENT)) {
			/*
             * Note: if the PDU is later resent, the unmodified one will be
             * used as resend_pdu restores the original io vector.
             */
			pdu->mod_pdu = pdu->pdu;
			pdu->io_vec[0].iov_base = &pdu->mod_pdu;
		}
		for (i = 0; i < mod->pars.num_pdu_mods; i++) {
			mod_pdu(pdu, &mod->mods[i]);
		}
	}

	if (rxtx == CNT_TX) {
		if (mod->pars.options & ISCSITEST_OPT_NO_RESPONSE_PDU) {
			ccb_t *ccb = pdu->owner;

			DEB(1, ("test_mod: No response expected, completing CCB %x\n",
					(int)ccb));

			if (ccb != NULL &&
				(ccb->disp == CCBDISP_WAIT || ccb->disp == CCBDISP_SCSIPI)) {
				/* simulate timeout */
				wake_ccb(ccb, ISCSI_STATUS_TIMEOUT);
			}
		}

		if ((mod->pars.options & ISCSITEST_SFLAG_UPDATE_FIELDS) &&
			mod->pars.num_pdu_mods) {
			connection_t *conn = pdu->connection;

			if (conn->HeaderDigest &&
				!(mod->pars.options & ISCSITEST_SFLAG_NO_HEADER_DIGEST))
				pdu->pdu.HeaderDigest = gen_digest(&pdu->pdu, BHS_SIZE);

			if (pdu->uio.uio_iovcnt > 1 && conn->DataDigest &&
				!(mod->pars.options & ISCSITEST_SFLAG_NO_DATA_DIGEST))
				pdu->data_digest = gen_digest_2(
						pdu->io_vec[1].iov_base,
						pdu->io_vec[1].iov_len,
						pdu->io_vec[2].iov_base,
						pdu->io_vec[2].iov_len);
		}
	}

	s = splbio();
	TAILQ_REMOVE(&tp->mods, mod, link);
	update_options(tp, mod);
	/* we've modified a PDU - copy current count into last count */
	memcpy(tp->pdu_last, tp->pdu_count, sizeof(tp->pdu_last));
	splx(s);

	if (mod->pars.options & ISCSITEST_OPT_WAIT_FOR_COMPLETION) {
		wakeup(mod);
	}
	if (mod->pars.options & ISCSITEST_KILL_CONNECTION) {
		kill_connection(tp->connection,
				ISCSI_STATUS_TEST_CONNECTION_CLOSED,
				NO_LOGOUT, TRUE);
	}
	free(mod, M_TEMP);

	return rc;
}
Exemplo n.º 21
0
Arquivo: main.c Projeto: Julow/libft
int				main(void)
{
	t_set			set;
	t_test *const	nodes = NEW_N(t_test, TEST_SIZE);

	set = SET(&test_cmp, 0);

	{
		uint32_t		i;
		uint32_t		occur;

		i = 0;
		while (i < TEST_SIZE)
		{
			nodes[i] = TEST(ft_rand(-TEST_SIZE/2, TEST_SIZE/2));
			occur = count_occur(&set, nodes[i].key);
			ft_set_insert(&set, &nodes[i], &nodes[i].key);
			ASSERT(occur == count_occur(&set, nodes[i].key) - 1, "INSERT ERROR");
			i++;
		}
	}

	ASSERT(test_order_count(&set) == TEST_SIZE, "COUNT ERROR");
	test_get(&set);
	test_begin(&set);
	ASSERT(max_height(set.root) <= min_height(set.root) * 2, "BALANCE ERROR");
	TRACE("INSERT OK");

	t_vec2u			range;

	range.x = ft_rand(0, TEST_SIZE / 2);
	range.y = ft_rand(TEST_SIZE / 2, TEST_SIZE);

	{
		uint32_t		i;
		uint32_t		occur;

		i = range.x;
		while (i < range.y)
		{
			occur = count_occur(&set, nodes[i].key);
			ft_set_remove(&set, &nodes[i]);
			ASSERT(occur == count_occur(&set, nodes[i].key) + 1, "REMOVE ERROR");
			i++;
		}
	}

	test_order_count(&set);
	test_get(&set);
	test_begin(&set);
	ASSERT(max_height(set.root) <= min_height(set.root) * 2, "BALANCE ERROR");
	TRACE("REMOVE OK");

	{
		uint32_t		i;

		i = range.y;
		while (--i >= range.x)
		{
			nodes[i].key = range.x;
			ft_set_insert(&set, &nodes[i], &nodes[i].key);
		}
	}

	test_order_count(&set);
	test_get(&set);
	test_begin(&set);
	ASSERT(max_height(set.root) <= min_height(set.root) * 2, "BALANCE ERROR");
	TRACE("INSERT REV SORTED OK");

	{
		uint32_t		i;

		i = 0;
		while (i < TEST_SIZE)
		{
			ft_set_remove(&set, &nodes[0]);
			nodes[0].key = i;
			ft_set_insert(&set, &nodes[0], &nodes[0].key);
			i++;
		}
	}

	test_order_count(&set);
	test_get(&set);
	test_begin(&set);
	ASSERT(max_height(set.root) <= min_height(set.root) * 2, "BALANCE ERROR");
	TRACE("INSERT SORTED OK");

	{

#define DUP_COUNT		100000

		uint32_t		i;
		t_test			*before;
		t_test			*tmp;
		t_test *const	insert = NEW_N(t_test, DUP_COUNT);

		before = ft_set_get(&set, &nodes[ft_rand(0, TEST_SIZE - 1)].key);

		i = 0;
		while (i < DUP_COUNT)
		{
			while ((tmp = ft_set_prev(before)) != NULL && tmp->key == before->key)
				before = tmp;
			insert[i] = TEST(before->key - 1);
			ft_set_insert_before(&set, &insert[i], before);
			tmp = ft_set_prev(before);
			ASSERT(tmp == &insert[i], "INSERT_BEFORE (prev) ERROR");
			tmp = ft_set_next(&insert[i]);
			ASSERT(tmp == before, "INSERT_BEFORE (next) ERROR");
			before = &insert[i];
			i++;
		}

	}

	test_order_count(&set);
	test_get(&set);
	test_begin(&set);
	ASSERT(max_height(set.root) <= min_height(set.root) * 2, "BALANCE ERROR");
	TRACE("INSERT_BEFORE OK");

	// print_tree(set.root);
	// print_iter(&set);

	return (0);
}
Exemplo n.º 22
0
int main() {
    test_get();
    test_post();
    return 0;
}
Exemplo n.º 23
0
int main(int argc, char **argv)
{
	struct bitvec bv;
	uint8_t i = 8, test[i];

	memset(test, 0, i);
	bv.data_len = i;
	bv.data = test;
	bv.cur_bit = 0;

	printf("test shifting...\n");

	bitvec_set_uint(&bv, 0x0E, 7);
	test_shift(&bv, 3);
	test_shift(&bv, 17);
	bitvec_set_uint(&bv, 0, 32);
	bitvec_set_uint(&bv, 0x0A, 7);
	test_shift(&bv, 24);

	printf("checking RL functions...\n");

	bitvec_zero(&bv);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0x000F, 32);
	test_rl(&bv);
	bitvec_shiftl(&bv, 18);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0x0F, 8);
	test_rl(&bv);
	bitvec_zero(&bv);
	bitvec_set_uint(&bv, 0xFF, 8);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0xFE, 7);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0, 17);
	test_rl(&bv);
	bitvec_shiftl(&bv, 18);
	test_rl(&bv);

	printf("probing bit access...\n");

	bitvec_zero(&bv);
	bitvec_set_uint(&bv, 0x3747817, 32);
	bitvec_shiftl(&bv, 10);

	test_get(&bv, 2);
	test_get(&bv, 7);
	test_get(&bv, 9);
	test_get(&bv, 13);
	test_get(&bv, 16);
	test_get(&bv, 42);

	printf("feeling bit fills...\n");

	test_set(&bv, ONE);
	test_fill(&bv, 3, ZERO);
	test_spare(&bv, 38);
	test_spare(&bv, 43);
	test_spare(&bv, 1);
	test_spare(&bv, 7);
	test_fill(&bv, 5, ONE);
	test_fill(&bv, 3, L);

	printf("byte me...\n");

	test_byte_ops();
	test_unhex("48282407a6a074227201000b2b2b2b2b2b2b2b2b2b2b2b");
	test_unhex("47240c00400000000000000079eb2ac9402b2b2b2b2b2b");
	test_unhex("47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b");
	test_unhex("DEADFACE000000000000000000000000000000BEEFFEED");
	test_unhex("FFFFFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB");

	printf("arrr...\n");

	test_array();

	printf("\nbitvec ok.\n");

	return 0;
}
Exemplo n.º 24
0
void
piglit_init(int argc, char **argv)
{
	bool pass = true;
	GLubyte dummy[100];

	glVertexPointer(2, GL_FLOAT, 12, dummy);
	glNormalPointer(GL_FLOAT, 0, dummy);
	glColorPointer(4, GL_UNSIGNED_BYTE, 16, dummy);
	glSecondaryColorPointer(3, GL_SHORT, 32, dummy);
	glTexCoordPointer(3, GL_SHORT, 18, dummy);
	glEdgeFlagPointer(4, dummy);
	glIndexPointer(GL_SHORT, 10, dummy);
	glFogCoordPointer(GL_FLOAT, 8, dummy);

	pass = test_get(GL_VERTEX_ARRAY_SIZE, 2) && pass;
	pass = test_get(GL_VERTEX_ARRAY_TYPE, GL_FLOAT) && pass;
	pass = test_get(GL_VERTEX_ARRAY_STRIDE, 12) && pass;

	pass = test_get(GL_NORMAL_ARRAY_TYPE, GL_FLOAT) && pass;
	pass = test_get(GL_NORMAL_ARRAY_STRIDE, 0) && pass;

	pass = test_get(GL_COLOR_ARRAY_SIZE, 4) && pass;
	pass = test_get(GL_COLOR_ARRAY_TYPE, GL_UNSIGNED_BYTE) && pass;
	pass = test_get(GL_COLOR_ARRAY_STRIDE, 16) && pass;

	pass = test_get(GL_SECONDARY_COLOR_ARRAY_SIZE, 3) && pass;
	pass = test_get(GL_SECONDARY_COLOR_ARRAY_TYPE, GL_SHORT) && pass;
	pass = test_get(GL_SECONDARY_COLOR_ARRAY_STRIDE, 32) && pass;

	pass = test_get(GL_TEXTURE_COORD_ARRAY_SIZE, 3) && pass;
	pass = test_get(GL_TEXTURE_COORD_ARRAY_TYPE, GL_SHORT) && pass;
	pass = test_get(GL_TEXTURE_COORD_ARRAY_STRIDE, 18) && pass;

	pass = test_get(GL_EDGE_FLAG_ARRAY_STRIDE, 4) && pass;

	pass = test_get(GL_INDEX_ARRAY_TYPE, GL_SHORT) && pass;
	pass = test_get(GL_INDEX_ARRAY_STRIDE, 10) && pass;

	pass = test_get(GL_FOG_COORD_ARRAY_TYPE, GL_FLOAT) && pass;
	pass = test_get(GL_FOG_COORD_ARRAY_STRIDE, 8) && pass;

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Exemplo n.º 25
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;
}