LCOV - code coverage report
Current view: top level - tests - test5.cpp (source / functions) Hit Total Coverage
Test: wlog-coverage.info Lines: 20 26 76.9 %
Date: 2019-09-12 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include <wlog/init.hpp>
       2             : #include <wlog/load.hpp>
       3             : #include <iostream>
       4             : 
       5           1 : int main(int argc, char* argv[])
       6             : {
       7           1 :   std::string jsonsrc;
       8           2 :   wlog::logger_options options;
       9           1 :   if ( argc == 1 )
      10             :   {
      11           1 :     wlog::custom_logger_options custom;
      12           1 :     custom.names.push_back("FATAL");
      13           1 :     custom.names.push_back("ERROR");
      14           1 :     custom.path="$";
      15           1 :     options.customize.push_back(custom);
      16           1 :     options.finalize();
      17           1 :     jsonsrc = wlog::dump(options);
      18           1 :     std::cout << jsonsrc << std::endl;
      19           1 :     options = wlog::logger_options();
      20             :   }
      21             :   else
      22             :   {
      23           0 :     jsonsrc = argv[1];
      24             :   }
      25             : 
      26           1 :   if ( !wlog::load(jsonsrc, &options, nullptr) )
      27           0 :     return 1;
      28             : 
      29           1 :   if ( options.get_customize("UNKNOWN") != nullptr )
      30           0 :     return 2;
      31             : 
      32           1 :   if ( auto pcustom = options.get_customize("FATAL") )
      33             :   {
      34           1 :     if ( pcustom->names.size() != 1 )
      35           0 :       return 4;
      36             : 
      37           1 :     if ( pcustom->names[0]!="FATAL" )
      38           0 :       return 5;
      39             :   }
      40             :   else
      41           0 :     return 3;
      42             : 
      43           2 :   return 0;
      44           3 : }

Generated by: LCOV version 1.10