Web Wispers 1.2.2 C++ Unit Test Coverage
Current view: top level - tests/wispers/utility - TimerTest.cc (source / functions) Hit Total Coverage
Test: Web Wispers 1.2.2 C++ Unit Tests Lines: 7 7 100.0 %
Date: 2012-04-09 Functions: 4 4 100.0 %
Branches: 6 12 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* Copyright 2006-2009 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 <unistd.h>
      17                 :            : 
      18                 :            : #include <ssrc/wispers/utility/Timer.h>
      19                 :            : 
      20                 :            : #define BOOST_TEST_MODULE TimerTest
      21                 :            : #include <boost/test/unit_test.hpp>
      22                 :            : 
      23                 :            : using namespace NS_SSRC_WSPR_UTILITY;
      24                 :            : 
      25   [ +  -  +  - ]:          3 : BOOST_AUTO_TEST_CASE(test_timer) {
      26                 :          1 :   Timer timer;
      27                 :          1 :   timer.start();
      28                 :          1 :   sleep(2);
      29                 :          1 :   timer.stop();
      30   [ +  -  -  + ]:          1 :   BOOST_CHECK_GT(timer.elapsed().seconds(), 0);
      31   [ +  -  +  - ]:          4 : }