• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ATF_CHECK_EQ函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testf

static void *
testf(void *dummy)
{
	ATF_CHECK_EQ(var1, 1);
	ATF_CHECK_EQ(var2, 0);
	ATF_CHECK_EQ(var3, &optind);
	ATF_CHECK_EQ(var4, &var4_helper);
	testf_helper(2, 2);
	ATF_CHECK_EQ(var1, 2);
	ATF_CHECK_EQ(var2, 2);
	testf_helper(3, 3);
	ATF_CHECK_EQ(var1, 3);
	ATF_CHECK_EQ(var2, 3);
	ATF_CHECK_EQ(var3, &optind);

	return NULL;
}
开发者ID:2asoft,项目名称:freebsd,代码行数:17,代码来源:t_tls_dlopen.c


示例2: test_reverse

/* reverse: walk database backwards */
static void test_reverse(const atf_tc_t *tc) {
	isc_result_t result;
	dns_db_t *db = NULL;
	dns_dbiterator_t *iter = NULL;
	dns_dbnode_t *node = NULL;
	dns_name_t *name;
	dns_fixedname_t f;
	int i = 0;

	UNUSED(tc);

	dns_fixedname_init(&f);
	name = dns_fixedname_name(&f);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN,
				 atf_tc_get_md_var(tc, "X-filename"));
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_db_createiterator(db, 0, &iter);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	for (result = dns_dbiterator_last(iter);
	     result == ISC_R_SUCCESS;
	     result = dns_dbiterator_prev(iter)) {
		result = dns_dbiterator_current(iter, &node, name);
		if (result == DNS_R_NEWORIGIN)
			result = ISC_R_SUCCESS;
		ATF_CHECK_EQ(result, ISC_R_SUCCESS);
		dns_db_detachnode(db, &node);
		i++;
	}

	ATF_CHECK_EQ(i, 12);

	dns_dbiterator_destroy(&iter);
	dns_db_detach(&db);
	dns_test_end();
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:42,代码来源:dbiterator_test.c


示例3: ATF_TC_BODY

ATF_TC_BODY(emsgsize_nonblocking, tc)
{
	int sv[2];
	const size_t sndbufsize = 8192;
	const size_t rcvbufsize = 8192;
	const size_t pktsize = (sndbufsize + rcvbufsize) * 2;
	char sndbuf[pktsize];
	ssize_t ssize;

	/* setup the socket pair */
	do_socketpair_nonblocking(sv);
	/* Setup the buffers */
	ATF_REQUIRE_EQ(0, setsockopt(sv[0], SOL_SOCKET, SO_SNDBUF, &sndbufsize,
	    sizeof(sndbufsize)));
	ATF_REQUIRE_EQ(0, setsockopt(sv[1], SOL_SOCKET, SO_RCVBUF, &rcvbufsize,
	    sizeof(rcvbufsize)));

	ssize = send(sv[0], sndbuf, pktsize, MSG_EOR);
	ATF_CHECK_EQ(EMSGSIZE, errno);
	ATF_CHECK_EQ(-1, ssize);
}
开发者ID:JabirTech,项目名称:Source,代码行数:21,代码来源:unix_seqpacket_test.c


示例4: wait_and_check_child

static void
wait_and_check_child(const pid_t pid, const char *fail_message)
{
    int status;

    (void)waitpid(pid, &status, 0);

    if (WIFEXITED(status))
        ATF_CHECK_EQ(EXIT_SUCCESS, WEXITSTATUS(status));
    else
        atf_tc_fail("%s; raw exit status was %d", fail_message, status);
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:12,代码来源:t_sigaction.c


示例5: ATF_TC_BODY

ATF_TC_BODY(wcsspn, tc)
{
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L""), 0);
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L"a"), 1);
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L"b"), 0);
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L"ab"), 2);
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L"abc"), 3);
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L"abce"), 3);
	ATF_CHECK_EQ(wcsspn(L"abcdefghijklmnop", L"abcdefghijklmnop"), 16);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:10,代码来源:t_wcsspn.c


示例6: ATF_TC_BODY

