当前位置: 首页>>代码示例>>C++>>正文


C++ PASS函数代码示例

本文整理汇总了C++中PASS函数的典型用法代码示例。如果您正苦于以下问题:C++ PASS函数的具体用法?C++ PASS怎么用?C++ PASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parg_getopt_long_optarg_missing

TEST parg_getopt_long_optarg_missing(void)
{
	struct parg_state ps;
	char *argv[] = { "app", "--optarg" };
	int li = -1;

	parg_init(&ps);

	ASSERT_EQ('o', parg_getopt_long(&ps, ARRAY_SIZE(argv), argv, ":", po_def, &li));
	ASSERT_EQ(1, li);
	ASSERT_EQ(NULL, ps.optarg);
	ASSERT_EQ(2, ps.optind);

	ASSERT_EQ(-1, parg_getopt_long(&ps, ARRAY_SIZE(argv), argv, ":", po_def, &li));
	ASSERT_EQ(NULL, ps.optarg);
	ASSERT_EQ(2, ps.optind);

	PASS();
}
开发者ID:WS-Libraries,项目名称:parg,代码行数:19,代码来源:test_parg.c

示例2: basic_test_sadd_sunion

TEST basic_test_sadd_sunion(int _commit)
{
	int retval;

	rlite *db = NULL;
	RL_CALL_VERBOSE(setup_db, RL_OK, &db, _commit, 1);
	unsigned char *key = UNSIGN("my key");
	long keylen = strlen((char *)key);
	unsigned char *key2 = UNSIGN("my key2");
	long key2len = strlen((char *)key2);
	unsigned char *datas[2] = {UNSIGN("my data"), UNSIGN("my data2")};
	long dataslen[2] = {strlen((char *)datas[0]), strlen((char *)datas[1]) };
	unsigned char *datas2[3] = {UNSIGN("other data2"), UNSIGN("yet another data"), UNSIGN("my data")};
	long datas2len[3] = {strlen((char *)datas2[0]), strlen((char *)datas2[1]), strlen((char *)datas2[2])};
	unsigned char *keys[2] = {key, key2};
	long keyslen[2] = {keylen, key2len};
	unsigned char **datasunion;
	long *datasunionlen, datasc, i;

	RL_CALL_VERBOSE(rl_sadd, RL_OK, db, key, keylen, 2, datas, dataslen, NULL);
	RL_BALANCED();
	RL_CALL_VERBOSE(rl_sadd, RL_OK, db, key2, key2len, 3, datas2, datas2len, NULL);
	RL_BALANCED();

	RL_CALL_VERBOSE(rl_sunion, RL_OK, db, 2, keys, keyslen, &datasc, &datasunion, &datasunionlen);
	EXPECT_LONG(datasc, 4);

	EXPECT_BYTES(datas[1], dataslen[1], datasunion[0], datasunionlen[0]);
	EXPECT_BYTES(datas[0], dataslen[0], datasunion[1], datasunionlen[1]);
	EXPECT_BYTES(datas2[1], datas2len[1], datasunion[2], datasunionlen[2]);
	EXPECT_BYTES(datas2[0], datas2len[0], datasunion[3], datasunionlen[3]);

	for (i = 0; i < datasc; i++) {
		rl_free(datasunion[i]);
	}
	rl_free(datasunion);
	rl_free(datasunionlen);


	rl_close(db);
	PASS();
}
开发者ID:jqk6,项目名称:rlite,代码行数:42,代码来源:type_set-test.c

示例3: test_build_identity

/*  -----------------------------------------------------------------------------------
 *  Test 6: Q(qr(A)).T * Q(qr(A)) == I 
 *    OK: ||I - Q.T*Q||_1 ~~ n*eps
 */
