Changeset 82 for pjproject/trunk/pjsip/src/test-pjsip/uri.c
- Timestamp:
- Nov 23, 2005 8:56:30 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/test-pjsip/uri.c
r77 r82 58 58 static pjsip_uri *create_uri16( pj_pool_t *pool ); 59 59 static pjsip_uri *create_uri17( pj_pool_t *pool ); 60 static pjsip_uri *create_uri25( pj_pool_t *pool ); 61 static pjsip_uri *create_uri26( pj_pool_t *pool ); 62 static pjsip_uri *create_uri27( pj_pool_t *pool ); 63 static pjsip_uri *create_uri28( pj_pool_t *pool ); 64 static pjsip_uri *create_uri29( pj_pool_t *pool ); 65 static pjsip_uri *create_uri30( pj_pool_t *pool ); 66 static pjsip_uri *create_uri31( pj_pool_t *pool ); 67 static pjsip_uri *create_uri32( pj_pool_t *pool ); 68 static pjsip_uri *create_uri33( pj_pool_t *pool ); 69 static pjsip_uri *create_uri34( pj_pool_t *pool ); 70 static pjsip_uri *create_uri35( pj_pool_t *pool ); 60 71 static pjsip_uri *create_dummy( pj_pool_t *pool ); 61 72 … … 67 78 pj_status_t status; 68 79 char str[PJSIP_MAX_URL_SIZE]; 69 pjsip_uri *(*creator)(pj_pool_t *pool); 80 pjsip_uri *(*creator)(pj_pool_t *pool); 81 const char *printed; 70 82 pj_size_t len; 71 83 } uri_test_array[] = … … 227 239 "", 228 240 &create_dummy, 229 } 241 }, 242 { 243 /* 25: Simple tel: URI with global context */ 244 PJ_SUCCESS, 245 "tel:+1-201-555-0123", 246 &create_uri25, 247 "tel:+1-201-555-0123" 248 }, 249 { 250 /* 26: Simple tel: URI with local context */ 251 PJ_SUCCESS, 252 "tel:7042;phone-context=example.com", 253 &create_uri26, 254 "tel:7042;phone-context=example.com" 255 }, 256 { 257 /* 27: Simple tel: URI with local context */ 258 PJ_SUCCESS, 259 "tel:863-1234;phone-context=+1-914-555", 260 &create_uri27, 261 "tel:863-1234;phone-context=+1-914-555" 262 }, 263 { 264 /* 28: Comparison between local and global number */ 265 ERR_NOT_EQUAL, 266 "tel:+1", 267 &create_uri28, 268 "tel:+1" 269 }, 270 { 271 /* 29: tel: with some visual chars and spaces */ 272 PJ_SUCCESS, 273 "tel:(44).1234-*#+Deaf", 274 &create_uri29, 275 "tel:(44).1234-*#+Deaf" 276 }, 277 { 278 /* 30: isub parameters */ 279 PJ_SUCCESS, 280 "tel:+1;isub=/:@&$,-_.!~*'()[]/:&$aA1%21+=", 281 &create_uri30, 282 "tel:+1;isub=/:@&$,-_.!~*'()[]/:&$aA1%21+%3d" 283 }, 284 { 285 /* 31: extension number parsing and encoding */ 286 PJ_SUCCESS, 287 "tel:+1;ext=+123", 288 &create_uri31, 289 "tel:+1;ext=%2b123" 290 }, 291 { 292 /* 32: context parameter parsing and encoding */ 293 PJ_SUCCESS, 294 "tel:911;phone-context=+1-911", 295 &create_uri32, 296 "tel:911;phone-context=+1-911" 297 }, 298 { 299 /* 33: case-insensitive comparison */ 300 PJ_SUCCESS, 301 "tel:911;phone-context=emergency.example.com", 302 &create_uri33, 303 "tel:911;phone-context=emergency.example.com" 304 }, 305 { 306 /* 34: parameter only appears in one URL */ 307 ERR_NOT_EQUAL, 308 "tel:911;p1=p1;p2=p2", 309 &create_uri34, 310 "tel:911;p1=p1;p2=p2" 311 }, 312 230 313 }; 231 314 … … 474 557 return (pjsip_uri*)url; 475 558 } 559 560 561 static pjsip_uri *create_uri25(pj_pool_t *pool) 562 { 563 /* "tel:+1-201-555-0123" */ 564 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 565 566 uri->number = pj_str("+1-201-555-0123"); 567 return (pjsip_uri*)uri; 568 } 569 570 static pjsip_uri *create_uri26(pj_pool_t *pool) 571 { 572 /* tel:7042;phone-context=example.com */ 573 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 574 575 uri->number = pj_str("7042"); 576 uri->context = pj_str("example.com"); 577 return (pjsip_uri*)uri; 578 } 579 580 static pjsip_uri *create_uri27(pj_pool_t *pool) 581 { 582 /* "tel:863-1234;phone-context=+1-914-555" */ 583 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 584 585 uri->number = pj_str("863-1234"); 586 uri->context = pj_str("+1-914-555"); 587 return (pjsip_uri*)uri; 588 } 589 590 /* "tel:1" */ 591 static pjsip_uri *create_uri28(pj_pool_t *pool) 592 { 593 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 594 595 uri->number = pj_str("1"); 596 return (pjsip_uri*)uri; 597 } 598 599 /* "tel:(44).1234-*#+Deaf" */ 600 static pjsip_uri *create_uri29(pj_pool_t *pool) 601 { 602 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 603 604 uri->number = pj_str("(44).1234-*#+Deaf"); 605 return (pjsip_uri*)uri; 606 } 607 608 /* "tel:+1;isub=/:@&$,-_.!~*'()[]/:&$aA1%21+=" */ 609 static pjsip_uri *create_uri30(pj_pool_t *pool) 610 { 611 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 612 613 uri->number = pj_str("+1"); 614 uri->isub_param = pj_str("/:@&$,-_.!~*'()[]/:&$aA1%21+="); 615 return (pjsip_uri*)uri; 616 } 617 618 /* "tel:+1;ext=+123" */ 619 static pjsip_uri *create_uri31(pj_pool_t *pool) 620 { 621 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 622 623 uri->number = pj_str("+1"); 624 uri->ext_param = pj_str("+123"); 625 return (pjsip_uri*)uri; 626 } 627 628 /* "tel:911;phone-context=+1-911" */ 629 static pjsip_uri *create_uri32(pj_pool_t *pool) 630 { 631 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 632 633 uri->number = pj_str("911"); 634 uri->context = pj_str("+1-911"); 635 return (pjsip_uri*)uri; 636 } 637 638 /* "tel:911;phone-context=emergency.example.com" */ 639 static pjsip_uri *create_uri33(pj_pool_t *pool) 640 { 641 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 642 643 uri->number = pj_str("911"); 644 uri->context = pj_str("EMERGENCY.EXAMPLE.COM"); 645 return (pjsip_uri*)uri; 646 } 647 648 /* "tel:911;p1=p1;p2=p2" */ 649 static pjsip_uri *create_uri34(pj_pool_t *pool) 650 { 651 pjsip_tel_uri *uri = pjsip_tel_uri_create(pool); 652 pjsip_param *p; 653 654 uri->number = pj_str("911"); 655 656 p = pj_pool_alloc(pool, sizeof(*p)); 657 p->name = p->value = pj_str("p1"); 658 pj_list_insert_before(&uri->other_param, p); 659 660 return (pjsip_uri*)uri; 661 } 662 476 663 477 664 static pjsip_uri *create_dummy(pj_pool_t *pool) … … 573 760 574 761 /* Compare text. */ 575 if (pj_strcmp(&s1, &s2) != 0) { 576 /* Not equal. */ 577 status = -60; 762 if (entry->printed) { 763 if (pj_strcmp2(&s1, entry->printed) != 0) { 764 /* Not equal. */ 765 PJ_LOG(3,("", " uri print mismatch:\n" 766 " printed='%s'\n" 767 " expectd='%s'", 768 s1.ptr, entry->printed)); 769 status = -60; 770 } 771 } else { 772 if (pj_strcmp(&s1, &s2) != 0) { 773 /* Not equal. */ 774 PJ_LOG(3,("", " uri print mismatch:\n" 775 " uri1='%s'\n" 776 " uri2='%s'", 777 s1.ptr, s2.ptr)); 778 status = -70; 779 } 578 780 } 579 781
Note: See TracChangeset
for help on using the changeset viewer.