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


C++ CU_ASSERT_EQUAL_FATAL函数代码示例

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


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

示例1: test_packet_output_gre

/*
 * Tests
 */
static void
test_packet_output_gre(void)
{
	odp_packet_t pkt = ODP_PACKET_INVALID;
	odp_event_t ev;
	int res;
	struct ofp_ether_header *eth;
	struct ofp_ip *ip;
	struct ofp_ip *ip_orig;
	struct ofp_greip *greip;

	if (create_odp_packet_ip4(&pkt, test_frame, sizeof(test_frame),
				  tun_p2p)) {
		CU_FAIL("Fail to create packet");
		return;
	}

	/*
	 * Packet's destination is GRE tunnel's p2p address, next hop is GRE
	 * interface. GRE+IP header is prepended. Packet's new destination is
	 * link local. Packet is put into output queue.
	 */
	res = ofp_ip_send(pkt, NULL);
	CU_ASSERT_EQUAL(res, OFP_PKT_PROCESSED);

	res = ofp_send_pending_pkt();
	CU_ASSERT_EQUAL(res, OFP_PKT_PROCESSED);

	ev = odp_queue_deq(dev->outq_def);
	CU_ASSERT_NOT_EQUAL_FATAL(ev, ODP_EVENT_INVALID);

	pkt = odp_packet_from_event(ev);
	CU_ASSERT_EQUAL_FATAL(odp_packet_len(pkt),
			      sizeof(test_frame) + 20 + 4);

	eth = odp_packet_l2_ptr(pkt, NULL);
	if (memcmp(eth->ether_dhost, tun_rem_mac, OFP_ETHER_ADDR_LEN))
		CU_FAIL("Bad destination mac address.");
	if (memcmp(eth->ether_shost, dev->mac, OFP_ETHER_ADDR_LEN))
		CU_FAIL("Bad source mac address.");

	ip = odp_packet_l3_ptr(pkt, NULL);
	CU_ASSERT_EQUAL(ip->ip_src.s_addr, dev_ip);
	CU_ASSERT_EQUAL(ip->ip_dst.s_addr, tun_rem_ip);
	CU_ASSERT_EQUAL(ip->ip_p, OFP_IPPROTO_GRE);

	greip = (struct ofp_greip *)ip;
	CU_ASSERT_EQUAL(greip->gi_g.flags, 0);
	CU_ASSERT_EQUAL(greip->gi_g.ptype,
			odp_cpu_to_be_16(OFP_ETHERTYPE_IP));

	/* inner ip */
	ip = (struct ofp_ip *)(greip + 1);
	ip_orig = (struct ofp_ip *)(&orig_pkt_data[OFP_ETHER_HDR_LEN]);
	if (memcmp(ip, ip_orig, odp_be_to_cpu_16(ip_orig->ip_len)))
		CU_FAIL("Inner IP packet error.");
}
开发者ID:bogdanPricope,项目名称:ofp,代码行数:60,代码来源:ofp_test_packet_output.c

示例2: test_mb_p_iter_create_filtered

/* Test MB_Iterator_CreateFiltered */
void test_mb_p_iter_create_filtered(void) {
    
    int rc;
    MBIt_Board  *board;
    MBIt_Iterator  *iterator;
    filter_params fp;
    
    fp.lb = TEST_FILTER_LB;
    fp.ub = TEST_FILTER_UB;
        
    /* Try invalid mboard */
    mb_f = 99999999;
    rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
    CU_ASSERT_EQUAL(rc, MB_ERR_INVALID);
    CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
    
    /* Try NULL mboard */
    mb_f = MB_NULL_MBOARD;
    rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
    CU_ASSERT_EQUAL(rc, MB_ERR_INVALID);
    CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
    
    /* Populate mboard. Abort on failure */
    rc = init_mb_with_content(&mb_f);
    CU_ASSERT_EQUAL_FATAL(rc, MB_SUCCESS);
    
    /* Try locked board */
    board = (MBIt_Board *)MBI_getMBoardRef(mb_f);
    CU_ASSERT_PTR_NOT_NULL_FATAL(board);
    board->locked = MB_TRUE; 
    rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
    CU_ASSERT_EQUAL(rc, MB_ERR_LOCKED);
    CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
    board->locked = MB_FALSE; 
    
    /* Try on "unreadable" boards */
    board->is_reader = MB_FALSE;
    rc = MB_Iterator_Create(mb_f, &itr_f);
    CU_ASSERT_EQUAL(rc, MB_ERR_DISABLED);
    CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
    board->is_reader = MB_TRUE;
    
    /* Create sorted Iterator */
    itr_f = MB_NULL_ITERATOR;
    rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
    CU_ASSERT_EQUAL(rc, MB_SUCCESS);
    CU_ASSERT_NOT_EQUAL(itr_f, MB_NULL_ITERATOR);
    
    board = (MBIt_Board *)MBI_getMBoardRef(mb_f);
    iterator = (MBIt_Iterator *)MBI_getIteratorRef(itr_f);
    CU_ASSERT_PTR_NOT_NULL_FATAL(board);
    CU_ASSERT_PTR_NOT_NULL_FATAL(iterator);
    CU_ASSERT_EQUAL(board->data->elem_size, iterator->msgsize);
    CU_ASSERT_EQUAL(iterator->iterating, 0);
    CU_ASSERT_PTR_NULL(iterator->cursor);
    CU_ASSERT_EQUAL(iterator->mb, mb_f);
}
开发者ID:somebloke,项目名称:flame-libmboard,代码行数:58,代码来源:test_mb_p_iterator_createfiltered.c

