Web Wispers 1.2.1 C++ Unit Test Coverage
Current view: top level - tests/wispers/utility - TimerTest.cc (source / functions) Hit Total Coverage
Test: Web Wispers 1.2.1 C++ Unit Tests Lines: 13 13 100.0 %
Date: 2011-11-11 Functions: 11 12 91.7 %
Branches: 42 88 47.7 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright 2006-2009 Savarese Software Research Corporation
       3                 :            :  *
       4                 :            :  * Licensed under the Apache License, Version 2.0 (the "License");
       5                 :            :  * you may not use this file except in compliance with the License.
       6                 :            :  * You may obtain a copy of the License at
       7                 :            :  *
       8                 :            :  *     http://www.savarese.com/software/ApacheLicense-2.0
       9                 :            :  *
      10                 :            :  * Unless required by applicable law or agreed to in writing, software
      11                 :            :  * distributed under the License is distributed on an "AS IS" BASIS,
      12                 :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13                 :            :  * See the License for the specific language governing permissions and
      14                 :            :  * limitations under the License.
      15                 :            :  */
      16                 :            : 
      17                 :            : #include <unistd.h>
      18                 :            : 
      19                 :            : #include <tests/TestCommon.h>
      20                 :            : #include <ssrc/wispers/utility/Timer.h>
      21                 :            : 
      22                 :            : using namespace NS_SSRC_WSPR_UTILITY;
      23                 :            : 
      24         [ -  + ]:          3 : struct TimerTest : public TestCase {
      25                 :          1 :   void test_timer() {
      26                 :          1 :     Timer timer;
      27                 :          1 :     timer.start();
      28                 :          1 :     sleep(2);
      29                 :          1 :     timer.stop();
      30   [ +  -  +  -  :          1 :     CPPUNIT_ASSERT(timer.elapsed().seconds() > 0);
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
             -  +  -  +  
                      - ]
      31                 :          1 :   }
      32                 :            : 
      33   [ +  -  +  -  :          4 :   CPPUNIT_TEST_SUITE(TimerTest);
             +  -  #  # ]
      34   [ +  -  +  -  :          1 :   CPPUNIT_TEST(test_timer);
          +  -  +  -  +  
          -  +  -  +  -  
                   +  - ]
      35   [ +  -  +  -  :          2 :   CPPUNIT_TEST_SUITE_END();
          +  -  +  -  +  
                -  +  - ]
      36                 :            : };
      37                 :            : 
      38   [ -  +  #  # ]:          1 : CPPUNIT_TEST_SUITE_REGISTRATION(TimerTest);
      39   [ +  -  +  -  :          4 : WISP_TEST_MAIN()
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
                -  +  - ]