Beispiel #1
0
static int test_packet_table(hid_t fid)
{

    if( test_create_close(fid) < 0 )
        return -1;

    if( test_open(fid) < 0 )
        return -1;

    /* test_append must be run before test_count and test_read, as it */
    /* creates the packet table they use. */
    if( test_append(fid) < 0 )
        return -1;

    /* These tests will not necessarily cause failures in each other,
           so we don't abort the other tests if one fails. */
    test_read(fid);
    test_get_next(fid);
    test_big_table(fid);
    test_rw_nonnative_dt(fid);
#ifdef VLPT_REMOVED
    test_varlen(fid);
#endif /* VLPT_REMOVED */
    test_opaque(fid);
    test_compress();
    test_error(fid);

    return 0;
}
static int
run_test (int /*unused*/, char* /*unused*/ [])
{
    test_simple_throw ();

    // constructors
    test_size_ctor ();
    test_npos_ctor ();

    test_max_size_ctor1 ();
    test_max_size_ctor2 ();

    test_len_ctor ();

    // member functions
    test_resize ();
    test_reserve ();
    test_at ();
    test_append ();
    test_assign ();

    test_insert1 ();
    test_insert2 ();

    test_erase ();

    test_replace1 ();
    test_replace2 ();
    test_replace3 ();

    test_copy ();
    test_substr ();

    return 0;
}
Beispiel #3
0
int
main()
{
	test_empty_rope();
	test_append();
	test_prepend();
	test_insert();
	test_erase();
	return 0;
}
Beispiel #4
0
int main(int argc, char *argv[])
{
	printf("--- test inode table leaf methods ---\n");
	struct sb *sb = &(struct sb){ .blocksize = 4096 };
	struct btree *btree = &(struct btree){
		.sb = sb,
		.ops = &itable_ops,
		.entries_per_leaf = 64, // !!! should depend on blocksize
	};
	struct ileaf *leaf = ileaf_create(btree);
	struct ileaf *dest = ileaf_create(btree);
	leaf->ibase = to_be_u64(0x10);
	ileaf_dump(btree, leaf);
	test_append(btree, leaf, 0x13, 2, 'a');
	test_append(btree, leaf, 0x14, 4, 'b');
	test_append(btree, leaf, 0x16, 6, 'c');
	ileaf_dump(btree, leaf);
	ileaf_split(btree, 0x10, leaf, dest);
	ileaf_dump(btree, leaf);
	ileaf_dump(btree, dest);
	ileaf_merge(btree, leaf, dest);
	ileaf_dump(btree, leaf);
	test_append(btree, leaf, 0x13, 3, 'x');
	ileaf_dump(btree, leaf);
	test_append(btree, leaf, 0x18, 3, 'y');
	ileaf_dump(btree, leaf);
	test_remove(btree, leaf, 0x16, 5);
	ileaf_dump(btree, leaf);
	unsigned size = 0;
	char *inode = ileaf_lookup(btree, 0x13, leaf, &size);
	hexdump(inode, size);
	for (int i = 0x11; i <= 0x20; i++)
		printf("goal 0x%x => 0x%Lx\n", i, (L)find_empty_inode(btree, leaf, i));
	ileaf_purge(btree, 0x14, leaf);
	ileaf_purge(btree, 0x18, leaf);
	ileaf_check(btree, leaf);
	ileaf_dump(btree, leaf);
	ileaf_destroy(btree, leaf);
	ileaf_destroy(btree, dest);
	exit(0);
}
int main()
{
	test_ensure_empty();
	test_initialise();
	test_ensure_empty();
	test_append();
	test_ensure_empty();
	test_empty();
	test_ensure_empty();
	test_null();
	test_ensure_empty();

	printf("tests passed\n");
	return 0;
}
Beispiel #6
0
int main(int argc, char **argv)
{
	test_null();
	test_num();
	test_bytes();
	test_appendNum();
	test_appendBytes();
	test_toByte();
	test_toByte_4bitpadding();
	test_size();
	test_append();

	report();

	return 0;
}
Beispiel #7
0
int main(int argc, char* argv[]) {
    int errors = 0;

    test_append(&errors);
    test_remove(&errors);
    test_is_empty(&errors);
    test_reverse(&errors);
    test_sort(&errors);

    if (errors == 0)
        printf("All tests passed\n");
    else
        printf("\nTests done with %d error(s)\n", errors);

    return 0;
}
Beispiel #8
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;
}
Beispiel #9
0
/*
 * The main function just calls all unit tests and prints a summary
 * message (success or failure).
 *
 * \return zero on success.
 */