int test_build_identity(int M, int N, int K, int lb, int verbose)
{
  char *blk = lb > 0 ? "  blk" : "unblk";
  char ct = M == K ? 'M' : 'K';
  armas_x_dense_t A0, C0, tau0, D;
  int ok;
  DTYPE n0;
  armas_conf_t conf = *armas_conf_default();

  armas_x_init(&A0, M, N);
  armas_x_init(&C0, M, M);
  armas_x_init(&tau0, imin(M, N), 1);

  // set source data
  armas_x_set_values(&A0, unitrand, ARMAS_ANY);

  // factorize
  conf.lb = lb;
  armas_x_rqfactor(&A0, &tau0, &conf);

  // compute Q = buildQ(rq(A)), K first columns
  conf.lb = lb;
  if (armas_x_rqbuild(&A0, &tau0, K, &conf) < 0)
    printf("build error: %d\n", conf.error);

  // C0 = Q.T*Q - I
  armas_x_mult(0.0, &C0, 1.0, &A0, &A0, ARMAS_TRANSB, &conf);
  armas_x_diag(&D, &C0, 0);
  armas_x_add(&D, -1.0, &conf);

  n0 = armas_x_mnorm(&C0, ARMAS_NORM_ONE, &conf);

  ok = isOK(n0, N);
  printf("%s: %s Q(rq(A),%c).T * Q(rq(A),%c) == I\n", PASS(ok), blk, ct, ct);
  if (verbose > 0) {
    printf("  || rel error ||_1: %e [%d]\n", n0, ndigits(n0));
  }
  //armas_x_release(&A0);
  armas_x_release(&C0);
  armas_x_release(&tau0);
  return ok;
}
开发者ID:hrautila,项目名称:armas,代码行数:46,代码来源:rqbld.c

示例4: main

int main(int argc, char *argv[])
{
	void *fdt;
	int subnode1_offset, subnode2_offset;
	int subsubnode1_offset, subsubnode2_offset, subsubnode2_offset2;
	int ss12_off, ss21_off;

	test_init(argc, argv);
	fdt = load_blob_arg(argc, argv);

	subnode1_offset = check_subnode(fdt, 0, "[email protected]");
	subnode2_offset = check_subnode(fdt, 0, "[email protected]");

	if (subnode1_offset == subnode2_offset)
		FAIL("Different subnodes have same offset");

	check_property_cell(fdt, subnode1_offset, "prop-int", TEST_VALUE_1);
	check_property_cell(fdt, subnode2_offset, "prop-int", TEST_VALUE_2);

	subsubnode1_offset = check_subnode(fdt, subnode1_offset, "subsubnode");
	subsubnode2_offset = check_subnode(fdt, subnode2_offset, "[email protected]");
	subsubnode2_offset2 = check_subnode(fdt, subnode2_offset, "subsubnode");

	check_property_cell(fdt, subsubnode1_offset, "prop-int", TEST_VALUE_1);
	check_property_cell(fdt, subsubnode2_offset, "prop-int", TEST_VALUE_2);
	check_property_cell(fdt, subsubnode2_offset2, "prop-int", TEST_VALUE_2);

	if (subsubnode2_offset != subsubnode2_offset2)
		FAIL("Different offsets with and without unit address");

	check_subnode(fdt, subnode1_offset, "ss1");
	ss21_off = fdt_subnode_offset(fdt, subnode2_offset, "ss1");
	if (ss21_off != -FDT_ERR_NOTFOUND)
		FAIL("Incorrectly found ss1 in subnode2");

	ss12_off = fdt_subnode_offset(fdt, subnode1_offset, "ss2");
	if (ss12_off != -FDT_ERR_NOTFOUND)
		FAIL("Incorrectly found ss2 in subnode1");
	check_subnode(fdt, subnode2_offset, "ss2");

	PASS();
}
开发者ID:ActionAdam,项目名称:osmc,代码行数:42,代码来源:subnode_offset.c

示例5: test_ascii_is_white_space

bool test_ascii_is_white_space (Test *test)
{
	int i;

	TITLE ();
	for (i = SCHAR_MIN; i <= SCHAR_MAX; i++) {
		if ((char)i == ' ' ||
		    (char)i == '\f' ||
		    (char)i == '\n' ||
		    (char)i == '\r' ||
		    (char)i == '\t' ||
		    (char)i == '\v') {
			CATCH (!ascii_is_white_space ((char)i));
		}
		else {
			CATCH (ascii_is_white_space ((char)i));
		}
	}
	PASS ();
}
开发者ID:jimmy-zhao-tainio,项目名称:project.m,代码行数:20,代码来源:test-ascii.c

示例6: main