ATF_TC_BODY(resize_buffers, tc)
{
	int s;
	int sndbuf = 12345;
	int rcvbuf = 23456;
	int xs, xr;
	socklen_t sl = sizeof(xs);

	s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
	ATF_REQUIRE(s >= 0);

	printf("                       Socket Buffer Sizes\n");
	printf("                              | SNDBUF  | RCVBUF  |\n");
	ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_SNDBUF, &xs, &sl));
	ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_RCVBUF, &xr, &sl));
	printf("Default                       | %7d | %7d |\n", xs, xr);

	if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)) != 0){
		perror("setsockopt");
		atf_tc_fail("setsockopt(SO_SNDBUF) failed");
	}
	ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_SNDBUF, &xs, &sl));
	ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_RCVBUF, &xr, &sl));
	printf("After changing SNDBUF         | %7d | %7d |\n", xs, xr);
	
	if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)) != 0){
		perror("setsockopt");
		atf_tc_fail("setsockopt(SO_RCVBUF) failed");
	}
	ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_SNDBUF, &xs, &sl));
	ATF_CHECK_EQ(0, getsockopt(s, SOL_SOCKET, SO_RCVBUF, &xr, &sl));
	printf("After changing RCVBUF         | %7d | %7d |\n", xs, xr);
}
开发者ID:Zer0day,项目名称:freebsd,代码行数:33,代码来源:unix_seqpacket_test.c


示例7: mk_pair_of_sockets

/* 
 * Returns a pair of sockets made the hard way: bind, listen, connect & accept
 * @return	const char* The path to the socket
 */
const char*
mk_pair_of_sockets(int *sv)
{
	struct sockaddr_un sun;
	/* ATF's isolation mechanisms will guarantee uniqueness of this file */
	const char *path = "sock";
	int s, err, s2, s1;

	s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
	ATF_REQUIRE(s >= 0);

	bzero(&sun, sizeof(sun));
	sun.sun_family = AF_LOCAL;
	sun.sun_len = sizeof(sun);
	strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
	err = bind(s, (struct sockaddr *)&sun, sizeof(sun));
	err = listen(s, -1);
	ATF_CHECK_EQ(0, err);
	ATF_CHECK_EQ(0, err);

	/* Create the other socket */
	s2 = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
	ATF_REQUIRE(s2 >= 0);
	err = connect(s2, (struct sockaddr*)&sun, sizeof(sun));
	if (err != 0) {
		perror("connect");
		atf_tc_fail("connect(2) failed");
	}
	
	/* Accept it */
	s1 = accept(s, NULL, NULL);
	if (s1 == -1) {
		perror("accept");
		atf_tc_fail("accept(2) failed");
	}

	sv[0] = s1;
	sv[1] = s2;
	return (path);
}
开发者ID:Zer0day,项目名称:freebsd,代码行数:44,代码来源:unix_seqpacket_test.c


示例8: ATF_TC_BODY

ATF_TC_BODY (fork_cookie, tc)
{
    atf_process_stream_t outsb, errsb;

    RE (atf_process_stream_init_inherit (&outsb));
    RE (atf_process_stream_init_inherit (&errsb));

    {
        atf_process_child_t child;

        atf_process_status_t status;

        RE (atf_process_fork (&child, child_cookie, &outsb, &errsb, NULL));
        RE (atf_process_child_wait (&child, &status));

        ATF_CHECK (atf_process_status_exited (&status));
        ATF_CHECK_EQ (atf_process_status_exitstatus (&status), exit_v_null);

        atf_process_status_fini (&status);
    }

    {
        atf_process_child_t child;

        atf_process_status_t status;

        int dummy_int;

        RE (atf_process_fork (&child, child_cookie, &outsb, &errsb, &dummy_int));
        RE (atf_process_child_wait (&child, &status));

        ATF_CHECK (atf_process_status_exited (&status));
        ATF_CHECK_EQ (atf_process_status_exitstatus (&status), exit_v_notnull);

        atf_process_status_fini (&status);
    }

    atf_process_stream_fini (&errsb);
    atf_process_stream_fini (&outsb);
}
开发者ID:274914765,项目名称:C,代码行数:40,代码来源:process_test.c


示例9: ATF_TC_BODY

