LCOV - code coverage report
Current view: top level - tests - catch_options.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 18 18 100.0 %
Date: 2023-07-29 22:00:24 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2011-2023  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/as2js
       4             : // contact@m2osw.com
       5             : //
       6             : // This program is free software: you can redistribute it and/or modify
       7             : // it under the terms of the GNU General Public License as published by
       8             : // the Free Software Foundation, either version 3 of the License, or
       9             : // (at your option) any later version.
      10             : //
      11             : // This program is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : // GNU General Public License for more details.
      15             : //
      16             : // You should have received a copy of the GNU General Public License
      17             : // along with this program.  If not, see <https://www.gnu.org/licenses/>.
      18             : 
      19             : // as2js
      20             : //
      21             : #include    <as2js/options.h>
      22             : 
      23             : 
      24             : // self
      25             : //
      26             : #include    "catch_main.h"
      27             : 
      28             : 
      29             : // last include
      30             : //
      31             : #include    <snapdev/poison.h>
      32             : 
      33             : 
      34             : 
      35             : 
      36             : 
      37             : 
      38           1 : CATCH_TEST_CASE("options", "[options]")
      39             : {
      40           1 :     CATCH_START_SECTION("options: verify options")
      41             :     {
      42           1 :         as2js::options::pointer_t opt(std::make_shared<as2js::options>());
      43             : 
      44             :         // verify that all options are set to zero by default
      45             :         //
      46           1 :         for(as2js::option_t o(as2js::option_t::OPTION_UNKNOWN);
      47          14 :                             o < as2js::option_t::OPTION_max;
      48          13 :                             o = static_cast<as2js::option_t>(static_cast<int>(o) + 1))
      49             :         {
      50          13 :             CATCH_REQUIRE(opt->get_option(o) == 0);
      51             :         }
      52             : 
      53           1 :         for(as2js::option_t o(as2js::option_t::OPTION_UNKNOWN);
      54          14 :                             o < as2js::option_t::OPTION_max;
      55          13 :                             o = static_cast<as2js::option_t>(static_cast<int>(o) + 1))
      56             :         {
      57        1313 :             for(int i(0); i < 100; ++i)
      58             :             {
      59        1300 :                 std::int64_t value(0);
      60        1300 :                 SNAP_CATCH2_NAMESPACE::random(value);
      61        1300 :                 opt->set_option(o, value);
      62        1300 :                 CATCH_REQUIRE(opt->get_option(o) == value);
      63             :             }
      64             :         }
      65           1 :     }
      66           1 :     CATCH_END_SECTION()
      67           1 : }
      68             : 
      69             : 
      70             : 
      71             : 
      72             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.14