int main(int argc, const char* argv[])
{
	// tell dyld we want to know when images are mapped
	dyld_register_image_state_change_handler(dyld_image_state_dependents_mapped, true, batchMappedHandler);
	dyld_register_image_state_change_handler(dyld_image_state_mapped, false, singleMappedHandler);
	dyld_register_image_state_change_handler(dyld_image_state_terminated, false, singleUnmappedHandler);
	// with batch mode we get notified of existing images, but not with single mode, so re-sync counts
	batchMappedCount=0;
	
	loadAndUnLoad();

	loadAndUnLoad();
	
	if ( (singleMappedCount == batchMappedCount) && (singleMappedCount == singleUnMappedCount) )
		PASS("image-state-change");
	else
		FAIL("image-state-change: batch count=%d, single count=%d", batchMappedCount, singleMappedCount);
		
	return EXIT_SUCCESS;
}
开发者ID:Apple-FOSS-Mirror,项目名称:dyld,代码行数:20,代码来源:main.c

示例7: test_file_writer_write_args_invalid_argument_2

bool test_file_writer_write_args_invalid_argument_2 (Test *test)
{
        FileWriter *writer;
        char *path;

        TITLE ();
        CATCH (!(path = directory_current_path ()));
        CATCH (!string_append (&path, "/stage/file_writer/args"));
        if (file_exists (path)) {
                CATCH (!file_remove (path));
        }
        CATCH (!(writer = file_writer_create (path, FileWriterModeTruncate)));
        CATCH (file_writer_write_args (writer, NULL, "test"));
        CATCH (error_count () == 0);
        CATCH (error_at (0).error != ErrorInvalidArgument);
        CATCH (error_at (0).code != 2);
        file_writer_destroy (writer);
        string_destroy (path);
        PASS ();
}
开发者ID:jimmy-zhao-tainio,项目名称:project.m,代码行数:20,代码来源:test-file-writer.c

示例8: test_substr

TEST test_substr(long strsize, long start, long stop, long startindex, long expectedsize)
{
	int retval;
	unsigned char *data = malloc(sizeof(unsigned char) * strsize), *data2;
	rlite *db = NULL;
	RL_CALL_VERBOSE(rl_open, RL_OK, ":memory:", &db, RLITE_OPEN_READWRITE | RLITE_OPEN_CREATE);

	long page, i, size2;
	for (i = 0; i < strsize; i++) {
		data[i] = i % 123;
	}

	RL_CALL_VERBOSE(rl_multi_string_set, RL_OK, db, &page, data, strsize);
	RL_CALL_VERBOSE(rl_multi_string_getrange, RL_OK, db, page, &data2, &size2, start, stop);
	EXPECT_BYTES(&data[startindex], size2, data2, expectedsize);
	rl_free(data2);
	free(data);
	rl_close(db);
	PASS();
}
开发者ID:jqk6,项目名称:rlite,代码行数:20,代码来源:multi_string-test.c

示例9: test_file_remove

bool test_file_remove (Test *test)
{
	char *path;
	FILE *file;

	TITLE ();
	CATCH (file_remove (NULL));
	CATCH (file_remove ("badpathformat"));
	CATCH (!(path = directory_current_path ()));
	CATCH (!string_append (&path, "/stage/remove/file"));
        /* d stage/remove */
	if (!file_exists (path)) {
		CATCH (!(file = fopen (path, "ab+")));
		fclose (file);
	}
	CATCH (!file_remove (path));
	CATCH (file_exists (path));
	string_destroy (path);
	PASS ();
}
开发者ID:jimmy-zhao-tainio,项目名称:project.m,代码行数:20,代码来源:test-file.c

示例10: decoder_poll_should_expand_short_literal

TEST decoder_poll_should_expand_short_literal() {
    uint8_t input[] = {0xb3, 0x5b, 0xed, 0xe0 }; //"foo"
    uint8_t output[4];
    heatshrink_decoder *hsd = heatshrink_decoder_alloc(256, 7, 3);
    uint16_t count = 0;

    HSD_sink_res sres = heatshrink_decoder_sink(hsd, input, sizeof(input), &count);
    ASSERT_EQ(HSDR_SINK_OK, sres);

    uint16_t out_sz = 0;
    HSD_poll_res pres = heatshrink_decoder_poll(hsd, output, 4, &out_sz);
    ASSERT_EQ(HSDR_POLL_EMPTY, pres);
    ASSERT_EQ(3, out_sz);
    ASSERT_EQ('f', output[0]);
    ASSERT_EQ('o', output[1]);
    ASSERT_EQ('o', output[2]);

    heatshrink_decoder_free(hsd);
    PASS();
}
开发者ID:alepharchives,项目名称:heatshrink,代码行数:20,代码来源:test_heatshrink_dynamic.c

示例11: test_big_int_mul_function_call_3

bool test_big_int_mul_function_call_3 (Test *test)
{
        BigInt *a, *b, *to;

        TITLE ();
        CATCH (!(a = big_int_create (10000000000000000000ULL)));
        CATCH (!(b = big_int_create (10000000000000000000ULL)));
        CATCH (!(to = big_int_create (0)));
        memory_commit_limit (memory_commit_size () +
                             sizeof (size_t) + sizeof (BigInt) + sizeof (size_t) + 32 +
                             sizeof (size_t) + sizeof (BigInt) + sizeof (size_t) + 32 +
                             sizeof (size_t) + sizeof (BigInt) + sizeof (size_t) + 32 - 1);
        CATCH (big_int_mul (a, b, to));
        CATCH (error_at (0).error != ErrorFunctionCall);
        CATCH (error_at (0).code != 3);
        big_int_destroy (a);
        big_int_destroy (b);
        big_int_destroy (to);
        PASS ();
}
开发者ID:jimmy-zhao-tainio,项目名称:project.m,代码行数:20,代码来源:test-big-int.c

示例12: parg_reorder_long

TEST parg_reorder_long(void)
{
	char *argv[] = {
		"app", "first", "--reqarg", "--", "foo", "--unknown", "bar",
		"--optarg", "--", "--noarg", "last"
	};
	char *argv_expected[] = {
		"app", "--reqarg", "--", "--unknown", "--optarg", "--",
		"first", "foo", "bar", "--noarg", "last"
	};
	size_t i;

	ASSERT_EQ(6, parg_reorder(ARRAY_SIZE(argv), argv, "", po_def));

	for (i = 0; i < ARRAY_SIZE(argv); ++i) {
		ASSERT_STR_EQ(argv_expected[i], argv[i]);
	}

	PASS();
}
开发者ID:WS-Libraries,项目名称:parg,代码行数:20,代码来源:test_parg.c

示例13: parg_reorder_short

TEST parg_reorder_short(void)
{
	char *argv[] = {
		"app", "first", "-r", "--", "foo", "-u", "bar", "-o", "--",
		"-n", "last"
	};
	char *argv_expected[] = {
		"app", "-r", "--", "-u", "-o", "--", "first", "foo", "bar",
		"-n", "last"
	};
	size_t i;

	ASSERT_EQ(6, parg_reorder(ARRAY_SIZE(argv), argv, os_def, NULL));

	for (i = 0; i < ARRAY_SIZE(argv); ++i) {
		ASSERT_STR_EQ(argv_expected[i], argv[i]);
	}

	PASS();
}
开发者ID:WS-Libraries,项目名称:parg,代码行数:20,代码来源:test_parg.c

示例14: update_float32_decimals

TEST update_float32_decimals()
{
  TM_msg dummy;
  char topic[128] = "float32_decimals";
  float buf = -64.1235;
  dummy.type = TM_float32;
  dummy.buffer = (void *)&buf;
  dummy.size = 1;
  dummy.topic = topic;

  float destination;

  if(!update_f32(&dummy, "float32_decimals",  &destination))
  {
    FAIL();
  }
  ASSERT_EQ_FMT(buf, destination,"%u");

  PASS();
}
开发者ID:Overdrivr,项目名称:Telemetry,代码行数:20,代码来源:update_float_suite.c

示例15: parg_getopt_long_noarg_inline

TEST parg_getopt_long_noarg_inline(void)
{
	struct parg_state ps;
	char *argv[] = { "app", "--noarg=arg" };
	int li = -1;

	parg_init(&ps);

	ASSERT_EQ(':', parg_getopt_long(&ps, ARRAY_SIZE(argv), argv, ":", po_def, &li));
	ASSERT_EQ(0, li);
	ASSERT_EQ(NULL, ps.optarg);
	ASSERT_EQ('n', ps.optopt);
	ASSERT_EQ(2, ps.optind);

	ASSERT_EQ(-1, parg_getopt_long(&ps, ARRAY_SIZE(argv), argv, ":", po_def, &li));
	ASSERT_EQ(NULL, ps.optarg);
	ASSERT_EQ(2, ps.optind);

	PASS();
}
开发者ID:WS-Libraries,项目名称:parg,代码行数:20,代码来源:test_parg.c


注:本文中的PASS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。