ATF_TC_BODY(pkg_current_state_local, tc)
{
	struct pkg     *package;

	package = gen_pkg(PKG_INSTALLED);
	ATF_REQUIRE(package != NULL);

	pkg_set(package, PKG_OLD_VERSION, "1.2.3");
	ATF_CHECK_EQ(pkgutils_pkg_current_state(package),
	    PK_INFO_ENUM_INSTALLED);

	pkg_free(package);
}
开发者ID:CaptainHayashi,项目名称:pkgng-packagekit,代码行数:13,代码来源:pkgutils_test.c


示例10: ATF_TC_BODY

ATF_TC_BODY(totext, tc) {
	isc_result_t result;
	dns_rdataset_t rdataset;
	dns_rdatalist_t rdatalist;
	isc_buffer_t target;
	unsigned char buf[BIGBUFLEN];

	UNUSED(tc);

	result = dns_test_begin(NULL, ISC_FALSE);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	/* First, test with an empty rdataset */
	rdatalist.rdclass = dns_rdataclass_in;
	rdatalist.type = dns_rdatatype_none;
	rdatalist.covers = dns_rdatatype_none;
	rdatalist.ttl = 0;
	ISC_LIST_INIT(rdatalist.rdata);
	ISC_LINK_INIT(&rdatalist, link);

	dns_rdataset_init(&rdataset);
	result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);

	isc_buffer_init(&target, buf, BIGBUFLEN);
	result = dns_master_rdatasettotext(dns_rootname,
					   &rdataset, &dns_master_style_debug,
					   &target);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK_EQ(isc_buffer_usedlength(&target), 0);

	/*
	 * XXX: We will also need to add tests for dumping various
	 * rdata types, classes, etc, and comparing the results against
	 * known-good output.
	 */

	dns_test_end();
}
开发者ID:JeanCaron,项目名称:bind9,代码行数:39,代码来源:master_test.c


示例11: ATF_TC_BODY

ATF_TC_BODY(wcspbrk, tc)
{
	static const wchar_t s[] = L"abcdefghijklmnop";

	ATF_CHECK_EQ(wcspbrk(s, L""), NULL);
	ATF_CHECK_EQ(wcspbrk(s, L"qrst"), NULL);
	ATF_CHECK_EQ(wcspbrk(s, L"a"), s);
	ATF_CHECK_EQ(wcspbrk(s, L"b"), s + 1);
	ATF_CHECK_EQ(wcspbrk(s, L"ab"), s);
	ATF_CHECK_EQ(wcspbrk(s, L"cdef"), s + 2);
	ATF_CHECK_EQ(wcspbrk(s, L"fedc"), s + 2);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:12,代码来源:t_wcspbrk.c


示例12: ATF_TC_BODY

ATF_TC_BODY(t_crypto_nonce, tc)
{
	unsigned char *x, *y;

	/* Any better ideas how to test that? ... */

	x = saslc__crypto_nonce(1024);
	y = saslc__crypto_nonce(1024);

	ATF_CHECK_EQ(((strncmp(x, y, 1024) == 0) ? 1 : 0), 0);

	free(x);
	free(y);
}
开发者ID:Henauxg,项目名称:minix,代码行数:14,代码来源:t_crypto.c


示例13: ATF_TC_BODY

ATF_TC_BODY(rbt_create, tc) {
	isc_result_t result;
	test_context_t *ctx;
	isc_boolean_t tree_ok;

	UNUSED(tc);

	isc_mem_debugging = ISC_MEM_DEBUGRECORD;

	result = dns_test_begin(NULL, ISC_TRUE);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);

	ctx = test_context_setup();

	check_test_data(ctx->rbt);

	tree_ok = dns__rbt_checkproperties(ctx->rbt);
	ATF_CHECK_EQ(tree_ok, ISC_TRUE);

	test_context_teardown(ctx);

	dns_test_end();
}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:23,代码来源:rbt_test.c


示例14: ATF_TC_BODY