示例3: capability_test

static void capability_test(const struct capability_answer *ca)
{
	qpol_policy_t *q = NULL;
	int policy_type = qpol_policy_open_from_file(ca->policy_name, &q, NULL, NULL, QPOL_POLICY_OPTION_NO_NEVERALLOWS);
	CU_ASSERT_FATAL(policy_type >= 0);
	CU_ASSERT_EQUAL(policy_type, ca->policy_type);

	unsigned policy_version;
	int retval;
	retval = qpol_policy_get_policy_version(q, &policy_version);
	CU_ASSERT_EQUAL_FATAL(retval, 0);
	CU_ASSERT_EQUAL(policy_version, ca->policy_version);

	bool cap;

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_ATTRIB_NAMES);
	CU_ASSERT_EQUAL(cap, ca->has_attributes);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_SYN_RULES);
	CU_ASSERT_EQUAL(cap, ca->has_syn_rules);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_LINE_NUMBERS);
	CU_ASSERT_EQUAL(cap, ca->has_line_numbers);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_CONDITIONALS);
	CU_ASSERT_EQUAL(cap, ca->has_conditionals);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_MLS);
	CU_ASSERT_EQUAL(cap, ca->has_mls);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_POLCAPS);
	CU_ASSERT_EQUAL(cap, ca->has_polcaps);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_SOURCE);
	CU_ASSERT_EQUAL(cap, ca->has_source);

	cap = (bool) qpol_policy_has_capability(q, QPOL_CAP_MODULES);
	CU_ASSERT_EQUAL(cap, ca->has_modules);

	unsigned char ispermissive;
	const qpol_type_t *type;

	if (ca->enforcing_type != NULL) {
		retval = qpol_policy_get_type_by_name(q, ca->enforcing_type, &type);
		CU_ASSERT(retval == 0 && type != NULL);
		retval = qpol_type_get_ispermissive(q, type, &ispermissive);
		CU_ASSERT(retval == 0 && ispermissive == 0);
	}
	if (ca->permissive_type != NULL) {
		retval = qpol_policy_get_type_by_name(q, ca->permissive_type, &type);
		CU_ASSERT(retval == 0 && type != NULL);
		retval = qpol_type_get_ispermissive(q, type, &ispermissive);
		CU_ASSERT(retval == 0 && ispermissive == 1);
	}

	qpol_policy_destroy(&q);
}
开发者ID:0xroot,项目名称:setools3,代码行数:57,代码来源:capabilities-tests.c

示例4: test_topic_init_and_destroy

void test_topic_init_and_destroy() {
    int ret;

    struct topic t;
    struct subscriber sub;

    ret = topic_init(&t);
    CU_ASSERT_EQUAL_FATAL(0, ret);

    // would fail if list of subscribers
    // was not correctly initialized
    ret = list_add(t.subscribers, &sub);
    CU_ASSERT_EQUAL_FATAL(0, ret);

    ret = topic_destroy(&t);
    CU_ASSERT_PTR_NULL_FATAL(t.name);
    CU_ASSERT_PTR_NULL_FATAL(t.subscribers);
}
开发者ID:rethab,项目名称:message-broker,代码行数:18,代码来源:topic-test.c

示例5: test_can_read_ihex_rs_from_file_1

void test_can_read_ihex_rs_from_file_1(void)
{
	ihex_recordset_t* r = ihex_rs_from_file("res/hex1.dat");
	
	CU_ASSERT_PTR_NOT_NULL_FATAL(r);
	CU_ASSERT_EQUAL_FATAL(r->ihrs_count, 6);

	IHEX_ASSERT_REC_EQUAL(&(r->ihrs_records[1]), 0x10, 0x0100, IHEX_DATA, 0x21);
}
开发者ID:acolomb,项目名称:libcintelhex,代码行数:9,代码来源:test_parse.c

