本文整理汇总了C++中TEST_ASSERT_EQUAL_MESSAGE函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_ASSERT_EQUAL_MESSAGE函数的具体用法?C++ TEST_ASSERT_EQUAL_MESSAGE怎么用?C++ TEST_ASSERT_EQUAL_MESSAGE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TEST_ASSERT_EQUAL_MESSAGE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_ofp_set_config_handle_normal_pattern
void
test_ofp_set_config_handle_normal_pattern(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
ret = check_packet_parse(
s_ofp_set_config_request_handle_wrap,
"04 09 00 0c 00 00 00 10"
"00 01 ff e4");
/*
* <---> flags
* <---> miss_send_len
*/
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
"ofp_get_config_request_handle(normal) error.");
}
示例2: meter_destroy
void
meter_destroy(uint64_t dpid, uint32_t meter_id) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
struct ofp_meter_mod mod;
struct ofp_error error;
mod.command = OFPMC_DELETE;
mod.flags = OFPMF_KBPS | OFPMF_BURST;
mod.meter_id = meter_id;
ret = ofp_meter_mod_delete(dpid, &mod, &error);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
"ofp_meter_mod_delete error.");
}
示例3: test_ofp_flow_handle_error_length9
void
test_ofp_flow_handle_error_length9(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
struct ofp_error expected_error;
ofp_error_set(&expected_error, OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
/* invalid body */
ret = check_packet_parse_expect_error(
ofp_multipart_request_handle,
"04 12 00 40 00 00 00 10 00 01 00 00 00 00 00 00 "
"01 00 00 00 00 00 00 02 00 00 00 03 00 00 00 00 "
"00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 05",
&expected_error);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret, "invalid-body error");
}
示例4: test_ofp_group_features_request_handle_error_invalid_length1
void
test_ofp_group_features_request_handle_error_invalid_length1(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
struct ofp_error expected_error;
ofp_error_set(&expected_error, OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
ret = check_packet_parse_expect_error(ofp_multipart_request_handle_wrap,
"04 12 00 10 00 00 00 10"
"00 08 00 00 00 00 00 00"
"00",
&expected_error);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
"invalid-body error.");
}
示例5: test_group_mod_handle_add_invalid_length2
void
test_group_mod_handle_add_invalid_length2(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
struct ofp_error expected_error = {0, 0, {NULL}};
ofp_error_set(&expected_error, OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
/* only header, no data */
/* no type, pad, group_id, buckets */
ret = check_packet_parse_expect_error(
ofp_group_mod_handle_wrap,
"04 0f 00 0a 00 00 00 10 00 00",
&expected_error);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
"invalid body error.");
}
示例6: test_match_basic_IPV4_IP_ECN
void
test_match_basic_IPV4_IP_ECN(void) {
struct lagopus_packet *pkt;
struct port port;
struct flow *flow;
OS_MBUF *m;
bool rv;
/* prepare packet */
pkt = alloc_lagopus_packet();
TEST_ASSERT_NOT_NULL_MESSAGE(pkt, "lagopus_alloc_packet error.");
m = pkt->mbuf;
OS_M_APPEND(m, 64);
/* prepare flow */
flow = calloc(1, sizeof(struct flow) + 10 * sizeof(struct match));
TAILQ_INIT(&flow->match_list);
add_match(&flow->match_list, 2, OFPXMT_OFB_ETH_TYPE << 1,
0x08, 0x00);
refresh_match(flow);
OS_MTOD(m, uint8_t *)[12] = 0x08;
OS_MTOD(m, uint8_t *)[13] = 0x00;
OS_MTOD(m, uint8_t *)[14] = 0x45;
add_match(&flow->match_list, 1, OFPXMT_OFB_IP_ECN << 1,
0x3);
OS_MTOD(m, uint8_t *)[15] = 0xcc;
refresh_match(flow);
lagopus_packet_init(pkt, m, &port);
rv = match_basic(pkt, flow);
TEST_ASSERT_EQUAL_MESSAGE(rv, false,
"IP_ECN mismatch error.");
OS_MTOD(m, uint8_t *)[15] = 0x03;
rv = match_basic(pkt, flow);
TEST_ASSERT_EQUAL_MESSAGE(rv, true,
"IP_ECN match error.");
}
示例7: test_match_basic_IPV6_IP_ECN
void
test_match_basic_IPV6_IP_ECN(void) {
struct lagopus_packet pkt;
struct port port;
struct flow *flow;
OS_MBUF *m;
bool rv;
/* prepare packet */
pkt.in_port = &port;
m = calloc(1, sizeof(*m));
TEST_ASSERT_NOT_NULL_MESSAGE(m, "calloc error.");
m->data = &m->dat[128];
OS_M_PKTLEN(m) = 64;
/* prepare flow */
flow = calloc(1, sizeof(struct flow) + 10 * sizeof(struct match));
TAILQ_INIT(&flow->match_list);
add_match(&flow->match_list, 2, OFPXMT_OFB_ETH_TYPE << 1,
0x86, 0xdd);
m->data[12] = 0x86;
m->data[13] = 0xdd;
add_match(&flow->match_list, 1, OFPXMT_OFB_IP_ECN << 1,
0x03);
m->data[15] = 0x00;
refresh_match(flow);
lagopus_packet_init(&pkt, m);
rv = match_basic(&pkt, flow);
TEST_ASSERT_EQUAL_MESSAGE(rv, false,
"IPV6_IP_ECN mismatch error.");
m->data[15] = 0x30;
lagopus_packet_init(&pkt, m);
rv = match_basic(&pkt, flow);
TEST_ASSERT_EQUAL_MESSAGE(rv, true,
"IPV6_IP_ECN match error.");
}
示例8: test_ofp_queue_get_config_reply_create_null
void
test_ofp_queue_get_config_reply_create_null(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
struct event_manager *em = event_manager_alloc();
struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000",
em, 0x01);
struct pbuf *pbuf = pbuf_alloc(65535);
static struct packet_queue_list packet_queue_list;
struct ofp_header ofp_header;
ret = ofp_queue_get_config_reply_create(NULL, &pbuf, 0,
&packet_queue_list,
&ofp_header);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
"NULL-check error. (channel)");
ret = ofp_queue_get_config_reply_create(channel, NULL, 0,
&packet_queue_list,
&ofp_header);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
"NULL-check error. (pbuf)");
ret = ofp_queue_get_config_reply_create(channel, &pbuf, 0,
NULL, &ofp_header);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
"NULL-check error. (packet_queue_list)");
ret = ofp_queue_get_config_reply_create(channel, &pbuf, 0,
&packet_queue_list,
NULL);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
"NULL-check error. (ofp_header)");
channel_free(channel);
pbuf_free(pbuf);
event_manager_free(em);
}
示例9: check_packet_parse_with_dequeue_expect_error
lagopus_result_t
check_packet_parse_with_dequeue_expect_error(ofp_handler_proc_t handler_proc,
const char packet[],
void **get,
const struct ofp_error *expected_error) {
lagopus_result_t res = LAGOPUS_RESULT_ANY_FAILURES;
struct channel *channel = create_data_channel();
struct ofp_header xid_header;
struct ofp_bridge *ofpb = NULL;
struct pbuf *pbuf;
struct ofp_error error;
struct ofp_bridgeq *bridgeq;
if (get == NULL) {
return LAGOPUS_RESULT_INVALID_ARGS;
}
/* start ofp_handler */
if (s_start_ofp_handler() == false) {
goto done;
}
/* register ofp_bridge */
res = ofp_bridgeq_mgr_bridge_register(channel_dpid_get(channel));
if (res == LAGOPUS_RESULT_OK) {
res = ofp_bridgeq_mgr_bridge_lookup(channel_dpid_get(channel), &bridgeq);
if (res == LAGOPUS_RESULT_OK) {
ofpb = ofp_bridgeq_mgr_bridge_get(bridgeq);
ofp_bridgeq_mgr_bridgeq_free(bridgeq);
} else {
TEST_FAIL_MESSAGE("handler_test_utils.c: "
"ofp_bridgeq_mgr_bridge_get error.");
}
} else {
lagopus_perror(res);
TEST_FAIL_MESSAGE("handler_test_utils.c: register error.");
goto done;
}
/* create packet */
create_packet(packet, &pbuf);
/* parse header */
if (ofp_header_decode_sneak_test(pbuf, &xid_header) != LAGOPUS_RESULT_OK) {
TEST_FAIL_MESSAGE("handler_test_utils.c: cannot decode header\n");
return LAGOPUS_RESULT_OFP_ERROR;
}
/* call func & check */
res = (handler_proc)(channel, pbuf, &xid_header, &error);
if (res == LAGOPUS_RESULT_OK) {
res = lagopus_bbq_get(&ofpb->event_dataq, get, void *, TIMEOUT);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, res,
"handler_test_utils.c: lagopus_bbq_get error.");
} else if (res == LAGOPUS_RESULT_OFP_ERROR) {
示例10: test_ofp_port_mod_handle_invalid_length8
void
test_ofp_port_mod_handle_invalid_length8(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
struct ofp_error expected_error = {0, 0, {NULL}};
/* over size */
ofp_error_set(&expected_error, OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
ret = check_packet_parse_expect_error(
ofp_port_mod_handle_wrap,
"04 10 00 2c 00 00 00 10 00 00 00 01 00 00 00 00 "
"ff ff ff ff ff ff 00 00 00 00 00 24 00 00 00 04 "
"00 00 00 05 00 00 00 00 ff ff ff ff",
&expected_error);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
"invalid body error.");
}
示例11: test_genericDelRedBlackTree_remove_node2_from_tree_with_only_node1_should_throw_ERR_NODE_UNAVAILABLE
/** 2-node case
* remove 2
* root -> 1(b) ---------> Throw ERR_NODE_UNAVAILABLE
*/
void test_genericDelRedBlackTree_remove_node2_from_tree_with_only_node1_should_throw_ERR_NODE_UNAVAILABLE(void)
{
setNode(&node2, NULL, NULL, 'r');
setNode(&node1, NULL, NULL, 'b');
Node *root = &node1;
CEXCEPTION_T err;
Try{
genericDelRedBlackTree(&root, &node2, compareEventInfo);
TEST_FAIL_MESSAGE("Expected ERR_NODE_UNAVAILABLE to be thrown. But receive none");
} Catch(err)
{
TEST_ASSERT_EQUAL_MESSAGE(ERR_NODE_UNAVAILABLE, err, "Expected ERR_NODE_UNAVAILABLE exception");
}
}
示例12: test_group_mod_handle_modify_no_actions
void
test_group_mod_handle_modify_no_actions(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
const char *data[2] = {
/* add */
"04 0f 00 10 00 00 00 10 00 00 00 00 ff ff ff 00",
/* mod */
"04 0f 00 30 00 00 00 10 00 01 00 00 ff ff ff 00 "
"00 10 00 02 00 00 00 03 00 00 00 04 00 00 00 00 "
"00 10 00 06 00 00 00 07 00 00 00 08 00 00 00 00"
};
ret = check_packet_parse_array(ofp_group_mod_handle_wrap, data, 2);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
"modify no_actions error.");
}
示例13: test_set_field_PBB_ISID
void
test_set_field_PBB_ISID(void) {
struct port port;
struct action_list action_list;
struct action *action;
struct ofp_action_set_field *action_set;
struct lagopus_packet pkt;
OS_MBUF *m;
TAILQ_INIT(&action_list);
action = calloc(1, sizeof(*action) + 64);
action_set = (struct ofp_action_set_field *)&action->ofpat;
action_set->type = OFPAT_SET_FIELD;
lagopus_set_action_function(action);
TAILQ_INSERT_TAIL(&action_list, action, entry);
m = calloc(1, sizeof(*m));
TEST_ASSERT_NOT_NULL_MESSAGE(m, "calloc error.");
m->data = &m->dat[128];
OS_M_PKTLEN(m) = 64;
m->data[12] = 0x88;
m->data[13] = 0xe7;
lagopus_set_in_port(&pkt, &port);
lagopus_packet_init(&pkt, m);
set_match(action_set->field, 3, OFPXMT_OFB_PBB_ISID << 1,
0xa5, 0x5a, 0xc3);
execute_action(&pkt, &action_list);
TEST_ASSERT_EQUAL_MESSAGE(m->data[15], 0xa5,
"SET_FIELD PBB_ISID[0] error.");
TEST_ASSERT_EQUAL_MESSAGE(m->data[16], 0x5a,
"SET_FIELD PBB_ISID[1] error.");
TEST_ASSERT_EQUAL_MESSAGE(m->data[17], 0xc3,
"SET_FIELD PBB_ISID[2] error.");
}
示例14: test_group_mod_handle_delete_with_actions
void
test_group_mod_handle_delete_with_actions(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
ret = check_packet_parse(ofp_group_mod_handle_wrap,
"04 0f 00 80 00 00 00 10 00 02 00 00 ff ff ff 00 "
"00 30 00 02 00 00 00 03 00 00 00 04 00 00 00 00 "
"00 00 00 10 00 00 00 0a 03 e8 00 00 00 00 00 00 "
"00 00 00 10 00 00 00 14 07 d0 00 00 00 00 00 00 "
"00 30 00 06 00 00 00 07 00 00 00 08 00 00 00 00 "
"00 00 00 10 00 00 00 0a 03 e8 00 00 00 00 00 00 "
"00 00 00 10 00 00 00 14 07 d0 00 00 00 00 00 00 "
"00 10 00 02 00 00 00 03 00 00 00 04 00 00 00 00");
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
"delete error.");
}
示例15: test_ofp_bridgeq_mgr_bridge_register_orver_length
void
test_ofp_bridgeq_mgr_bridge_register_orver_length(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
int data_num = MAX_BRIDGES;
struct {
uint64_t dpid;
char name[20];
} bridges[MAX_BRIDGES + 1];
datastore_bridge_info_t info = {0};
datastore_bridge_queue_info_t q_info =
{1000LL, 1000LL, 1000LL, 1000LL, 1000LL, 1000LL};
int i;
/* create data. */
for (i = 0; i < data_num + 1; i++) {
bridges[i].dpid = (uint64_t) (i + 1);
snprintf(bridges[i].name, sizeof(bridges[i].name), "test_bridge%d", i);
}
/* register bridge. */
for (i = 0; i < data_num; i++) {
ret = ofp_bridgeq_mgr_bridge_register(bridges[i].dpid,
bridges[i].name,
&info,
&q_info);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
"ofp_bridgeq_mgr_bridge_registererror.");
}
ret = ofp_bridgeq_mgr_bridge_register(bridges[data_num].dpid,
bridges[data_num].name,
&info,
&q_info);
TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_ITERATION_HALTED, ret,
"ofp_bridgeq_mgr_bridge_register(orver length) error.");
}