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

C++ ATF_CHECK函数代码示例

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

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



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

示例1: check_line

static
void
check_line(int fd, const char *exp)
{
    char *line = atf_utils_readline(fd);
    ATF_CHECK(line != NULL);
    ATF_CHECK_STREQ_MSG(exp, line, "read: '%s', expected: '%s'", line, exp);
    free(line);
}
开发者ID:0mp,项目名称:freebsd,代码行数:9,代码来源:check_test.c


示例2: ATF_TC_BODY

ATF_TC_BODY(isc_aes192, tc) {
	UNUSED(tc);

	aes_testcase_t testcases[] = {
		/* Test 1 (KAT ECBVarTxt192 #3) */
		{
			"000000000000000000000000000000000000000000000000",
			"F0000000000000000000000000000000",
			"2A560364CE529EFC21788779568D5555"
		},
		/* Test 2 (KAT ECBVarTxt192 #123) */
		{
			"000000000000000000000000000000000000000000000000",
			"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0",
			"2AABB999F43693175AF65C6C612C46FB"
		},
		/* Test 3 (KAT ECBVarKey192 #3) */
		{
			"F00000000000000000000000000000000000000000000000",
			"00000000000000000000000000000000",
			"180B09F267C45145DB2F826C2582D35C"
		},
		/* Test 4 (KAT ECBVarKey192 #187) */
		{
			"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0",
			"00000000000000000000000000000000",
			"EACF1E6C4224EFB38900B185AB1DFD42"
		},
		/* Test 5 (KAT ECBGFSbox192 #3) */
		{
			"000000000000000000000000000000000000000000000000",
			"51719783D3185A535BD75ADC65071CE1",
			"4F354592FF7C8847D2D0870CA9481B7C"
		},
		/* Test 6 (KAT ECBKeySbox192 #3) */
		{
			"CD62376D5EBB414917F0C78F05266433DC9192A1EC943300",
			"00000000000000000000000000000000",
			"7F6C25FF41858561BB62F36492E93C29"
		},
		{ NULL, NULL, NULL }
	};

	aes_testcase_t *testcase = testcases;

	while (testcase->key != NULL) {
		len = fromhexstr(testcase->key, key);
		ATF_CHECK_EQ(len, ISC_AES192_KEYLENGTH);
		len = fromhexstr(testcase->input, plaintext);
		ATF_CHECK_EQ(len, ISC_AES_BLOCK_LENGTH);
		isc_aes192_crypt(key, plaintext, ciphertext);
		ATF_CHECK(tohexstr(ciphertext, str) == ISC_R_SUCCESS);
		ATF_CHECK_STREQ(str, testcase->result);

		testcase++;
	}
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:57,代码来源:aes_test.c


示例3: ATF_TC_BODY

ATF_TC_BODY(msgrcv_basic, tc)
{
	struct msg msg1 = { MSG_MTYPE_1, { 'a', 'b', 'c' } };
	struct msg msg2 = { MSG_MTYPE_1, { 'x', 'y', 'z' } };
	int id;

	id = msgget(MSG_KEY, IPC_CREAT | 0600);
	ATF_REQUIRE(id != -1);

	(void)msgsnd(id, &msg1, sizeof(struct msg), IPC_NOWAIT);
	(void)msgrcv(id, &msg2, sizeof(struct msg), MSG_MTYPE_1, IPC_NOWAIT);

	ATF_CHECK(msg1.buf[0] == msg2.buf[0]);
	ATF_CHECK(msg1.buf[1] == msg2.buf[1]);
	ATF_CHECK(msg1.buf[2] == msg2.buf[2]);

	ATF_REQUIRE(msgctl(id, IPC_RMID, 0) == 0);
}
开发者ID:anuragpeshne,项目名称:minix,代码行数:18,代码来源:t_msgrcv.c


示例4: ATF_TC_BODY

ATF_TC_BODY(isc_errno_toresult, tc) {
	isc_result_t result, expect;
	size_t i;

	for (i = 0; i < sizeof(testpair)/sizeof(testpair[0]); i++) {
		result = isc_errno_toresult(testpair[i].err);
		expect = testpair[i].result;
		ATF_CHECK(result == expect);
	}
}
开发者ID:each,项目名称:bind9-collab,代码行数:10,代码来源:errno_test.c


示例5: ATF_TC_BODY

ATF_TC_BODY(cam_open_device_negative_test_O_RDONLY, tc)
{
	const char *cam_test_device;

	cam_test_device = get_cam_test_device(tc);

	cam_clear_error();
	ATF_CHECK(cam_open_device(cam_test_device, O_RDONLY) == NULL);
	ATF_REQUIRE(cam_has_error());
}
开发者ID:mulichao,项目名称:freebsd,代码行数:10,代码来源:libcam_test.c


示例6: ATF_TC_BODY

ATF_TC_BODY(listen_unbound, tc)
{
	int s, r;

	s = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
	ATF_REQUIRE(s > 0);
	r = listen(s, -1);
	/* expect listen to fail since we haven't called bind(2) */
	ATF_CHECK(r != 0);
}
开发者ID:Zer0day,项目名称:freebsd,代码行数:10,代码来源:unix_seqpacket_test.c


示例7: ATF_TC_BODY

ATF_TC_BODY(dispatchset_get, tc) {
	isc_result_t result;
	dns_dispatch_t *d1, *d2, *d3, *d4, *d5;

	UNUSED(tc);

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

	result = make_dispatchset(1);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	d1 = dns_dispatchset_get(dset);
	d2 = dns_dispatchset_get(dset);
	d3 = dns_dispatchset_get(dset);
	d4 = dns_dispatchset_get(dset);
	d5 = dns_dispatchset_get(dset);

	ATF_CHECK_EQ(d1, d2);
	ATF_CHECK_EQ(d2, d3);
	ATF_CHECK_EQ(d3, d4);
	ATF_CHECK_EQ(d4, d5);

	teardown();

	result = make_dispatchset(4);
	ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);

	d1 = dns_dispatchset_get(dset);
	d2 = dns_dispatchset_get(dset);
	d3 = dns_dispatchset_get(dset);
	d4 = dns_dispatchset_get(dset);
	d5 = dns_dispatchset_get(dset);

	ATF_CHECK_EQ(d1, d5);
	ATF_CHECK(d1 != d2);
	ATF_CHECK(d2 != d3);
	ATF_CHECK(d3 != d4);
	ATF_CHECK(d4 != d5);

	teardown();
	dns_test_end();
}
开发者ID:Gradwell,项目名称:bind9,代码行数:43,代码来源:dispatch_test.c


示例8: ATF_TC_BODY

ATF_TC_BODY(memrchr_simple, tc)
{
    char buf[] = "abcdabcd";

    ATF_CHECK(memrchr(buf, 'a', 0) == NULL);
    ATF_CHECK(memrchr(buf, 'g', 0) == NULL);
    ATF_CHECK(memrchr(buf, 'x', 8) == NULL);

    ATF_CHECK(memrchr("\0", 'x', 0) == NULL);
    ATF_CHECK(memrchr("\0", 'x', 1) == NULL);

    ATF_CHECK(memrchr(buf, 'a', 8) == buf + 4);
    ATF_CHECK(memrchr(buf, 'b', 8) == buf + 5);
    ATF_CHECK(memrchr(buf, 'c', 8) == buf + 6);
    ATF_CHECK(memrchr(buf, 'd', 8) == buf + 7);
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:16,代码来源:t_memchr.c


示例9: ATF_TC_BODY

ATF_TC_BODY(uid_hash_rt29851, tc) {

    unsigned char clientid1[] = { 0x0 };
    unsigned char clientid2[] = { 0x0 };
    unsigned char clientid3[] = { 0x0 };

    int clientid1_len = 1;
    int clientid2_len = 1;
    int clientid3_len = 0;

    struct lease *lease1 = 0, *lease2 = 0, *lease3 = 0;

    dhcp_db_objects_setup ();
    dhcp_common_objects_setup ();

    ATF_CHECK(lease_id_new_hash(&lease_uid_hash, LEASE_HASH_SIZE, MDL));

    ATF_CHECK(lease_allocate (&lease1, MDL) == ISC_R_SUCCESS);
    ATF_CHECK(lease_allocate (&lease2, MDL) == ISC_R_SUCCESS);
    ATF_CHECK(lease_allocate (&lease3, MDL) == ISC_R_SUCCESS);

    lease1->uid = clientid1;
    lease2->uid = clientid2;
    lease3->uid = clientid3;

    lease1->uid_len = clientid1_len;
    lease2->uid_len = clientid2_len;
    lease3->uid_len = clientid3_len;

    uid_hash_add(lease1);
    /* uid_hash_delete(lease2); // not necessary for actual issue repro */
    uid_hash_add(lease3);

    /* lease2->uid_len = 0;     // not necessary for actual issue repro */
    /* uid_hash_delete(lease2); // not necessary for actual issue repro */
    /* uid_hash_delete(lease3); // not necessary for actual issue repro */
    uid_hash_delete(lease1);

    /* lease2->uid_len = 1;     // not necessary for actual issue repro */
    uid_hash_add(lease1);
    uid_hash_delete(lease2);
}
开发者ID:HappyDg,项目名称:Network-OS,代码行数:42,代码来源:hash_unittest.c


示例10: ATF_TC_BODY

ATF_TC_BODY(strtod_gherman_bug, tc)
{

	const char *str =
	    "1.8254370818746402660437411213933955878019332885742187";

	errno = 0;
	volatile double d = strtod(str, NULL);

	ATF_CHECK(d == 0x1.d34fd8378ea83p+0);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:11,代码来源:t_strtod.c


示例11: ATF_TC_BODY

ATF_TC_BODY(strncat_simple, tc)
{
	char buf[100] = "abcdefg";

	ATF_CHECK(strncat(buf, "xxx", 0) == buf);
	ATF_CHECK(strcmp(buf, "abcdefg") == 0);
	ATF_CHECK(strncat(buf, "xxx", 1) == buf);
	ATF_CHECK(strcmp(buf, "abcdefgx") == 0);
	ATF_CHECK(strncat(buf, "xxx", 2) == buf);
	ATF_CHECK(strcmp(buf, "abcdefgxxx") == 0);
	ATF_CHECK(strncat(buf, "\0", 1) == buf);
	ATF_CHECK(strcmp(buf, "abcdefgxxx") == 0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:13,代码来源:t_strcat.c


示例12: read_directory

static void
read_directory(const atf_tc_t *tc, const char *mp)
{
	char buf[1024];
	int fd, res;
	ssize_t size;

	FSTEST_ENTER();
	fd = rump_sys_open(".", O_DIRECTORY | O_RDONLY, 0777);
	ATF_REQUIRE(fd != -1);

	size = rump_sys_pread(fd, buf, sizeof(buf), 0);
	ATF_CHECK(size != -1 || errno == EISDIR);
	size = rump_sys_read(fd, buf, sizeof(buf));
	ATF_CHECK(size != -1 || errno == EISDIR);

	res = rump_sys_close(fd);
	ATF_REQUIRE(res != -1);
	FSTEST_EXIT();
}
开发者ID:anuragpeshne,项目名称:minix,代码行数:20,代码来源:t_vnops.c


示例13: ATF_TC_BODY

ATF_TC_BODY (status_coredump, tc)
{
    struct rlimit rl;

    rl.rlim_cur = RLIM_INFINITY;
    rl.rlim_max = RLIM_INFINITY;
    if (setrlimit (RLIMIT_CORE, &rl) == -1)
        atf_tc_skip ("Cannot unlimit the core file size; check limits " "manually");

    const int rawstatus = fork_and_wait_child (child_sigquit);

    atf_process_status_t s;

    RE (atf_process_status_init (&s, rawstatus));
    ATF_CHECK (!atf_process_status_exited (&s));
    ATF_CHECK (atf_process_status_signaled (&s));
    ATF_CHECK_EQ (atf_process_status_termsig (&s), SIGQUIT);
    ATF_CHECK (atf_process_status_coredump (&s));
    atf_process_status_fini (&s);
}
开发者ID:274914765,项目名称:C,代码行数:20,代码来源:process_test.c


示例14: ATF_TC_BODY

ATF_TC_BODY(setrlimit_stack, tc)
{
	struct rlimit res;

	/* Ensure soft limit is not bigger than hard limit */
	res.rlim_cur = res.rlim_max = 4192256;
	ATF_REQUIRE(setrlimit(RLIMIT_STACK, &res) == 0);
	ATF_REQUIRE(getrlimit(RLIMIT_STACK, &res) == 0);
	ATF_CHECK(res.rlim_cur <= res.rlim_max);

}
开发者ID:ryo,项目名称:netbsd-src,代码行数:11,代码来源:t_setrlimit.c


示例15: ATF_TC_BODY

ATF_TC_BODY(types_unsigned, tc)
{
	fsblkcnt_t fb;
	fsfilcnt_t ff;
	size_t size;
	rlim_t lim;
	ino_t ino;

	fb = 0;
	ff = 0;
	ino = 0;
	lim = 0;
	size = 0;

	ATF_CHECK((fb - 1) > 0);
	ATF_CHECK((ff - 1) > 0);
	ATF_CHECK((ino - 1) > 0);
	ATF_CHECK((lim - 1) > 0);
	ATF_CHECK((size - 1) > 0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:20,代码来源:t_types.c


示例16: capture_stream_fini

static void capture_stream_fini (void *v)
{
    struct capture_stream *s = v;

    switch (s->m_base.m_type)
    {
        case stdout_type:
            ATF_CHECK (grep_string (&s->m_msg, "stdout: msg"));
            ATF_CHECK (!grep_string (&s->m_msg, "stderr: msg"));
            break;
        case stderr_type:
            ATF_CHECK (!grep_string (&s->m_msg, "stdout: msg"));
            ATF_CHECK (grep_string (&s->m_msg, "stderr: msg"));
            break;
        default:
            UNREACHABLE;
    }

    atf_dynstr_fini (&s->m_msg);
    atf_process_stream_fini (&s->m_base.m_sb);
}
开发者ID:274914765,项目名称:C,代码行数:21,代码来源:process_test.c


示例17: ATF_TC_BODY

ATF_TC_BODY(setenv_basic, tc)
{
	const size_t numvars = 8192;
	size_t i, offset;
	char name[1024];
	char value[1024];

	offset = lrand48();
	for (i = 0; i < numvars; i++) {
		(void)snprintf(name, sizeof(name), "var%zu",
		    (i * 7 + offset) % numvars);
		(void)snprintf(value, sizeof(value), "value%ld", lrand48());
		ATF_CHECK(setenv(name, value, 1) != -1);
		ATF_CHECK(setenv(name, "foo", 0) != -1);
		ATF_CHECK_STREQ(getenv(name), value);
	}

	offset = lrand48();
	for (i = 0; i < numvars; i++) {
		(void)snprintf(name, sizeof(name), "var%zu",
		    (i * 11 + offset) % numvars);
		ATF_CHECK(unsetenv(name) != -1);
		ATF_CHECK(getenv(name) == NULL);
		ATF_CHECK(unsetenv(name) != -1);
	}

	ATF_CHECK_ERRNO(EINVAL, setenv(NULL, "val", 1) == -1);
	ATF_CHECK_ERRNO(EINVAL, setenv("", "val", 1) == -1);
	ATF_CHECK_ERRNO(EINVAL, setenv("v=r", "val", 1) == -1);
	ATF_CHECK_ERRNO(EINVAL, setenv("var", NULL, 1) == -1);

	ATF_CHECK(setenv("var", "=val", 1) == 0);
	ATF_CHECK_STREQ(getenv("var"), "=val");
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:34,代码来源:t_getenv.c


示例18: ATF_TC_BODY

ATF_TC_BODY(wcscasecmp_same_len_buffers, tc)
{

	ATF_REQUIRE(setlocale(LC_CTYPE, "C") != NULL);

	ATF_CHECK(wcscasecmp(L"abc", L"xyz") < 0);
	ATF_CHECK(wcscasecmp(L"ABC", L"xyz") < 0);
	ATF_CHECK(wcscasecmp(L"abc", L"XYZ") < 0);
	ATF_CHECK(wcscasecmp(L"ABC", L"XYZ") < 0);
	ATF_CHECK(wcscasecmp(L"xyz", L"abc") > 0);
	ATF_CHECK(wcscasecmp(L"XYZ", L"abc") > 0);
	ATF_CHECK(wcscasecmp(L"xyz", L"ABC") > 0);
	ATF_CHECK(wcscasecmp(L"XYZ", L"ABC") > 0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:14,代码来源:wcscasecmp_test.c


示例19: ATF_TC_BODY

ATF_TC_BODY(isc_file_sanitize, tc) {
	isc_result_t result;
	char buf[1024];

	ATF_CHECK(chdir(TESTS) != -1);

	result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK(strcmp(buf, F(NAME)) == 0);

	touch(F(TRUNC_SHA));
	result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK(strcmp(buf, F(TRUNC_SHA)) == 0);

	touch(F(SHA));
	result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK(strcmp(buf, F(SHA)) == 0);

	result = isc_file_sanitize("testdata/file", BAD1, "test", buf, 1024);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK(strcmp(buf, F(BADHASH1)) == 0);

	result = isc_file_sanitize("testdata/file", BAD2, "test", buf, 1024);
	ATF_CHECK_EQ(result, ISC_R_SUCCESS);
	ATF_CHECK(strcmp(buf, F(BADHASH2)) == 0);

	unlink(F(TRUNC_SHA));
	unlink(F(SHA));
}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:31,代码来源:file_test.c


示例20: ATF_TC_BODY

ATF_TC_BODY(ldexp_nan, tc)
{
	const double x = 0.0L / 0.0L;
	double y;
	size_t i;

	ATF_REQUIRE(isnan(x) != 0);

	for (i = 0; i < __arraycount(exps); i++) {
		y = ldexp(x, exps[i]);
		ATF_CHECK(isnan(y) != 0);
	}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:13,代码来源:t_ldexp.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ATF_CHECK_EQ函数代码示例发布时间:2022-05-30
下一篇:
C++ ATE_ON函数代码示例发布时间: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