belle_sdp_tester.c: test long session ID to be sure that we handle 32 bits long correctly

parent 77a0c2ca
......@@ -381,7 +381,7 @@ static void test_media_description(void) {
static void test_simple_session_description(void) {
const char* l_src = "v=0\r\n"\
"o=jehan-mac 1239 1239 IN IP4 192.168.0.18\r\n"\
"o=jehan-mac 2463217870 2463217870 IN IP4 192.168.0.18\r\n"\
"s=Talk\r\n"\
"c=IN IP4 192.168.0.18\r\n"\
"t=0 0\r\n"\
......@@ -419,8 +419,8 @@ static void test_simple_session_description(void) {
CU_ASSERT_STRING_EQUAL(belle_sdp_origin_get_address(l_origin),"192.168.0.18")
CU_ASSERT_STRING_EQUAL(belle_sdp_origin_get_address_type(l_origin),"IP4")
CU_ASSERT_STRING_EQUAL(belle_sdp_origin_get_network_type(l_origin),"IN")
CU_ASSERT_EQUAL(belle_sdp_origin_get_session_id(l_origin),1239)
CU_ASSERT_EQUAL(belle_sdp_origin_get_session_version(l_origin),1239)
CU_ASSERT_EQUAL(belle_sdp_origin_get_session_id(l_origin),2463217870)
CU_ASSERT_EQUAL(belle_sdp_origin_get_session_version(l_origin),2463217870)
CU_ASSERT_PTR_NOT_NULL(belle_sdp_session_description_get_session_name(l_session_description));
CU_ASSERT_STRING_EQUAL(belle_sdp_session_name_get_value(belle_sdp_session_description_get_session_name(l_session_description)),"Talk");
......@@ -534,7 +534,7 @@ static void test_overflow(void){
size_t buffsize=orig_buffsize;
char *buffer=belle_sip_malloc0(buffsize);
size_t offset=0;
sdp=belle_sdp_session_description_parse(big_sdp);
CU_ASSERT_PTR_NOT_NULL(sdp);
mds=belle_sdp_session_description_get_media_descriptions(sdp);
......
......@@ -39,7 +39,7 @@ int main(int argc, char *argv[]){
int i;
const char *filename=NULL;
const char *protocol="sip";
if (argc<2){
fprintf(stderr,"Usage:\n%s [--protocol sip|http|sdp] <text file containing messages>\n",argv[0]);
return -1;
......@@ -63,7 +63,7 @@ int main(int argc, char *argv[]){
fprintf(stderr,"Could not stat %s: %s\n",filename,strerror(errno));
return -1;
}
fd=open(filename,O_RDONLY);
if (fd==-1){
fprintf(stderr,"Could not open %s: %s\n",filename,strerror(errno));
......@@ -78,7 +78,7 @@ int main(int argc, char *argv[]){
}
close(fd);
belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
for (i=0;i<st.st_size;){
size_t read;
if (strcasecmp(protocol,"sip")==0 || strcasecmp(protocol,"http")==0){
......@@ -88,7 +88,7 @@ int main(int argc, char *argv[]){
msg=belle_sip_message_parse_raw(str+i,st.st_size-i,&read);
end=belle_sip_time_ms();
if (msg){
printf("Succesfully parsed %s message of %i bytes in %i ms.\n",protocol,(int)read, (int)(end-begin));
printf("Successfully parsed %s message of %i bytes in %i ms.\n",protocol,(int)read, (int)(end-begin));
}else{
fprintf(stderr,"Failed to parse message.\n");
break;
......@@ -97,7 +97,7 @@ int main(int argc, char *argv[]){
}else if (strcasecmp(protocol,"sdp")==0){
belle_sdp_session_description_t *sdp=belle_sdp_session_description_parse(str);
if (sdp){
printf("Succesfully parsed %s message of %i bytes.\n",protocol,(int)strlen(str));
printf("Successfully parsed %s message of %i bytes.\n",protocol,(int)strlen(str));
}else{
fprintf(stderr,"Failed to parse SDP message.\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment