• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ASSERT_STR_EQUAL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testNoRouteLocal

   void testNoRouteLocal()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         SipMessage testMsg(message, strlen(message));
         Url requestUri;
         UtlSList removedRoutes;
         
         testMsg.normalizeProxyRoutes(UserAgent, requestUri, &removedRoutes);

         UtlString normalizedMsg;
         int msgLen;
         testMsg.getBytes(&normalizedMsg, &msgLen);

         ASSERT_STR_EQUAL(message, normalizedMsg.data());

         UtlString requestUriResult;
         requestUri.toString(requestUriResult);
         
         ASSERT_STR_EQUAL("sip:[email protected]", requestUriResult.data());

         CPPUNIT_ASSERT(removedRoutes.isEmpty());
      }
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:33,代码来源:SipProxyMessageTest.cpp


示例2: getOneRowByLocationCodeTest

   void getOneRowByLocationCodeTest()
   {
      SipDbTestContext sipDbTestContext(TEST_DATA_DIR "/locationdata",
                                        TEST_WORK_DIR "/locationdata"
                                                 );
      sipDbTestContext.inputFile("dummy_loc_db.xml" );
      
      LocationDB* pLocDb = LocationDB::getInstance("dummy_loc_db");
      UtlHashMap hashmap;
      CPPUNIT_ASSERT( !pLocDb->getRowByLocationCode( "5144", hashmap ) );
      CPPUNIT_ASSERT( pLocDb->getRowByLocationCode( "514", hashmap ) );
      CPPUNIT_ASSERT( hashmap.entries() == 4 );

      UtlString* pTempString;
      UtlString key;
      key = "name";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Montreal", pTempString->data() );
      
      key = "description";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Go Habs Go!", pTempString->data() );
      
      key = "locationcode";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "514", pTempString->data() );

      key = "subnets";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "10.10.10.0/24,11.11.11.0/24,12.12.12.0/24", pTempString->data() );
   }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:35,代码来源:LocationDbTest.cpp


示例3: testAllNoDefaultPermutations

      void testAllNoDefaultPermutations()
      {
         FallbackRulesUrlMapping* urlmap;
         ResultSet registrations;
         UtlString actual;
         UtlString callTag = "UNK";

         CPPUNIT_ASSERT( urlmap = new FallbackRulesUrlMapping() );
         UtlString simpleXml;
         mFileTestContext->inputFilePath("fallbackrules.xml", simpleXml);
         CPPUNIT_ASSERT( urlmap->loadMappings(simpleXml.data() ) == OS_SUCCESS );

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations, callTag
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("salem"),
                                registrations, callTag
                                ) != OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 0 ,  registrations.getSize() );
         
         delete urlmap;
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:31,代码来源:FallbackRulesUrlMappingTest.cpp


