本文整理汇总了C++中BC_ASSERT_PTR_NOT_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ BC_ASSERT_PTR_NOT_NULL函数的具体用法?C++ BC_ASSERT_PTR_NOT_NULL怎么用?C++ BC_ASSERT_PTR_NOT_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BC_ASSERT_PTR_NOT_NULL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: carddav_sync_4
static void carddav_sync_4(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:[email protected]\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneCardDavContext *c = NULL;
linphone_friend_list_set_uri(lfl, CARDDAV_SERVER);
linphone_core_add_friend_list(manager->lc, lfl);
linphone_friend_list_unref(lfl);
c = linphone_carddav_context_new(lfl);
BC_ASSERT_PTR_NOT_NULL(c);
linphone_carddav_set_user_data(c, stats);
linphone_carddav_set_synchronization_done_callback(c, carddav_sync_done);
linphone_carddav_set_new_contact_callback(c, carddav_new_contact);
linphone_carddav_set_removed_contact_callback(c, carddav_removed_contact);
linphone_carddav_set_updated_contact_callback(c, carddav_updated_contact);
BC_ASSERT_PTR_NULL(linphone_vcard_get_uid(lvc));
linphone_carddav_put_vcard(c, lf);
BC_ASSERT_PTR_NOT_NULL(linphone_vcard_get_uid(lvc));
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
linphone_carddav_delete_vcard(c, lf);
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 2, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 2, int, "%i");
linphone_friend_unref(lf);
ms_free(stats);
linphone_carddav_context_destroy(c);
linphone_core_manager_destroy(manager);
}
示例2: test_file_path
static void test_file_path(void) {
belle_generic_uri_t* source_uri = belle_generic_uri_parse("/index.html");
char* source_uri_raw = belle_sip_object_to_string(source_uri);
belle_generic_uri_t* first_uri = belle_generic_uri_parse(source_uri_raw);
belle_generic_uri_t* uri=BELLE_GENERIC_URI(belle_sip_object_clone(BELLE_SIP_OBJECT(first_uri)));
belle_sip_free(source_uri_raw);
belle_sip_object_unref(source_uri);
belle_sip_object_unref(first_uri);
BC_ASSERT_PTR_NULL(belle_generic_uri_get_scheme(uri));
BC_ASSERT_PTR_NULL(belle_generic_uri_get_host(uri));
BC_ASSERT_STRING_EQUAL(belle_generic_uri_get_path(uri),"/index.html");
belle_sip_object_unref(uri);
source_uri = belle_generic_uri_parse("file:///tmp/absolute-file");
BC_ASSERT_PTR_NOT_NULL(source_uri);
if (source_uri!=NULL){
BC_ASSERT_STRING_EQUAL(belle_generic_uri_get_scheme(source_uri),"file");
BC_ASSERT_PTR_NULL(belle_generic_uri_get_host(source_uri));
BC_ASSERT_STRING_EQUAL(belle_generic_uri_get_path(source_uri),"/tmp/absolute-file");
belle_sip_object_unref(source_uri);
}
/*this is INVALID*/
source_uri = belle_generic_uri_parse("file://./relative-file");
BC_ASSERT_PTR_NOT_NULL(source_uri);
/* PATH segment always start by / */
source_uri = belle_generic_uri_parse("./relative-file");
BC_ASSERT_PTR_NULL(source_uri);
if (source_uri!=NULL){
belle_sip_object_unref(source_uri);
}
}
示例3: subscribe_test_declined
static void subscribe_test_declined(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneContent* content;
LinphoneEvent *lev;
const LinphoneErrorInfo *ei;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml");
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
pauline->decline_subscribe=TRUE;
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,content);
linphone_event_ref(lev);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/
ei=linphone_event_get_error_info(lev);
BC_ASSERT_PTR_NOT_NULL(ei);
if (ei){
BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei));
}
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
linphone_content_unref(content);
linphone_event_unref(lev);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
示例4: play_file
static void play_file(const char *filepath, bool_t unsupported_format, bool_t seeking_test, bool_t play_twice) {
bool_t succeed;
Eof eof;
MSMediaPlayer *file_player = NULL;
MSSndCard *snd_card = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
const char *display_name = video_stream_get_default_video_renderer();
int duration, timeout;
const int seek_time = 6100;
const double timeout_prec = 0.05;
eof_init(&eof);
BC_ASSERT_PTR_NOT_NULL(snd_card);
file_player = ms_media_player_new(snd_card, display_name, 0);
BC_ASSERT_PTR_NOT_NULL(file_player);
if(file_player == NULL) return;
BC_ASSERT_EQUAL(ms_media_player_get_state(file_player), MSPlayerClosed, int, "%d");
ms_media_player_set_eof_callback(file_player, eof_callback, &eof);
succeed = ms_media_player_open(file_player, filepath);
if(unsupported_format) {
BC_ASSERT_FALSE(succeed);
BC_ASSERT_EQUAL(ms_media_player_get_state(file_player), MSPlayerClosed, int, "%d");
} else {
示例5: test_filterdesc_enable_disable_base
static void test_filterdesc_enable_disable_base(const char* mime, const char* filtername,bool_t is_enc) {
MSFilter *filter;
MSFactory *factory = NULL;
factory = ms_factory_new_with_voip();
if (is_enc)
filter = ms_factory_create_encoder(factory,mime);
else
filter = ms_factory_create_decoder(factory,mime);
BC_ASSERT_PTR_NOT_NULL(filter);
ms_filter_destroy(filter);
BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(factory,filtername,FALSE));
BC_ASSERT_FALSE(ms_factory_filter_from_name_enabled(factory,filtername));
if (is_enc)
filter = ms_factory_create_encoder(factory,mime);
else
filter = ms_factory_create_decoder(factory,mime);
BC_ASSERT_PTR_NULL(filter);
BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(factory,filtername,TRUE));
BC_ASSERT_TRUE(ms_factory_filter_from_name_enabled(factory,filtername));
if (is_enc)
filter = ms_factory_create_encoder(factory,mime);
else
filter = ms_factory_create_decoder(factory,mime);
BC_ASSERT_PTR_NOT_NULL(filter);
ms_filter_destroy(filter);
ms_factory_destroy(factory);
}
示例6: test_filterdesc_enable_disable_base
static void test_filterdesc_enable_disable_base(const char* mime, const char* filtername,bool_t is_enc) {
MSFilter *filter;
ms_init();
if (is_enc)
filter = ms_filter_create_encoder(mime);
else
filter = ms_filter_create_decoder(mime);
BC_ASSERT_PTR_NOT_NULL(filter);
ms_filter_destroy(filter);
BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,FALSE));
BC_ASSERT_FALSE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername));
if (is_enc)
filter = ms_filter_create_encoder(mime);
else
filter = ms_filter_create_decoder(mime);
BC_ASSERT_PTR_NULL(filter);
BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,TRUE));
BC_ASSERT_TRUE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername));
if (is_enc)
filter = ms_filter_create_encoder(mime);
else
filter = ms_filter_create_decoder(mime);
BC_ASSERT_PTR_NOT_NULL(filter);
ms_filter_destroy(filter);
ms_exit();
}
示例7: ipv6_aaaa_query
/* Successful IPv6 AAAA query */
static void ipv6_aaaa_query(void) {
struct addrinfo *ai;
int timeout;
endpoint_t *client;
if (!belle_sip_tester_ipv6_available()){
belle_sip_warning("Test skipped, IPv6 connectivity not available.");
return;
}
client = create_endpoint();
if (!BC_ASSERT_PTR_NOT_NULL(client)) return;
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV6_SIP_DOMAIN, SIP_PORT, AF_INET6, a_resolve_done, client);
BC_ASSERT_PTR_NOT_NULL(client->resolver_ctx);
BC_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
BC_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
if (client->ai_list) {
struct addrinfo *next;
struct sockaddr_in6 *sock_in6 = (struct sockaddr_in6 *)client->ai_list->ai_addr;
int ntohsi = ntohs(sock_in6->sin6_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
/*the IPv6 address shall return first, and must be a real ipv6 address*/
BC_ASSERT_EQUAL(client->ai_list->ai_family,AF_INET6,int,"%d");
BC_ASSERT_FALSE(IN6_IS_ADDR_V4MAPPED(&sock_in6->sin6_addr));
ai = bctbx_ip_address_to_addrinfo(AF_INET6, SOCK_STREAM, IPV6_SIP_IP, SIP_PORT);
BC_ASSERT_PTR_NOT_NULL(ai);
if (ai) {
struct in6_addr *ipv6_address = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
int i;
for (i = 0; i < 8; i++) {
BC_ASSERT_EQUAL(sock_in6->sin6_addr.s6_addr[i], ipv6_address->s6_addr[i], int, "%d");
}
bctbx_freeaddrinfo(ai);
}
next=client->ai_list->ai_next;
BC_ASSERT_PTR_NOT_NULL(next);
if (next){
int ntohsi = ntohs(sock_in6->sin6_port);
sock_in6 = (struct sockaddr_in6 *)next->ai_addr;
BC_ASSERT_EQUAL(next->ai_family,AF_INET6,int,"%d");
BC_ASSERT_TRUE(IN6_IS_ADDR_V4MAPPED(&sock_in6->sin6_addr));
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET6, SOCK_STREAM, IPV6_SIP_IPV4, SIP_PORT);
BC_ASSERT_PTR_NOT_NULL(ai);
if (ai) {
struct in6_addr *ipv6_address = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
int i;
for (i = 0; i < 8; i++) {
BC_ASSERT_EQUAL(sock_in6->sin6_addr.s6_addr[i], ipv6_address->s6_addr[i], int, "%d");
}
bctbx_freeaddrinfo(ai);
}
}
}
destroy_endpoint(client);
}
示例8: chat_room_test
static void chat_room_test(void) {
LinphoneCoreVTable v_table;
LinphoneCore* lc;
memset (&v_table,0,sizeof(v_table));
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
if (!BC_ASSERT_PTR_NOT_NULL(lc)) return;
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room_from_uri(lc,"sip:[email protected]"));
linphone_core_destroy(lc);
}
示例9: on_report_send_with_rtcp_xr_remote
void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content){
char * body = (char*)linphone_content_get_buffer(content);
reporting_session_report_t * report = call->log->reporting.reports[stream_type];
on_report_send_mandatory(call,stream_type,content);
if (report->remote_metrics.rtcp_sr_count+report->remote_metrics.rtcp_xr_count>0){
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteMetrics:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
on_report_send_verify_metrics(&report->remote_metrics,body);
}
}
示例10: linphone_interpret_url_test
static void linphone_interpret_url_test(void)
{
LinphoneCoreVTable v_table;
LinphoneCore* lc;
const char* sips_address = "sips:[email protected]";
LinphoneAddress* address;
LinphoneProxyConfig *proxy_config;
char *tmp;
memset ( &v_table,0,sizeof ( v_table ) );
lc = linphone_core_new ( &v_table,NULL,NULL,NULL );
BC_ASSERT_PTR_NOT_NULL_FATAL ( lc );
proxy_config =linphone_core_create_proxy_config(lc);
linphone_proxy_config_set_identity(proxy_config, "sip:[email protected]");
linphone_proxy_config_enable_register(proxy_config, FALSE);
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org");
linphone_core_add_proxy_config(lc, proxy_config);
linphone_core_set_default_proxy_config(lc,proxy_config);
linphone_proxy_config_unref(proxy_config);
address = linphone_core_interpret_url(lc, sips_address);
BC_ASSERT_PTR_NOT_NULL_FATAL(address);
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips");
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux");
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org");
linphone_address_destroy(address);
address = linphone_core_interpret_url(lc,"23");
BC_ASSERT_PTR_NOT_NULL(address);
BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip");
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "23");
BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org");
linphone_address_destroy(address);
address = linphone_core_interpret_url(lc,"#24");
BC_ASSERT_PTR_NOT_NULL(address);
BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip");
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24");
BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org");
tmp = linphone_address_as_string(address);
BC_ASSERT_TRUE(strcmp (tmp,"sip:%[email protected]") == 0);
linphone_address_destroy(address);
address = linphone_core_interpret_url(lc,tmp);
BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip");
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24");
BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org");
linphone_address_destroy(address);
ms_free(tmp);
linphone_core_destroy (lc);
}
示例11: ipv4_a_query_no_result
/* Successful IPv4 A query with no result */
static void ipv4_a_query_no_result(void) {
int timeout;
endpoint_t *client = create_endpoint();
if (!BC_ASSERT_PTR_NOT_NULL(client)) return;
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_BAD_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
BC_ASSERT_PTR_NOT_NULL(client->resolver_ctx);
BC_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
BC_ASSERT_PTR_EQUAL(client->ai_list, NULL);
destroy_endpoint(client);
}
示例12: ipv4_a_query_timeout
/* IPv4 A query timeout */
static void ipv4_a_query_timeout(void) {
endpoint_t *client = create_endpoint();
if (!BC_ASSERT_PTR_NOT_NULL(client)) return;
belle_sip_stack_set_dns_timeout(client->stack, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, "toto.com", SIP_PORT, AF_INET, a_resolve_done, client);
BC_ASSERT_PTR_NOT_NULL(client->resolver_ctx);
BC_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, 2000));
BC_ASSERT_PTR_EQUAL(client->ai_list, NULL);
BC_ASSERT_EQUAL(client->resolve_ko,1, int, "%d");
destroy_endpoint(client);
}
示例13: srv_query
/* Successful SRV query */
static void srv_query(void) {
int timeout;
endpoint_t *client = create_endpoint();
if (!BC_ASSERT_PTR_NOT_NULL(client)) return;
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_ctx = belle_sip_stack_resolve_srv(client->stack, "udp", SRV_DOMAIN, srv_resolve_done, client);
BC_ASSERT_PTR_NOT_NULL(client->resolver_ctx);
BC_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
BC_ASSERT_PTR_NOT_NULL(client->srv_list);
BC_ASSERT_NOT_EQUAL(belle_sip_list_size(client->srv_list), 0,int,"%d");
if (client->srv_list && (belle_sip_list_size(client->srv_list) > 0)) {
belle_sip_dns_srv_t *result_srv = belle_sip_list_nth_data(client->srv_list, 0);
BC_ASSERT_EQUAL(belle_sip_dns_srv_get_port(result_srv), SIP_PORT, int, "%d");
}
示例14: on_report_send_verify_metrics
char * on_report_send_verify_metrics(const reporting_content_metrics_t *metrics, char * body){
if (metrics->rtcp_xr_count){
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "JitterBuffer:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:"));
}
if (metrics->rtcp_sr_count+metrics->rtcp_xr_count>0){
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:"));
}
if (metrics->rtcp_xr_count){
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:"));
}
return body;
}
示例15: check_file
static time_t check_file(LinphoneCoreManager* mgr) {
time_t cur_time = get_current_time();
char* filepath = linphone_core_compress_log_collection();
time_t log_time = -1;
uint32_t timediff = 0;
FILE *file = NULL;
BC_ASSERT_PTR_NOT_NULL(filepath);
if (filepath != NULL) {
int line_count = 0;
char *line = NULL;
size_t line_size = 256;
#ifndef _WIN32
struct tm tm_curr = {0};
time_t time_prev = 0;
#endif
#if HAVE_ZLIB
// 0) if zlib is enabled, we must decompress the file first
file = gzuncompress(filepath);
#else
file = fopen(filepath, "rb");
#endif
BC_ASSERT_PTR_NOT_NULL(file);
if (!file) return 0;
// 1) expect to find folder name in filename path
BC_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_get_writable_dir_prefix()));
// 2) check file contents
while (getline(&line, &line_size, file) != -1) {
// a) there should be at least 25 lines
++line_count;
#ifndef _WIN32
// b) logs should be ordered by date (format: 2014-11-04 15:22:12:606)
if (strlen(line) > 24) {
char date[24] = {'\0'};
memcpy(date, line, 23);
/*reset tm_curr to reset milliseconds and below fields*/
memset(&tm_curr, 0, sizeof(struct tm));
if (strptime(date, "%Y-%m-%d %H:%M:%S", &tm_curr) != NULL) {
tm_curr.tm_isdst = -1; // LOL
log_time = mktime(&tm_curr);
BC_ASSERT_GREATER(log_time , time_prev, long int, "%ld");
time_prev = log_time;
}
}