Web Wispers 1.2.2 C++ Unit Test Coverage
Current view: top level - tests/wispers/fcgi - URITest.cc (source / functions) Hit Total Coverage
Test: Web Wispers 1.2.2 C++ Unit Tests Lines: 11 11 100.0 %
Date: 2012-04-09 Functions: 4 4 100.0 %
Branches: 64 128 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                 :            :  *     https://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/wispers/fcgi/URI.h>
      17                 :            : 
      18                 :            : #define BOOST_TEST_MODULE URITest
      19                 :            : #include <boost/test/unit_test.hpp>
      20                 :            : 
      21                 :            : using namespace NS_SSRC_WSPR_FCGI;
      22                 :            : 
      23   [ +  -  +  - ]:          3 : BOOST_AUTO_TEST_CASE(test_uri) {
      24                 :          1 :   const char *uri_str = "http://www.ics.uci.edu/pub/ietf/uri/q?bar=foo&foo=bar#Related";
      25   [ +  -  +  -  :          2 :   const URI uri(uri_str);
                   +  - ]
      26                 :            : 
      27   [ +  -  +  -  :          1 :   BOOST_CHECK(uri.absolute());
          +  -  +  -  +  
          -  +  -  +  -  
             +  -  -  + ]
      28   [ +  -  +  -  :          1 :   BOOST_CHECK_EQUAL(uri.uri(), uri_str);
          +  -  +  -  +  
          -  +  -  +  -  
                   -  + ]
      29   [ +  -  +  -  :          1 :   BOOST_CHECK_EQUAL(uri.scheme(), "http");
          +  -  +  -  +  
          -  +  -  +  -  
                   -  + ]
      30   [ +  -  +  -  :          1 :   BOOST_CHECK_EQUAL(uri.authority(), "www.ics.uci.edu");
          +  -  +  -  +  
          -  +  -  +  -  
                   -  + ]
      31   [ +  -  +  -  :          1 :   BOOST_CHECK_EQUAL(uri.path(), "/pub/ietf/uri/q");
          +  -  +  -  +  
          -  +  -  +  -  
                   -  + ]
      32   [ +  -  +  -  :          1 :   BOOST_CHECK_EQUAL(uri.query(), "bar=foo&foo=bar");
          +  -  +  -  +  
          -  +  -  +  -  
                   -  + ]
      33   [ +  -  +  -  :          1 :   BOOST_CHECK_EQUAL(uri.fragment(), "Related");
          +  -  +  -  +  
          -  +  -  +  -  
                   -  + ]
      34   [ +  -  +  - ]:          4 : }