ATF_TC_BODY(check_sdp_get_str, tc)
{
	uint8_t data[] = {
		0x25, 0x04, 0x53, 0x54, // str8(4)	"STR8"
		0x52, 0x38,
		0x00,			// nil
		0x26, 0x00, 0x05, 0x53,	// str16(5)	"STR16"
		0x54, 0x52, 0x31, 0x36,
		0x27, 0x00, 0x00, 0x00,	// str32(5)	"STR32"
		0x05, 0x53, 0x54, 0x52,
		0x33, 0x32,
	};
	sdp_data_t test = { data, data + sizeof(data) };
	sdp_data_t nil;
	char *str;
	size_t len;

	/*
	 * sdp_get_str expects a STR type
	 * advancing test if successful
	 */
	ATF_REQUIRE(sdp_get_str(&test, &str, &len));
	ATF_CHECK(len == 4 && strncmp(str, "STR8", 4) == 0);

	ATF_REQUIRE_EQ(sdp_get_str(&test, &str, &len), false);	/* not str */
	ATF_REQUIRE(sdp_get_data(&test, &nil));			/* (skip) */
	ATF_CHECK_EQ(sdp_data_type(&nil), SDP_DATA_NIL);

	ATF_REQUIRE(sdp_get_str(&test, &str, &len));
	ATF_CHECK(len == 5 && strncmp(str, "STR16", 5) == 0);

	ATF_REQUIRE(sdp_get_str(&test, &str, &len));
	ATF_CHECK(len == 5 && strncmp(str, "STR32", 5) == 0);

	ATF_CHECK_EQ(test.next, test.end);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:36,代码来源:t_sdp_get.c


示例15: tnode_assert

/* Validates the integrity of an AVL tree. */
static inline unsigned int
tnode_assert(const posix_tnode *n)
{
	unsigned int height_left, height_right;
	int balance;

	if (n == NULL)
		return 0;
	height_left = tnode_assert(n->llink);
	height_right = tnode_assert(n->rlink);
	balance = (int)height_left - (int)height_right;
	ATF_CHECK(balance >= -1);
	ATF_CHECK(balance <= 1);
	ATF_CHECK_EQ(balance, n->balance);
	return (height_left > height_right ? height_left : height_right) + 1;
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:17,代码来源:tsearch_test.c


示例16: iteration_test

static void
iteration_test(const char* file, unsigned int expected) {
	isc_result_t result;
	dns_db_t *db = NULL;
	unsigned int iterations;

	result = dns_test_loaddb(&db, dns_dbtype_zone, "test", file);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	result = dns_nsec3_maxiterations(db, NULL, mctx, &iterations);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	ATF_CHECK_EQ(iterations, expected);

	dns_db_detach(&db);
}
开发者ID:crossbuild,项目名称:bind,代码行数:16,代码来源:nsec3_test.c


示例17: test

static void
test(int r)
{
	int did = 0;
	for (size_t i = 0; i < __arraycount(tst); i++) {
		double d = strtod(tst[i].n, NULL);
		int g = (int)rint(d);
		int e = tst[i].v[r];
		ATF_CHECK_EQ(g, e);
		if (g != e) {
			if (!did) {
				fprintf(stderr, "Mode Value Result Expected\n");
				did = 1;
			}
			fprintf(stderr, "%4.4s %-5.5s %6d %8d\n", rnd[r].n,
			    tst[i].n, (int)rint(d), tst[i].v[r]);
		}
	}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:19,代码来源:t_fpsetround.c


示例18: ATF_TC_BODY

ATF_TC_BODY(t_parser_test2, tc)
{
	saslc_t *ctx;
	saslc_sess_t *sess;
	const char *val;

	ATF_REQUIRE(ctx = saslc_alloc());
	ATF_CHECK_EQ(saslc_init(ctx, "test2", NULL), 0);
	ATF_REQUIRE((sess = saslc_sess_init(ctx, "ANONYMOUS", NULL)));
	ATF_REQUIRE(val = saslc_sess_getprop(sess, "TEST"));
	ATF_CHECK_STREQ(val, "one");
	ATF_REQUIRE(val = saslc_sess_getprop(sess, "TEST2"));
	ATF_CHECK_STREQ(val, "one two");
	ATF_REQUIRE(val = saslc_sess_getprop(sess, "TEST3"));
	ATF_CHECK_STREQ(val, "one two three");
	ATF_REQUIRE(val = saslc_sess_getprop(sess, "ID"));
	ATF_CHECK_STREQ(val, "6669");
	saslc_sess_end(sess);
	ATF_REQUIRE_EQ(saslc_end(ctx), 0);
}
开发者ID:Henauxg,项目名称:minix,代码行数:20,代码来源:t_parser.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ATF_REQUIRE函数代码示例发布时间:2022-05-30
下一篇:
C++ ATF_CHECK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap