Wisp 1.2.1 C++ Unit Test Coverage
Current view: top level - tests/wisp/service - ServiceTest.cc (source / functions) Hit Total Coverage
Test: Wisp 1.2.1 C++ Unit Tests Lines: 7 7 100.0 %
Date: 2011-05-11 Functions: 6 7 85.7 %
Branches: 20 40 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* Copyright 2006-2011 Savarese Software Research Corporation
       2                 :            :  *
       3                 :            :  * Licensed under the Apache License, Version 2.0 (the "License");
       4                 :            :  * you may not use this file except in compliance with the License.
       5                 :            :  * You may obtain a copy of the License at
       6                 :            :  *
       7                 :            :  *     http://www.savarese.com/software/ApacheLicense-2.0
       8                 :            :  *
       9                 :            :  * Unless required by applicable law or agreed to in writing, software
      10                 :            :  * distributed under the License is distributed on an "AS IS" BASIS,
      11                 :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12                 :            :  * See the License for the specific language governing permissions and
      13                 :            :  * limitations under the License.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include <ssrc/wisp/test/ServiceTestFixture.h>
      17                 :            : #include <examples/echo/echo_service.h>
      18                 :            : 
      19                 :            : #define BOOST_TEST_MODULE ServiceTest
      20                 :            : #include <boost/test/unit_test.hpp>
      21                 :            : 
      22                 :            : using namespace NS_SSRC_WISP_TEST;
      23                 :            : 
      24                 :            : typedef ServiceTestFixture<EchoService, EchoProtocol::CallStop> ServiceFixture;
      25                 :            : 
      26                 :            : WISP_IMPORT(EchoProtocol, CallEchoRequest);
      27                 :            : WISP_IMPORT(EchoProtocol, MessageEchoReply);
      28                 :            : 
      29                 :            : 
      30 [ +  - ][ +  - ]:          4 : BOOST_FIXTURE_TEST_CASE(test_process_requests, ServiceFixture) {
                 [ +  - ]
      31         [ +  - ]:          2 :   const string echo_str("Test for Echo");
      32 [ +  - ][ +  - ]:          2 :   MessageEchoReply reply;
      33 [ +  - ][ +  - ]:          2 :   service_thread call(*serv);
                 [ +  - ]
      34                 :            : 
      35 [ +  - ][ +  - ]:          1 :   call.callp<CallEchoRequest>(serv->name(), &reply, echo_str);
                 [ +  - ]
      36                 :            : 
      37 [ +  - ][ +  - ]:          1 :   BOOST_CHECK_EQUAL(reply.payload, echo_str);
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
      38 [ +  - ][ +  - ]:          4 : }