示例6: test_add_get

static void
test_add_get(void)
{
    FmtpProdIndex     fileA = 1;
    FmtpProdIndex     fileB;
    int                status;

    status = piq_add(rq, fileA);
    log_flush_error();
    CU_ASSERT_EQUAL_FATAL(status, 0);
    CU_ASSERT_EQUAL(piq_count(rq), 1);

    status = piq_removeNoWait(rq, &fileB);
    log_flush_error();
    CU_ASSERT_EQUAL_FATAL(status, 0);
    CU_ASSERT_EQUAL_FATAL(fileB, fileA);
    CU_ASSERT_EQUAL(piq_count(rq), 0);
}
开发者ID:Unidata,项目名称:LDM,代码行数:18,代码来源:prod_index_queue_test.c

示例7: test_can_read_ihex_rs_from_file_2

void test_can_read_ihex_rs_from_file_2(void)
{
	ihex_recordset_t* r = ihex_rs_from_file("res/big-a.hex");
	
	CU_ASSERT_PTR_NOT_NULL_FATAL(r);
	CU_ASSERT_EQUAL_FATAL(r->ihrs_count, 214);

	IHEX_ASSERT_REC_EQUAL(&(r->ihrs_records[2]), 0x10, 0x0400, IHEX_DATA, 0x0B);
}
开发者ID:acolomb,项目名称:libcintelhex,代码行数:9,代码来源:test_parse.c

示例8: test_add_get

static void
test_add_get(void)
{
    VcmtpProdIndex     fileA = 1;
    VcmtpProdIndex     fileB;
    int                status;

    status = piq_add(rq, fileA);
    log_log(LOG_ERR);
    CU_ASSERT_EQUAL_FATAL(status, 0);
    CU_ASSERT_EQUAL(piq_count(rq), 1);

    status = piq_removeNoWait(rq, &fileB);
    log_log(LOG_ERR);
    CU_ASSERT_EQUAL_FATAL(status, 0);
    CU_ASSERT_EQUAL_FATAL(fileB, fileA);
    CU_ASSERT_EQUAL(piq_count(rq), 0);
}
开发者ID:khallock,项目名称:LDM,代码行数:18,代码来源:prod_index_queue_test.c

示例9: history_messages_count

static void history_messages_count() {
	LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
	LinphoneAddress *jehan_addr = linphone_address_new("<sip:[email protected]>");
	LinphoneChatRoom *chatroom;
	MSList *messages;
	char src_db[256];
	char tmp_db[256];
	snprintf(src_db,sizeof(src_db), "%s/messages.db", liblinphone_tester_file_prefix);
	snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", liblinphone_tester_writable_dir_prefix);

	CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0);

	linphone_core_set_chat_database_path(marie->lc, tmp_db);

	chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr);
	CU_ASSERT_PTR_NOT_NULL(chatroom);
	if (chatroom){
		messages=linphone_chat_room_get_history(chatroom,10);
		CU_ASSERT_EQUAL(ms_list_size(messages), 10);
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);

		messages=linphone_chat_room_get_history(chatroom,1);
		CU_ASSERT_EQUAL(ms_list_size(messages), 1);
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);

		messages=linphone_chat_room_get_history(chatroom,0);
		CU_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270);
		CU_ASSERT_EQUAL(ms_list_size(messages), 1270);
		/*check the second most recent message*/
		CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other.");
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);

		/*test offset+limit: retrieve the 42th latest message only and check its content*/
		messages=linphone_chat_room_get_history_range(chatroom, 42, 42);
		CU_ASSERT_EQUAL(ms_list_size(messages), 1);
		CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities.");
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);

		/*test offset without limit*/
		messages = linphone_chat_room_get_history_range(chatroom, 1265, -1);
		CU_ASSERT_EQUAL(ms_list_size(messages), 1270-1265);
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);

		/*test limit without offset*/
		messages = linphone_chat_room_get_history_range(chatroom, 0, 5);
		CU_ASSERT_EQUAL(ms_list_size(messages), 6);
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);

		/*test invalid start*/
		messages = linphone_chat_room_get_history_range(chatroom, 1265, 1260);
		CU_ASSERT_EQUAL(ms_list_size(messages), 1270-1265);
		ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
	}
	linphone_core_manager_destroy(marie);
	linphone_address_destroy(jehan_addr);
	remove(tmp_db);
}
开发者ID:xiaolds,项目名称:VideoCallVoIP,代码行数:57,代码来源:message_tester.c

示例10: test_add_message_5

void test_add_message_5() {
    int ret;
    struct list topics;
    struct list messages;
    list_init(&topics);
    list_init(&messages);
    // inexistent topic
    ret = topic_add_message(&topics, &messages, "foo", "price: 33");
    CU_ASSERT_EQUAL_FATAL(TOPIC_NOT_FOUND, ret);
}
开发者ID:rethab,项目名称:message-broker,代码行数:10,代码来源:topic-test.c

示例11: test_add_message_1

void test_add_message_1() {
    topic_before_test();
    int ret;
    struct list topics;
    struct list messages;
    struct message *msg;
    struct list *stats;
    struct msg_statistics *msgstats;
    struct subscriber sub1 = {&c1, "hans"};
    list_init(&topics);
    list_init(&messages);

    topic_add_subscriber(&topics, "stocks", &sub1);

    // single message
    ret = topic_add_message(&topics, &messages, "stocks", "price: 33");
    CU_ASSERT_EQUAL_FATAL(0, ret);
    CU_ASSERT_EQUAL_FATAL(1, list_len(&messages));
    msg = message_find_by_content(&messages, "price: 33");
    CU_ASSERT_PTR_NOT_NULL_FATAL(msg);
    CU_ASSERT_STRING_EQUAL_FATAL("stocks", msg->topicname);
    stats = msg->stats;
    CU_ASSERT_EQUAL_FATAL(1, list_len(stats));
    msgstats = stats->root->entry;
    CU_ASSERT_EQUAL_FATAL(0, msgstats->last_fail);
    CU_ASSERT_EQUAL_FATAL(0, msgstats->nattempts);
    CU_ASSERT_EQUAL_FATAL(&sub1, msgstats->subscriber);

    topic_after_test();
}
开发者ID:rethab,项目名称:message-broker,代码行数:30,代码来源:topic-test.c

示例12: test_queue_in

void test_queue_in()
{
    p1 = (Person*)malloc(sizeof(Person));
    char *name1 = (char*)malloc(16);
    strcpy(name1, "tom");
    p1->name = name1;
    p1->age = 22;

    p2 = (Person*)malloc(sizeof(Person));
    char *name2 = (char*)malloc(16);
    strcpy(name2, "jack");
    p2->name = name2;
    p2->age = 23;

    p3 = (Person*)malloc(sizeof(Person));
    char *name3 = (char*)malloc(16);
    strcpy(name3, "jim");
    p3->name = name3;
    p3->age = 24;


    p4 = (Person*)malloc(sizeof(Person));
    char *name4 = (char*)malloc(16);
    strcpy(name4, "fitz");
    p4->name = name4;
    p4->age = 25;

    CU_ASSERT_EQUAL_FATAL(queue_in(&queue, p1), 0);
    CU_ASSERT_EQUAL_FATAL(queue_in(&queue, p2), 0);
    CU_ASSERT_EQUAL_FATAL(queue_in(&queue, p3), 0);
    CU_ASSERT_EQUAL_FATAL(queue_in(&queue, p4), 0);
    CU_ASSERT_EQUAL_FATAL(queue.queue_size, 4);
    CU_ASSERT_EQUAL_FATAL(queue.node_count, 4);
}
开发者ID:wyt0602,项目名称:data_struct,代码行数:34,代码来源:test.c

示例13: __testListen_Accept_After_Connect

void __testListen_Accept_After_Connect()
{
	__init_pcap_record(CU_get_current_test()->pName);
	int err = 0;
	int ret = 0;
	my_context server_socket = __target->open(__target, &err);
	CU_ASSERT_EQUAL_FATAL(err, 0);
	CU_ASSERT_PTR_NOT_NULL_FATAL(server_socket);


	struct sockaddr_in addr;
	socklen_t len = sizeof(addr);
	memset(&addr, 0, len);

	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = htonl(INADDR_ANY);
	addr.sin_port = htons(10000);

	ret = __target->bind(__target, server_socket, (struct sockaddr*)&addr, len, &err);
	CU_ASSERT_EQUAL_FATAL(err, 0);
	CU_ASSERT_TRUE_FATAL(ret);

	ret = __target->listen(__target, server_socket, 3, &err);
	CU_ASSERT_EQUAL_FATAL(err, 0);
	CU_ASSERT_TRUE_FATAL(ret);

	addr.sin_addr.s_addr = inet_addr("10.0.0.100");

	my_context client = __reference->open(__reference, &err);
	CU_ASSERT_EQUAL_FATAL(err, 0);
	CU_ASSERT_PTR_NOT_NULL_FATAL(client);

     //   printf("aaaaaaaaaaaaaaaaaaaaa\n");


	ret = __reference->connect(__reference, client, (struct sockaddr*)&addr, len, &err);
	CU_ASSERT_EQUAL_FATAL(err, 0);
	CU_ASSERT_TRUE_FATAL(ret);

//        printf("aaaaaaaaaaaaaaa\n");

	__flush_packets(100);

	ret = __target->accept(__target, server_socket, &err);
	CU_ASSERT_EQUAL_FATAL(err, 0);
	CU_ASSERT_TRUE_FATAL(ret);

  //      printf("bbbbbbbbbbbbbbbb\n");

	application* clientApp = __find_app(__reference, client);
	CU_ASSERT_EQUAL(clientApp->active_open_calls, 1);

	application* serverApp = __find_app(__target, server_socket);
	CU_ASSERT_EQUAL(serverApp->active_open_calls, 0);
	CU_ASSERT_EQUAL(list_get_count(serverApp->passive_open_calls), 1);


    //    printf("cccccccccccccc\n");
	__pcap_close();
}
开发者ID:ideal8901,项目名称:network-tcp-layer,代码行数:60,代码来源:testlisten.c

示例14: test_socketpair

static void test_socketpair(
        void)
{
    int fds[2];
    int status = socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds);
    CU_ASSERT_EQUAL_FATAL(status, 0);

    pthread_t thread;
    status = pthread_create(&thread, NULL, read_from_fd, fds);
    CU_ASSERT_EQUAL_FATAL(status, 0);
    CU_ASSERT_EQUAL_FATAL(status, 0);

    for (int n = 1; n <= sizeof(buf); n <<= 1) {
        (void)printf("Writing %d bytes\n", n);
        status = write(fds[1], buf, n); // Can't be fsync()ed
        CU_ASSERT_EQUAL_FATAL(status, n);
    }

    /*
     * Closing fds[1] may cause read_from_fd() to return before last record is
     * read because the file-descriptor is no longer valid.
     */
    status = shutdown(fds[0], 0);
    CU_ASSERT_EQUAL_FATAL(status, 0);

    status = pthread_join(thread, NULL);
    CU_ASSERT_EQUAL_FATAL(status, 0);

    close(fds[0]);
    close(fds[1]);
}
开发者ID:Unidata,项目名称:LDM,代码行数:31,代码来源:socketpair_test.c

示例15: test_func_msg_to_table_nmea

static void test_func_msg_to_table_nmea(void)
{
	int rc;
	struct filter_context_t ctx;
	struct property_list_t properties;
	struct message_t msg_in;
	struct message_t msg_out;

	const char SCRIPT[] =
		"function filter(msg_out, msg_in)\n"
		"	local t = msg_to_table(msg_in)\n"
		"   if t == nil then\n"
		"		return FILTER_DISCARD\n"
		"	end\n"
		"	if t.msg_type == MSG_NMEA then\n"
		"		if t.data.nmea.nmea_type == NMEA_RMB then\n"
		"			if t.data.nmea.raw == 'hello world' then\n"
		"				return FILTER_SUCCESS\n"
		"			end\n"
		"		end\n"
		"	end\n"
		"	return FILTER_FAILURE\n"
		"end\n"
		"\n"
		;

	memset(&msg_in, 0, sizeof(msg_in));
	memset(&msg_out, 0, sizeof(msg_out));

	CU_ASSERT_PTR_NOT_NULL(filter);
	CU_ASSERT_PTR_NOT_NULL(filter->init);
	CU_ASSERT_PTR_NOT_NULL(filter->func);
	CU_ASSERT_PTR_NOT_NULL(filter->exit);

	proplist_init(&properties);
	proplist_set(&properties, "script", tmpfilename);

	prepare_script(SCRIPT);

	rc = filter->init(&ctx, &properties);
	CU_ASSERT_EQUAL_FATAL(rc, EXIT_SUCCESS);

	msg_in.type = MSG_NMEA;
	msg_in.data.attr.nmea.type = NMEA_RMB;
	strncpy(msg_in.data.attr.nmea.raw, "hello world", sizeof(msg_in.data.attr.nmea.raw));

	rc = filter->func(&msg_out, &msg_in, &ctx, &properties);
	CU_ASSERT_EQUAL(rc, FILTER_SUCCESS);

	CU_ASSERT_EQUAL(filter->exit(&ctx), EXIT_SUCCESS);
	proplist_free(&properties);
}
开发者ID:mariokonrad,项目名称:navd,代码行数:52,代码来源:test_filter_lua.c


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