int main (int argc, char ** argv)
{
  int ok = 1;
  if (0 != test_append())
    ok = 0;
  if (0 != test_prepend())
    ok = 0;
  if (0 != test_insert())
    ok = 0;
  if (0 != test_remove())
    ok = 0;
  
  if (ok) {
    printf ("\nall tests PASSED\n");
    return 0;
  }
  printf ("\none or more tests FAILED\n");
  return 1;
}
Beispiel #10
0
int main(int argc, char *argv[])
{
    int error_count;

    error_count = 0;
    printf("\n    testing pod_string\n");
    if (POD_STRING_TYPE != 0x61) {
        error_count++;
        printf("    POD_STRING_TYPE is not the expected value.\n");
        printf("        (expected 0x61, got 0x%x.)\n", POD_STRING_TYPE);
    }
    error_count += test_create_and_destroy();
    error_count += test_copy_string();
    error_count += test_compare_string();
    error_count += test_dup();
    error_count += test_append();

    return error_count;
}
Beispiel #11
0
int main(int argc, char **argv)
{
	bool good = true;

	srand(time(NULL));
	if (argc < 2)
	{
		if (generate_data(RANDOM_SIZE))
			goto exit_no_mem;
	}
	else
	{
		if (read_data(argv[1]))
			goto exit_bad_input;
	}

	good = good && test_init() == 0;
	good = good && test_append() == 0;
	good = good && test_duplicate() == 0;
	good = good && test_links() == 0;
	good = good && test_prepend() == 0;
	good = good && test_links() == 0;
	good = good && test_concat() == 0;
	good = good && test_links() == 0;
	good = good && test_break() == 0;
	good = good && test_links() == 0;
	good = good && test_insert() == 0;
	good = good && test_links() == 0;
	good = good && test_compare() == 0;
	good = good && test_delete() == 0;
	good = good && test_links() == 0;
	good = good && test_clear() == 0;
	good = good && test_free() == 0;

	cleanup_data();

	return good?EXIT_SUCCESS:EXIT_FAILURE;
exit_bad_input:
exit_no_mem:
	cleanup_data();
	return EXIT_FAILURE;
}
Beispiel #12
0
int
main()
{
	/* initialize suite */
	test_suite_setup();
	/* run tests */
	test_simple_set();
	test_long_set();
	test_append();
	test_arith_i32();
	test_arith_i64();
	test_multi_arith();
	test_splice();
	test_set_and_splice();
	test_delete_field();
	test_insert_field();
	test_boundary_args();
	/* clean-up suite */
	test_suite_tear_down();
	return EXIT_SUCCESS;
}
Beispiel #13
0
Datei: test.c Projekt: tmud/libs
int main(int argc, char *argv[]) {
  UNUSED(argc);
  UNUSED(argv);

  remove(ZIPNAME);

  test_write();
  test_append();
  test_read();
  test_extract();
  test_total_entries();
  test_entry_name();
  test_entry_index();
  test_entry_openbyindex();
  test_list_entries();
  test_fwrite();
  test_read_permissions();
  test_write_permissions();
  test_exe_permissions();
  test_mtime();

  remove(ZIPNAME);
  return 0;
}
Beispiel #14
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;
}