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


C++ ATF_CHECK函数代码示例

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


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


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