示例4: testBranchIdparse

   void testBranchIdparse()
      {
         size_t       counter;
         UtlString    uniqueValue;
         UtlString    loopDetectKey;

         CPPUNIT_ASSERT(!BranchId::parse("z9hG4bK11e0671922444aa6a5f7f10b5",
                                         counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT(uniqueValue.isNull());
         CPPUNIT_ASSERT(loopDetectKey.isNull());

         CPPUNIT_ASSERT(!BranchId::parse("az9hG4bK11e0671922444aa6a5f7f10b5",
                                         counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT(uniqueValue.isNull());
         CPPUNIT_ASSERT(loopDetectKey.isNull());

         CPPUNIT_ASSERT(!BranchId::parse("x9hG4bK11e0671922444aa6a5f7f10b5",
                                         counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT(uniqueValue.isNull());
         CPPUNIT_ASSERT(loopDetectKey.isNull());

         CPPUNIT_ASSERT(BranchId::parse("z9hG4bK-XX-0014xXPnvpKqfTHmjFlrAD5sPA~1Pke3N5l0uqpDw00P`ZWYw",
                                        counter, uniqueValue, loopDetectKey));
         CPPUNIT_ASSERT_EQUAL((size_t)20, counter);
         ASSERT_STR_EQUAL("xXPnvpKqfTHmjFlrAD5sPA", uniqueValue.data());
         ASSERT_STR_EQUAL("1Pke3N5l0uqpDw00P`ZWYw", loopDetectKey.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:27,代码来源:BranchIdTest.cpp


示例5: testDoubleRoute

   void testDoubleRoute()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Route: <sip:[email protected];lr>, <sip:[email protected];lr>\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         SipMessage testMsg(message, strlen(message));
         Url requestUri;
         UtlSList removedRoutes;
         
         testMsg.normalizeProxyRoutes(UserAgent, requestUri, &removedRoutes);

         UtlString normalizedMsg;
         int msgLen;
         testMsg.getBytes(&normalizedMsg, &msgLen);

         const char* expectedMessage = // route header removed, uri swapped
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         ASSERT_STR_EQUAL(expectedMessage, normalizedMsg.data());

         UtlString requestUriResult;
         requestUri.toString(requestUriResult);
         
         ASSERT_STR_EQUAL("sip:[email protected]", requestUriResult.data());

         UtlString* removedRoute;

         CPPUNIT_ASSERT( removedRoute = static_cast<UtlString*>(removedRoutes.get()));
         ASSERT_STR_EQUAL("<sip:[email protected];lr>", removedRoute->data());
         delete removedRoute;

         CPPUNIT_ASSERT( removedRoute = static_cast<UtlString*>(removedRoutes.get()));
         ASSERT_STR_EQUAL("<sip:[email protected];lr>", removedRoute->data());
         delete removedRoute;

         CPPUNIT_ASSERT(removedRoutes.isEmpty());

      }
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:57,代码来源:SipProxyMessageTest.cpp


示例6: testForbidden

   // Test that an out-of-dialog request gets an authentication challenge when
   // the auth rules require it.
   void testForbidden()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 2 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));


         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]");

         UtlSList noRemovedRoutes;
         UtlString routeName("example.com");
         RouteState routeState( testMsg, noRemovedRoutes, routeName );

         UtlString rejectReason;

         UtlString method("INVITE");
         const bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::CONTINUE;

         CPPUNIT_ASSERT(AuthPlugin::DENY
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL("", rejectReason.data());

         // now try the same request, but with an authenticated identity
         // so this time it should provide a reject reason
         identity = "[email protected]le.com";

         CPPUNIT_ASSERT(AuthPlugin::DENY
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL("Requires NoAccess", rejectReason.data());
      }
开发者ID:ciuc,项目名称:sipxecs,代码行数:59,代码来源:EnforceAuthRulesTest.cpp


示例7: AuthenticatedRefer

   // Test that an authenticated REFER without Replaces to a good target is allowed and not modified
   void AuthenticatedRefer()
      {
         UtlString identity("[email protected]"); // an authenticated identity
         Url requestUri("sip:[email protected]");

         const char* message =
            "REFER sip:[email protected] SIP/2.0\r\n"
            "Refer-To: [email protected]\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString myRouteName("myhost.example.com");
         RouteState routeState( testMsg, noRemovedRoutes, myRouteName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);
         
         UtlString method("REFER");
         bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::CONTINUE;
         
         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == xferctl->authorizeAndModify(identity,
                                                       requestUri,
                                                       routeState,
                                                       method,
                                                       priorResult,
                                                       testMsg,
                                                       bSpiralingRequest,
                                                       rejectReason
                                                       ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         UtlString modifiedReferToStr;
         CPPUNIT_ASSERT(testMsg.getReferToField(modifiedReferToStr));

         Url modifiedReferTo(modifiedReferToStr);
         CPPUNIT_ASSERT(Url::SipUrlScheme == modifiedReferTo.getScheme());

         // check that the message has not been modified
         UtlString outputMsg;
         ssize_t    outputSize;
         testMsg.getBytes(&outputMsg, &outputSize);

         ASSERT_STR_EQUAL(message, outputMsg.data());
      }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:56,代码来源:MSFT_ExchangeTransferHackTest.cpp


示例8: testBranchCopy

   void testBranchCopy()
      {
         UtlString sipXbranchId("z9hG4bK-XX-000af33a294c2143da892d81dbc8183fd7f8");
         BranchId  sipXcopied(sipXbranchId);

         ASSERT_STR_EQUAL(sipXbranchId.data(), sipXcopied.data());

         UtlString non_sipXbranchId("z9hG4bK-94rkdeeepdeloepw%ww-lflll");
         BranchId  non_sipXcopied(non_sipXbranchId);

         ASSERT_STR_EQUAL(sipXbranchId.data(), sipXcopied.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:12,代码来源:BranchIdTest.cpp


示例9: testMapUriNoRoot

   void testMapUriNoRoot()
      {
         UtlString mapped;

         HttpServer server(NULL);
         server.addUriMap("/notrooturi", "/notrootpath");
         
         CPPUNIT_ASSERT(!HttpServer::mapUri(server.mUriMaps, "/uripath", mapped));
         ASSERT_STR_EQUAL("/uripath", mapped.data());

         CPPUNIT_ASSERT(!HttpServer::mapUri(server.mUriMaps, "/", mapped));
         ASSERT_STR_EQUAL("/", mapped.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:13,代码来源:HttpServerTest.cpp


示例10: testNoPermResponse

   // Test that a response message is allowed and is not modified
   void testNoPermResponse()
      {
         OsConfigDb configuration;
         configuration.set("RULES", TEST_DATA_DIR "/enforcerules.xml");

         enforcer->readConfig(configuration);

         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]");

         const char* message =
            "SIP/2.0 200 Ok\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=99911983748\r\n"
            "Call-Id: b1373e736d7d359ead76fa5cd467d999\r\n"
            "Cseq: 2 ACK\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "Record-Route: <sip:example.com;lr;sipXecs-rs=enforce%2Aauth%7E%21d1e296555015a54cb746fa7ac5695cf7>\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString routeName("example.com");
         RouteState routeState( testMsg, noRemovedRoutes, routeName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);

         UtlString method("INVITE");
         const bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::ALLOW; // SipRouter passes this for responses

         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         UtlString recordRoute;
         CPPUNIT_ASSERT(testMsg.getRecordRouteField(0, &recordRoute));
         ASSERT_STR_EQUAL( "<sip:example.com;lr;sipXecs-rs=enforce%2Aauth%7E%21d1e296555015a54cb746fa7ac5695cf7>", recordRoute );
      }
开发者ID:ciuc,项目名称:sipxecs,代码行数:52,代码来源:EnforceAuthRulesTest.cpp


示例11: testMultiplePAIs_Mixed

   void testMultiplePAIs_Mixed()
   {
      const char* message =
         "INVITE sip:[email protected]:5060;x-sipX-pubcontact=47.135.162.145%3A29544 SIP/2.0\r\n"
         "Record-Route: <sip:192.168.0.2:5060;lr>\r\n"
         "From: caller <sip:[email protected]>;tag=94bc25b8-c0a80165-13c4-3e635-37aa1989-3e635\r\n"
         "To: <sip:[email protected]>\r\n"
         "Call-Id: [email protected]com\r\n"
         "Cseq: 1 INVITE\r\n"
         "Max-Forwards: 19\r\n"
         "Supported: replaces\r\n"
         "Contact: <sip:[email protected]:5060;x-sipX-pubcontact=47.135.162.145%3A14956>\r\n"
         "P-Asserted-Identity: \"Some guy\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner1\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"Some other guy\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner2\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner3\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"yet another guy\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"foreigner4\" <sip:[email protected]>\r\n"
         "P-Asserted-Identity: \"you again\" <sip:[email protected]>\r\n"
         "Content-Length: 0\r\n"
         "\r\n";
      SipMessage testMsg(message, strlen(message));
      
      UtlSList noRemovedRoutes;
      UtlString routeName("mydomain.com");
      RouteState routeState( testMsg, noRemovedRoutes, routeName );   
      UtlString rejectReason;
      
      CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                     == spLinter->authorizeAndModify(identity,
                                                     requestUri,
                                                     routeState,
                                                     "INVITE",
                                                     AuthPlugin::CONTINUE,
                                                     testMsg,
                                                     false,
                                                     rejectReason
                                                     ));

      // verify that foreign PAIs are still there.
      const char* pPAI;
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 0, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner1\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 1, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner2\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 2, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner3\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 3, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner4\" <sip:[email protected]>", pPAI );
   } 
开发者ID:chemeris,项目名称:sipxecs,代码行数:51,代码来源:RequestLinterTest.cpp


示例12: testGetAcceptField

   void testGetAcceptField()
      {
         UtlString v;

         HttpMessage m0(
            "SUBSCRIBE sip:[email protected] SIP/2.0\r\n"
            "From: <sip:[email protected]>;tag=1c1198308561\r\n"
            "To: <sip:[email protected];user=phone>\r\n"
            "Call-Id: [email protected]\r\n"
            "Cseq: 1 INVITE\r\n"
            "Via: SIP/2.0/UDP 10.139.4.84;branch=z9hG4bK-de2c934952294f774ee0acbc133e9b1d\r\n"
            "Via: SIP/2.0/UDP 10.139.33.244;branch=z9hG4bKac1198312375\r\n"
            "Content-Length: 0\r\n"
            "\r\n"
                                 );

         CPPUNIT_ASSERT(!m0.getAcceptField(v));

         HttpMessage m1(
            "SUBSCRIBE sip:[email protected] SIP/2.0\r\n"
            "From: <sip:[email protected]>;tag=1c1198308561\r\n"
            "To: <sip:[email protected];user=phone>\r\n"
            "Call-Id: [email protected]\r\n"
            "Cseq: 1 INVITE\r\n"
            "Via: SIP/2.0/UDP 10.139.4.84;branch=z9hG4bK-de2c934952294f774ee0acbc133e9b1d\r\n"
            "Via: SIP/2.0/UDP 10.139.33.244;branch=z9hG4bKac1198312375\r\n"
            "Accept: foo, bar\r\n"
            "Content-Length: 0\r\n"
            "\r\n"
                                 );

         CPPUNIT_ASSERT(m1.getAcceptField(v));
         ASSERT_STR_EQUAL("foo, bar", v.data());

         HttpMessage m2(
            "SUBSCRIBE sip:[email protected] SIP/2.0\r\n"
            "From: <sip:[email protected]>;tag=1c1198308561\r\n"
            "To: <sip:[email protected];user=phone>\r\n"
            "Call-Id: [email protected]\r\n"
            "Cseq: 1 INVITE\r\n"
            "Via: SIP/2.0/UDP 10.139.4.84;branch=z9hG4bK-de2c934952294f774ee0acbc133e9b1d\r\n"
            "Via: SIP/2.0/UDP 10.139.33.244;branch=z9hG4bKac1198312375\r\n"
            "Accept: foo, bar\r\n"
            "Accept: baz\r\n"
            "Content-Length: 0\r\n"
            "\r\n"
                                 );

         CPPUNIT_ASSERT(m2.getAcceptField(v));
         ASSERT_STR_EQUAL("foo, bar,baz", v.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:51,代码来源:HttpMessageTest.cpp


示例13: sanityTest

    // Basic santity checking for lines; make sure they work as expected
    void sanityTest()
    {
        Url identity("\"Display Name\" <sip:[email protected]>", Url::NameAddr, NULL) ;
        SipLine line(identity, identity, "userId") ;

        Url url = line.getIdentity() ;
        ASSERT_STR_EQUAL(identity.toString().data(), url.toString().data()) ;
        line.getPreferredContactUri(url) ;
        CPPUNIT_ASSERT(url.isUserHostPortEqual(url, SIP_PORT) == true) ;
        UtlString lineId = line.getLineId() ;
        UtlString lineParamId;
        url.getUrlParameter(SIP_LINE_IDENTIFIER, lineParamId) ;
        ASSERT_STR_EQUAL(lineParamId.data(), lineId.data()) ;
    }
开发者ID:astubbs,项目名称:sipxecs,代码行数:15,代码来源:SipLineTest.cpp


示例14: BadReferFromExchangeWithPort

   // Test that a buggy REFER without Replaces from Exchange is modified
   void BadReferFromExchangeWithPort()
      {
         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]:56777");

         const char* message =
            "REFER sip:[email protected]:56777 SIP/2.0\r\n"
            "Refer-To: [email protected]:56777\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "User-Agent: RTCC/2\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString myRouteName("myhost.example.com");
         RouteState routeState( testMsg, noRemovedRoutes, myRouteName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);
         
         UtlString method("REFER");
         bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::CONTINUE;
         
         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == xferctl->authorizeAndModify(identity,
                                                       requestUri,
                                                       routeState,
                                                       method,
                                                       priorResult,
                                                       testMsg,
                                                       bSpiralingRequest,
                                                       rejectReason
                                                       ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         // check that the target has been modified to our domain
         UtlString modifiedReferToStr;
         CPPUNIT_ASSERT(testMsg.getReferToField(modifiedReferToStr));

         ASSERT_STR_EQUAL("sip:[email protected]", modifiedReferToStr.data());
      }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:50,代码来源:MSFT_ExchangeTransferHackTest.cpp


示例15: getOneRowByNameTest

   void getOneRowByNameTest()
   {
      SipDbTestContext sipDbTestContext(TEST_DATA_DIR "/locationdata",
                                        TEST_WORK_DIR "/locationdata"
                                                 );
      sipDbTestContext.inputFile("dummy_loc_db.xml" );
      
      LocationDB* pLocDb = LocationDB::getInstance("dummy_loc_db");
      UtlHashMap hashmap;
      CPPUNIT_ASSERT( !pLocDb->getRowByName( "Washington", hashmap ) );
      CPPUNIT_ASSERT( pLocDb->getRowByName( "Ottawa", hashmap ) );
      CPPUNIT_ASSERT( hashmap.entries() == 4 );

      UtlString* pTempString;
      UtlString key;
      key = "name";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Ottawa", pTempString->data() );
      
      key = "description";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "One crazy location", pTempString->data() );
      
      key = "locationcode";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "613", pTempString->data() );

      key = "subnets";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "172.30.0.0/16,22.22.22.22/32", pTempString->data() );

      // get a second location row
      CPPUNIT_ASSERT( pLocDb->getRowByName( "Quebec", hashmap ) );
      CPPUNIT_ASSERT( hashmap.entries() == 4 );

      key = "name";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Quebec", pTempString->data() );
      
      key = "description";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "Happy 400th anniversary", pTempString->data() );
      
      key = "locationcode";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( "418", pTempString->data() );

      key = "subnets";
      pTempString = dynamic_cast<UtlString*>(hashmap.findValue( &key ) );
      CPPUNIT_ASSERT( pTempString );
      ASSERT_STR_EQUAL( SPECIAL_IMDB_NULL_VALUE, pTempString->data() );
   }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:59,代码来源:LocationDbTest.cpp


示例16: testEscape

  void testEscape()
  {
    const char* umlautUriValue = "\"Thomas Frölich Snom 320\" <sip:[email protected];transport=udp>;tag=zmbmylm36n";

    UtlString umlautString(umlautUriValue);

    ASSERT_STR_EQUAL(umlautUriValue, umlautString.data());

    HttpMessage::escape(umlautString);
    const char* umlautUriEscaped = "%22Thomas+Fr%C3%B6lich+Snom+320%22+%3Csip%3A2012%40pforzheim.org%3Btransport%3Dudp%3E%3Btag%3Dzmbmylm36n";
    ASSERT_STR_EQUAL(umlautUriEscaped, umlautString.data());

    HttpMessage::unescape(umlautString);
    ASSERT_STR_EQUAL(umlautUriValue, umlautString.data());
  }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:HttpMessageTest.cpp


示例17: blockSimultaneousCommand

   void blockSimultaneousCommand()
   {
      FileTestContext testContext(TEST_DATA_DIR "commandDef",
            TEST_WORK_DIR "commandDef");

      // copy test files into testContext structure
      testContext.inputFile("goodcommand.xml");
      testContext.inputFile("goodcommand.sh");
      UtlString exePath;
      testContext.workingFilePath("goodcommand.sh", exePath);
      chmod(exePath.data(), S_IREAD | S_IWRITE | S_IEXEC);

      testContext.setSipxDir(SipXecsService::VarDirType, "var");
      testContext.setSipxDir(SipXecsService::LogDirType);

      UtlString path;
      SipxCommand* command1;

      testContext.inputFilePath("goodcommand.xml", path);

      CPPUNIT_ASSERT((command1 = SipxCommand::createFromDefinition(path)));
      ASSERT_STR_EQUAL("Good", command1->data());

      command1->execute();
      OsTask::delay(500); // give task some time to get up and running
      
      // another invocation should fail: command is already running
      CPPUNIT_ASSERT(false == command1->execute());
      
      OsTask::delay(1000); // give task some time to shutdown
      
      delete command1;
   }
开发者ID:chemeris,项目名称:sipxecs,代码行数:33,代码来源:SipxCommandTest.cpp


示例18: testMapUriPostRoot

   void testMapUriPostRoot()
      {
         UtlString mapped;

         HttpServer server(NULL);
         server.addUriMap("/a/b", "/x/y");

         CPPUNIT_ASSERT(HttpServer::mapUri(server.mUriMaps, "/a/b/c", mapped));
         ASSERT_STR_EQUAL("/x/y/c", mapped.data());

         CPPUNIT_ASSERT(!HttpServer::mapUri(server.mUriMaps, "/", mapped));
         ASSERT_STR_EQUAL("/", mapped.data());

         CPPUNIT_ASSERT(!HttpServer::mapUri(server.mUriMaps, "/x/a/b/c", mapped));
         ASSERT_STR_EQUAL("/x/a/b/c", mapped.data());
      }
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:16,代码来源:HttpServerTest.cpp


示例19: testTwoRoutesOneLocal

   void testTwoRoutesOneLocal()
      {
         const char* message =
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Route: <sip:example.com;lr>, <sip:proxy.somewhere.com;lr>\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         SipMessage testMsg(message, strlen(message));
         Url requestUri;
         UtlSList removedRoutes;
         
         testMsg.normalizeProxyRoutes(UserAgent, requestUri, &removedRoutes);

         UtlString normalizedMsg;
         int msgLen;
         testMsg.getBytes(&normalizedMsg, &msgLen);

         UtlString requestUriResult;
         requestUri.toString(requestUriResult);
         
         ASSERT_STR_EQUAL("sip:[email protected]", requestUriResult.data());

         UtlString* removedRoute;

         CPPUNIT_ASSERT( removedRoute = dynamic_cast<UtlString*>(removedRoutes.get()));
         ASSERT_STR_EQUAL("<sip:example.com;lr>", removedRoute->data());
         delete removedRoute;

         CPPUNIT_ASSERT(removedRoutes.isEmpty());

         UtlString route;
         /* "Route: <sip:proxy.somewhere.com;lr>\r\n" */

         CPPUNIT_ASSERT(getNormalRoute(testMsg, 0, route));
         ASSERT_STR_EQUAL("<sip:proxy.somewhere.com;lr>", route.data());

         CPPUNIT_ASSERT(!getNormalRoute(testMsg, 1, route));

      }
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:47,代码来源:SipProxyMessageTest.cpp


示例20: runCommand

   void runCommand()
   {
      FileTestContext testContext(TEST_DATA_DIR "commandDef",
            TEST_WORK_DIR "commandDef");

      // copy test files into testContext structure
      testContext.inputFile("goodcommand.xml");
      testContext.inputFile("goodcommand.sh");
      UtlString exePath;
      testContext.workingFilePath("goodcommand.sh", exePath);
      chmod(exePath.data(), S_IREAD | S_IWRITE | S_IEXEC);

      testContext.setSipxDir(SipXecsService::VarDirType, "var");
      testContext.setSipxDir(SipXecsService::LogDirType);

      UtlString path;
      SipxCommand* command1;

      testContext.inputFilePath("goodcommand.xml", path);

      CPPUNIT_ASSERT((command1 = SipxCommand::createFromDefinition(path)));

      ASSERT_STR_EQUAL("Good", command1->data());

      UtlSList msgs;
      command1->getCommandMessages(msgs);
      CPPUNIT_ASSERT(0 == msgs.entries());

      command1->execute();
      OsTask::delay(500); // give task some time to get up and running

      CPPUNIT_ASSERT(true == command1->isRunning());

      OsTask::delay(1000); // give task some time to finish
      CPPUNIT_ASSERT(false == command1->isRunning());
      
      command1->getCommandMessages(msgs);

      CPPUNIT_ASSERT(3 == msgs.entries());
      
      ASSERT_STR_EQUAL("stdout.msg-1: goodprocess.sh" , ((UtlString*)msgs.at(0))->data());
      ASSERT_STR_EQUAL("return.code: 11" , ((UtlString*)msgs.at(2))->data());
      msgs.destroyAll();
      
      delete command1;
      OsTask::delay(1000); // give task some time to shutdown
   }
开发者ID:chemeris,项目名称:sipxecs,代码行数:47,代码来源:SipxCommandTest.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASSERT_THROWS函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSERT_STR_EQ函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap