LCOV - code coverage report
Current view: top level - source - ForBESUtils.cpp (source / functions) Hit Total Coverage
Test: LibForBES Unit Tests Lines: 7 10 70.0 %
Date: 2016-04-18 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* 
       2             :  * File:   ForBESUtils.cpp
       3             :  * Author: Pantelis Sopasakis
       4             :  * 
       5             :  * Created on July 24, 2015, 5:17 PM
       6             :  * 
       7             :  * ForBES is free software: you can redistribute it and/or modify
       8             :  * it under the terms of the GNU Lesser General Public License as published by
       9             :  * the Free Software Foundation, either version 3 of the License, or
      10             :  * (at your option) any later version.
      11             :  *  
      12             :  * ForBES is distributed in the hope that it will be useful,
      13             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      15             :  * GNU Lesser General Public License for more details.
      16             :  * 
      17             :  * You should have received a copy of the GNU Lesser General Public License
      18             :  * along with ForBES. If not, see <http://www.gnu.org/licenses/>.
      19             :  */
      20             : 
      21             : 
      22             : 
      23             : #include "ForBESUtils.h"
      24             : 
      25             : /*
      26             :  * Status codes 0~100    are informative
      27             :  *              200~400  are warnings
      28             :  *              500~1000 are errors
      29             :  */
      30             : 
      31             : const int ForBESUtils::STATUS_OK = 0;
      32             : const int ForBESUtils::STATUS_HAD_TO_REALLOC = 1;
      33             : 
      34             : const int ForBESUtils::STATUS_NUMERICAL_PROBLEMS = 500;
      35             : const int ForBESUtils::STATUS_UNDEFINED_FUNCTION = 501;
      36             : const int ForBESUtils::STATUS_MAX_ITERATIONS_REACHED = 502;
      37             : 
      38      116945 : void ForBESUtils::fail_on_error(int status) {
      39      116945 :     if (is_status_error(status)) {
      40           0 :         throw std::logic_error("Failed");
      41             :     }
      42      116945 : }
      43             : 
      44      170272 : bool ForBESUtils::is_status_error(int status) {
      45      170272 :     return (status >= _FORBES_ERROR_MIN && status <= _FORBES_ERROR_MAX);
      46             : }
      47             : 
      48      245059 : bool ForBESUtils::is_status_ok(int status) {
      49      245059 :     return (status >= _FORBES_OK_MIN && status <= _FORBES_OK_MAX);
      50             : }
      51             : 
      52           0 : bool ForBESUtils::is_status_warning(int status) {
      53           0 :     return (status >= _FORBES_WARNING_MIN && status <= _FORBES_WARNING_MAX);
      54             : }
      55             : 
      56             : 
      57             : 
      58             : 
      59             : 
      60             : 
      61             : 
      62             : 

Generated by: LCOV version 1.10