LCOV - code coverage report
Current view: top level - tests - catch_weighted_http_strings.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 389 389 100.0 %
Date: 2022-03-15 17:12:29 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2011-2022  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/edhttp
       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             : /** \file
      20             :  * \brief Verify the weighted_http_string class.
      21             :  *
      22             :  * This file implements a tests to verify that the weighted_http_string
      23             :  * class functions as expected.
      24             :  */
      25             : 
      26             : // self
      27             : //
      28             : #include    "catch_main.h"
      29             : 
      30             : 
      31             : // edhttp
      32             : //
      33             : #include    "edhttp/weighted_http_string.h"
      34             : 
      35             : 
      36          26 : CATCH_TEST_CASE("weighted_http_string", "[string]")
      37             : {
      38          48 :     CATCH_GIVEN("string \"en\"")
      39             :     {
      40           4 :         edhttp::weighted_http_string locale("en");
      41             : 
      42           4 :         CATCH_SECTION("verify object, except parts")
      43             :         {
      44             :             // no error occurred
      45             :             //
      46           1 :             CATCH_REQUIRE(locale.error_messages().empty());
      47             : 
      48             :             // original string does not change
      49             :             //
      50           1 :             CATCH_REQUIRE(locale.get_string() == "en");
      51             : 
      52             :             // get_level() with correct and wrong names
      53             :             //
      54           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::DEFAULT_LEVEL()));
      55           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::UNDEFINED_LEVEL()));
      56             : 
      57             :             // convert back to a string
      58             :             //
      59           1 :             CATCH_REQUIRE(locale.to_string() == "en");
      60             :         }
      61             : 
      62           4 :         CATCH_SECTION("verify parts")
      63             :         {
      64             :             // make sure the result is 1 part
      65             :             //
      66           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
      67           1 :             CATCH_REQUIRE(p.size() == 1);
      68             : 
      69             :             // also get the constant version
      70             :             //
      71           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
      72           1 :             CATCH_REQUIRE(pc.size() == 1);
      73             : 
      74             :             // now verify that the part is correct
      75             :             //
      76           1 :             CATCH_REQUIRE(p[0].get_name() == "en");
      77           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
      78           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
      79           1 :             CATCH_REQUIRE(p[0].to_string() == "en");
      80             :         }
      81             :     }
      82             : 
      83          48 :     CATCH_GIVEN("string \"en-US,en;q=0.8,fr-FR;q=0.5,fr;q=0.3\"")
      84             :     {
      85           6 :         edhttp::weighted_http_string locale("en-US,en;q=0.8,fr-FR;q=0.5,fr;q=0.3");
      86             : 
      87           6 :         CATCH_SECTION("verify object")
      88             :         {
      89             :             // no error occurred
      90             :             //
      91           1 :             CATCH_REQUIRE(locale.error_messages().empty());
      92             : 
      93             :             // original string does not change
      94             :             //
      95           1 :             CATCH_REQUIRE(locale.get_string() == "en-US,en;q=0.8,fr-FR;q=0.5,fr;q=0.3");
      96             : 
      97             :             // get_level() with correct and wrong names
      98             :             //
      99           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en-US"), edhttp::string_part::DEFAULT_LEVEL()));
     100           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"),    0.8f));
     101           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr-FR"), 0.5f));
     102           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"),    0.3f));
     103             : 
     104             :             // convert back to a string
     105             :             //
     106           1 :             CATCH_REQUIRE(locale.to_string() == "en-US, en; q=0.8, fr-FR; q=0.5, fr; q=0.3");
     107             :         }
     108             : 
     109           6 :         CATCH_SECTION("verify part")
     110             :         {
     111             :             // make sure the result is 4 parts
     112             :             //
     113           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     114           1 :             CATCH_REQUIRE(p.size() == 4);
     115             : 
     116             :             // also get the constant version
     117             :             //
     118           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
     119           1 :             CATCH_REQUIRE(pc.size() == 4);
     120             : 
     121             :             // now verify that the parts are correct
     122             :             //
     123           1 :             CATCH_REQUIRE(p[0].get_name() == "en-US");
     124           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     125           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     126           1 :             CATCH_REQUIRE(p[0].to_string() == "en-US");
     127             : 
     128           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     129           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), 0.8f));
     130           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     131           1 :             CATCH_REQUIRE(p[1].to_string() == "en; q=0.8");
     132             : 
     133           1 :             CATCH_REQUIRE(p[2].get_name() == "fr-FR");
     134           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), 0.5f));
     135           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     136           1 :             CATCH_REQUIRE(p[2].to_string() == "fr-FR; q=0.5");
     137             : 
     138           1 :             CATCH_REQUIRE(p[3].get_name() == "fr");
     139           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[3].get_level(), 0.3f));
     140           1 :             CATCH_REQUIRE(p[3].get_parameter("test") == "");
     141           1 :             CATCH_REQUIRE(p[3].to_string() == "fr; q=0.3");
     142             : 
     143           1 :             CATCH_REQUIRE(pc[0].get_name() == "en-US");
     144           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     145           1 :             CATCH_REQUIRE(pc[0].get_parameter("test") == "");
     146           1 :             CATCH_REQUIRE(pc[0].to_string() == "en-US");
     147             : 
     148           1 :             CATCH_REQUIRE(pc[1].get_name() == "en");
     149           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[1].get_level(), 0.8f));
     150           1 :             CATCH_REQUIRE(pc[1].get_parameter("test") == "");
     151           1 :             CATCH_REQUIRE(pc[1].to_string() == "en; q=0.8");
     152             : 
     153           1 :             CATCH_REQUIRE(pc[2].get_name() == "fr-FR");
     154           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[2].get_level(), 0.5f));
     155           1 :             CATCH_REQUIRE(pc[2].get_parameter("test") == "");
     156           1 :             CATCH_REQUIRE(pc[2].to_string() == "fr-FR; q=0.5");
     157             : 
     158           1 :             CATCH_REQUIRE(pc[3].get_name() == "fr");
     159           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[3].get_level(), 0.3f));
     160           1 :             CATCH_REQUIRE(pc[3].get_parameter("test") == "");
     161           1 :             CATCH_REQUIRE(pc[3].to_string() == "fr; q=0.3");
     162             :         }
     163             : 
     164           6 :         CATCH_SECTION("sort has no effect if weights are equal")
     165             :         {
     166           1 :             locale.sort_by_level();
     167             : 
     168             :             // make sure the result is 3 parts
     169             :             //
     170           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     171           1 :             CATCH_REQUIRE(p.size() == 4);
     172             : 
     173             :             // now verify that the parts are correct
     174             :             //
     175           1 :             CATCH_REQUIRE(p[0].get_name() == "en-US");
     176           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     177           1 :             CATCH_REQUIRE(p[2].get_name() == "fr-FR");
     178           1 :             CATCH_REQUIRE(p[3].get_name() == "fr");
     179             :         }
     180             :     }
     181             : 
     182          48 :     CATCH_GIVEN("string \"de, en, fr\"")
     183             :     {
     184           6 :         edhttp::weighted_http_string locale("de, en, fr");
     185             : 
     186           6 :         CATCH_SECTION("verify object")
     187             :         {
     188             :             // no error occurred
     189             :             //
     190           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     191             : 
     192             :             // original string does not change
     193             :             //
     194           1 :             CATCH_REQUIRE(locale.get_string() == "de, en, fr");
     195             : 
     196             :             // get_level() with correct and wrong names
     197             :             //
     198           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), edhttp::string_part::DEFAULT_LEVEL()));
     199           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::DEFAULT_LEVEL()));
     200           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::DEFAULT_LEVEL()));
     201           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("es"), edhttp::string_part::UNDEFINED_LEVEL()));
     202             : 
     203             :             // convert back to a string
     204             :             //
     205           1 :             CATCH_REQUIRE(locale.to_string() == "de, en, fr");
     206             :         }
     207             : 
     208           6 :         CATCH_SECTION("verify part")
     209             :         {
     210             :             // make sure the result is 3 parts
     211             :             //
     212           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     213           1 :             CATCH_REQUIRE(p.size() == 3);
     214             : 
     215             :             // also get the constant version
     216             :             //
     217           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
     218           1 :             CATCH_REQUIRE(pc.size() == 3);
     219             : 
     220             :             // now verify that the parts are correct
     221             :             //
     222           1 :             CATCH_REQUIRE(p[0].get_name() == "de");
     223           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     224           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     225           1 :             CATCH_REQUIRE(p[0].to_string() == "de");
     226             : 
     227           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     228           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     229           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     230           1 :             CATCH_REQUIRE(p[1].to_string() == "en");
     231             : 
     232           1 :             CATCH_REQUIRE(p[2].get_name() == "fr");
     233           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     234           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     235           1 :             CATCH_REQUIRE(p[2].to_string() == "fr");
     236             : 
     237           1 :             CATCH_REQUIRE(pc[0].get_name() == "de");
     238           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     239           1 :             CATCH_REQUIRE(pc[0].get_parameter("test") == "");
     240           1 :             CATCH_REQUIRE(pc[0].to_string() == "de");
     241             : 
     242           1 :             CATCH_REQUIRE(pc[1].get_name() == "en");
     243           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     244           1 :             CATCH_REQUIRE(pc[1].get_parameter("test") == "");
     245           1 :             CATCH_REQUIRE(pc[1].to_string() == "en");
     246             : 
     247           1 :             CATCH_REQUIRE(pc[2].get_name() == "fr");
     248           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[2].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     249           1 :             CATCH_REQUIRE(pc[2].get_parameter("test") == "");
     250           1 :             CATCH_REQUIRE(pc[2].to_string() == "fr");
     251             :         }
     252             : 
     253           6 :         CATCH_SECTION("sort has no effect if weights are equal")
     254             :         {
     255           1 :             locale.sort_by_level();
     256             : 
     257             :             // make sure the result is 3 parts
     258             :             //
     259           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     260           1 :             CATCH_REQUIRE(p.size() == 3);
     261             : 
     262             :             // now verify that the parts are correct
     263             :             //
     264           1 :             CATCH_REQUIRE(p[0].get_name() == "de");
     265           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     266           1 :             CATCH_REQUIRE(p[2].get_name() == "fr");
     267             :         }
     268             :     }
     269             : 
     270          48 :     CATCH_GIVEN("string \"fr, za, en\", names are not in alphabetical order and do not get sorted")
     271             :     {
     272           6 :         edhttp::weighted_http_string locale("fr, za, en");
     273             : 
     274           6 :         CATCH_SECTION("verify object")
     275             :         {
     276             :             // no error occurred
     277             :             //
     278           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     279             : 
     280             :             // original string does not change
     281             :             //
     282           1 :             CATCH_REQUIRE(locale.get_string() == "fr, za, en");
     283             : 
     284             :             // get_level() with correct and wrong names
     285             :             //
     286           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::DEFAULT_LEVEL()));
     287           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("za"), edhttp::string_part::DEFAULT_LEVEL()));
     288           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::DEFAULT_LEVEL()));
     289           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), edhttp::string_part::UNDEFINED_LEVEL()));
     290             : 
     291             :             // convert back to a string
     292             :             //
     293           1 :             CATCH_REQUIRE(locale.to_string() == "fr, za, en");
     294             :         }
     295             : 
     296           6 :         CATCH_SECTION("verify part")
     297             :         {
     298             :             // make sure the result is 3 parts
     299             :             //
     300           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     301           1 :             CATCH_REQUIRE(p.size() == 3);
     302             : 
     303             :             // also get the constant version
     304             :             //
     305           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
     306           1 :             CATCH_REQUIRE(pc.size() == 3);
     307             : 
     308             :             // now verify that the parts are correct
     309             :             //
     310           1 :             CATCH_REQUIRE(p[0].get_name() == "fr");
     311           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     312           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     313           1 :             CATCH_REQUIRE(p[0].to_string() == "fr");
     314             : 
     315           1 :             CATCH_REQUIRE(p[1].get_name() == "za");
     316           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     317           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     318           1 :             CATCH_REQUIRE(p[1].to_string() == "za");
     319             : 
     320           1 :             CATCH_REQUIRE(p[2].get_name() == "en");
     321           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     322           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     323           1 :             CATCH_REQUIRE(p[2].to_string() == "en");
     324             : 
     325           1 :             CATCH_REQUIRE(pc[0].get_name() == "fr");
     326           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     327           1 :             CATCH_REQUIRE(pc[0].get_parameter("test") == "");
     328           1 :             CATCH_REQUIRE(pc[0].to_string() == "fr");
     329             : 
     330           1 :             CATCH_REQUIRE(pc[1].get_name() == "za");
     331           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     332           1 :             CATCH_REQUIRE(pc[1].get_parameter("test") == "");
     333           1 :             CATCH_REQUIRE(pc[1].to_string() == "za");
     334             : 
     335           1 :             CATCH_REQUIRE(pc[2].get_name() == "en");
     336           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[2].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     337           1 :             CATCH_REQUIRE(pc[2].get_parameter("test") == "");
     338           1 :             CATCH_REQUIRE(pc[2].to_string() == "en");
     339             :         }
     340             : 
     341           6 :         CATCH_SECTION("sort has no effect if weights are equal")
     342             :         {
     343           1 :             locale.sort_by_level();
     344             : 
     345             :             // make sure the result is 3 parts
     346             :             //
     347           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     348           1 :             CATCH_REQUIRE(p.size() == 3);
     349             : 
     350             :             // now verify that the parts are correct
     351             :             //
     352           1 :             CATCH_REQUIRE(p[0].get_name() == "fr");
     353           1 :             CATCH_REQUIRE(p[1].get_name() == "za");
     354           1 :             CATCH_REQUIRE(p[2].get_name() == "en");
     355             :         }
     356             :     }
     357             : 
     358          48 :     CATCH_GIVEN("string \"fr;q=0, za; q=0.6,en; q=0.4\"")
     359             :     {
     360           6 :         edhttp::weighted_http_string locale("fr;q=0, za; q=0.6,en; q=0.4");
     361             : 
     362           6 :         CATCH_SECTION("verify object")
     363             :         {
     364             :             // no error occurred
     365             :             //
     366           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     367             : 
     368             :             // original string does not change
     369             :             //
     370           1 :             CATCH_REQUIRE(locale.get_string() == "fr;q=0, za; q=0.6,en; q=0.4");
     371             : 
     372             :             // get_level() with correct and wrong names
     373             :             //
     374           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), 0.0f));
     375           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("za"), 0.6f));
     376           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), 0.4f));
     377           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), edhttp::string_part::UNDEFINED_LEVEL()));
     378             : 
     379             :             // convert back to a string
     380             :             //
     381           1 :             CATCH_REQUIRE(locale.to_string() == "fr; q=0, za; q=0.6, en; q=0.4");
     382             :         }
     383             : 
     384           6 :         CATCH_SECTION("verify part")
     385             :         {
     386             :             // make sure the result is 3 parts
     387             :             //
     388           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     389           1 :             CATCH_REQUIRE(p.size() == 3);
     390             : 
     391             :             // also get the constant version
     392             :             //
     393           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
     394           1 :             CATCH_REQUIRE(pc.size() == 3);
     395             : 
     396             :             // now verify that the parts are correct
     397             :             //
     398           1 :             CATCH_REQUIRE(p[0].get_name() == "fr");
     399           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), 0.0f));
     400           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     401           1 :             CATCH_REQUIRE(p[0].to_string() == "fr; q=0");
     402             : 
     403           1 :             CATCH_REQUIRE(p[1].get_name() == "za");
     404           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), 0.6f));
     405           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     406           1 :             CATCH_REQUIRE(p[1].to_string() == "za; q=0.6");
     407             : 
     408           1 :             CATCH_REQUIRE(p[2].get_name() == "en");
     409           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), 0.4f));
     410           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     411           1 :             CATCH_REQUIRE(p[2].to_string() == "en; q=0.4");
     412             : 
     413           1 :             CATCH_REQUIRE(pc[0].get_name() == "fr");
     414           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[0].get_level(), 0.0f));
     415           1 :             CATCH_REQUIRE(pc[0].get_parameter("test") == "");
     416           1 :             CATCH_REQUIRE(pc[0].to_string() == "fr; q=0");
     417             : 
     418           1 :             CATCH_REQUIRE(pc[1].get_name() == "za");
     419           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[1].get_level(), 0.6f));
     420           1 :             CATCH_REQUIRE(pc[1].get_parameter("test") == "");
     421           1 :             CATCH_REQUIRE(pc[1].to_string() == "za; q=0.6");
     422             : 
     423           1 :             CATCH_REQUIRE(pc[2].get_name() == "en");
     424           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[2].get_level(), 0.4f));
     425           1 :             CATCH_REQUIRE(pc[2].get_parameter("test") == "");
     426           1 :             CATCH_REQUIRE(pc[2].to_string() == "en; q=0.4");
     427             :         }
     428             : 
     429           6 :         CATCH_SECTION("sort by level (weight)")
     430             :         {
     431           1 :             locale.sort_by_level();
     432             : 
     433             :             // make sure the result is 3 parts
     434             :             //
     435           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     436           1 :             CATCH_REQUIRE(p.size() == 3);
     437             : 
     438             :             // now verify that the parts are sorted by level
     439             :             //    "fr; q=0, za; q=0.6, en; q=0.4"
     440             :             //
     441           1 :             CATCH_REQUIRE(p[0].get_name() == "za");
     442           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     443           1 :             CATCH_REQUIRE(p[2].get_name() == "fr");
     444             : 
     445             :             // convert back to a string in the new order and with spaces
     446             :             //
     447           1 :             CATCH_REQUIRE(locale.to_string() == "za; q=0.6, en; q=0.4, fr; q=0");
     448             :         }
     449             :     }
     450             : 
     451          48 :     CATCH_GIVEN("string \"  fr;  q=0,  za;  q=0.6,  en;  q=0.4  \", with extra spaces")
     452             :     {
     453           6 :         edhttp::weighted_http_string locale("  fr;  q=0,  za;  q=0.6,  en;  q=0.4  ");
     454             : 
     455           6 :         CATCH_SECTION("verify object")
     456             :         {
     457             :             // no error occurred
     458             :             //
     459           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     460             : 
     461             :             // original string does not change
     462             :             //
     463           1 :             CATCH_REQUIRE(locale.get_string() == "  fr;  q=0,  za;  q=0.6,  en;  q=0.4  ");
     464             : 
     465             :             // get_level() with correct and wrong names
     466             :             //
     467           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), 0.0f));
     468           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("za"), 0.6f));
     469           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), 0.4f));
     470           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), -1.0f));
     471             : 
     472             :             // convert back to a string
     473             :             //
     474           1 :             CATCH_REQUIRE(locale.to_string() == "fr; q=0, za; q=0.6, en; q=0.4");
     475             :         }
     476             : 
     477           6 :         CATCH_SECTION("verify part")
     478             :         {
     479             :             // make sure the result is 3 parts
     480             :             //
     481           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     482           1 :             CATCH_REQUIRE(p.size() == 3);
     483             : 
     484             :             // also get the constant version
     485             :             //
     486           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
     487           1 :             CATCH_REQUIRE(pc.size() == 3);
     488             : 
     489             :             // now verify that the parts are correct
     490             :             //
     491           1 :             CATCH_REQUIRE(p[0].get_name() == "fr");
     492           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), 0.0f));
     493           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     494           1 :             CATCH_REQUIRE(p[0].to_string() == "fr; q=0");
     495             : 
     496           1 :             CATCH_REQUIRE(p[1].get_name() == "za");
     497           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), 0.6f));
     498           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     499           1 :             CATCH_REQUIRE(p[1].to_string() == "za; q=0.6");
     500             : 
     501           1 :             CATCH_REQUIRE(p[2].get_name() == "en");
     502           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), 0.4f));
     503           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     504           1 :             CATCH_REQUIRE(p[2].to_string() == "en; q=0.4");
     505             : 
     506           1 :             CATCH_REQUIRE(pc[0].get_name() == "fr");
     507           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[0].get_level(), 0.0f));
     508           1 :             CATCH_REQUIRE(pc[0].get_parameter("test") == "");
     509           1 :             CATCH_REQUIRE(pc[0].to_string() == "fr; q=0");
     510             : 
     511           1 :             CATCH_REQUIRE(pc[1].get_name() == "za");
     512           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[1].get_level(), 0.6f));
     513           1 :             CATCH_REQUIRE(pc[1].get_parameter("test") == "");
     514           1 :             CATCH_REQUIRE(pc[1].to_string() == "za; q=0.6");
     515             : 
     516           1 :             CATCH_REQUIRE(pc[2].get_name() == "en");
     517           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[2].get_level(), 0.4f));
     518           1 :             CATCH_REQUIRE(pc[2].get_parameter("test") == "");
     519           1 :             CATCH_REQUIRE(pc[2].to_string() == "en; q=0.4");
     520             :         }
     521             : 
     522           6 :         CATCH_SECTION("sort by level (weight)")
     523             :         {
     524           1 :             locale.sort_by_level();
     525             : 
     526             :             // make sure the result is 3 parts
     527             :             //
     528           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     529           1 :             CATCH_REQUIRE(p.size() == 3);
     530             : 
     531             :             // now verify that the parts are sorted by level
     532             :             //
     533           1 :             CATCH_REQUIRE(p[0].get_name() == "za");
     534           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     535           1 :             CATCH_REQUIRE(p[2].get_name() == "fr");
     536             :         }
     537             :     }
     538             : 
     539          48 :     CATCH_GIVEN("string \"  fr;  q=0,  za,  en;  q=0.4  ,es;q=1.0\", with extra spaces")
     540             :     {
     541           6 :         edhttp::weighted_http_string locale("  fr;  q=0,  za,  en;  q=0.4  ,es;q=1.0");
     542             : 
     543           6 :         CATCH_SECTION("verify object")
     544             :         {
     545             :             // no error occurred
     546             :             //
     547           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     548             : 
     549             :             // original string does not change
     550             :             //
     551           1 :             CATCH_REQUIRE(locale.get_string() == "  fr;  q=0,  za,  en;  q=0.4  ,es;q=1.0");
     552             : 
     553             :             // get_level() with correct and wrong names
     554             :             //
     555           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), 0.0f));
     556           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("za"), edhttp::string_part::DEFAULT_LEVEL()));
     557           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), 0.4f));
     558           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("es"), 1.0f));
     559           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), -1.0f));
     560             : 
     561             :             // convert back to a string
     562             :             //
     563           1 :             CATCH_REQUIRE(locale.to_string() == "fr; q=0, za, en; q=0.4, es; q=1.0");
     564             :         }
     565             : 
     566           6 :         CATCH_SECTION("verify part")
     567             :         {
     568             :             // make sure the result is 3 parts
     569             :             //
     570           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     571           1 :             CATCH_REQUIRE(p.size() == 4);
     572             : 
     573             :             // also get the constant version
     574             :             //
     575           1 :             edhttp::string_part::vector_t const & pc(locale.get_parts());
     576           1 :             CATCH_REQUIRE(pc.size() == 4);
     577             : 
     578             :             // now verify that the parts are correct
     579             :             //
     580           1 :             CATCH_REQUIRE(p[0].get_name() == "fr");
     581           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), 0.0f));
     582           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     583           1 :             CATCH_REQUIRE(p[0].to_string() == "fr; q=0");
     584             : 
     585           1 :             CATCH_REQUIRE(p[1].get_name() == "za");
     586           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     587           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     588           1 :             CATCH_REQUIRE(p[1].to_string() == "za");
     589             : 
     590           1 :             CATCH_REQUIRE(p[2].get_name() == "en");
     591           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), 0.4f));
     592           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     593           1 :             CATCH_REQUIRE(p[2].to_string() == "en; q=0.4");
     594             : 
     595           1 :             CATCH_REQUIRE(p[3].get_name() == "es");
     596           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[3].get_level(), 1.0f));
     597           1 :             CATCH_REQUIRE(p[3].get_parameter("test") == "");
     598           1 :             CATCH_REQUIRE(p[3].to_string() == "es; q=1.0");
     599             : 
     600           1 :             CATCH_REQUIRE(pc[0].get_name() == "fr");
     601           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[0].get_level(), 0.0f));
     602           1 :             CATCH_REQUIRE(pc[0].get_parameter("test") == "");
     603           1 :             CATCH_REQUIRE(pc[0].to_string() == "fr; q=0");
     604             : 
     605           1 :             CATCH_REQUIRE(pc[1].get_name() == "za");
     606           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     607           1 :             CATCH_REQUIRE(pc[1].get_parameter("test") == "");
     608           1 :             CATCH_REQUIRE(pc[1].to_string() == "za");
     609             : 
     610           1 :             CATCH_REQUIRE(pc[2].get_name() == "en");
     611           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(pc[2].get_level(), 0.4f));
     612           1 :             CATCH_REQUIRE(pc[2].get_parameter("test") == "");
     613           1 :             CATCH_REQUIRE(pc[2].to_string() == "en; q=0.4");
     614             : 
     615           1 :             CATCH_REQUIRE(p[3].get_name() == "es");
     616           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[3].get_level(), 1.0f));
     617           1 :             CATCH_REQUIRE(p[3].get_parameter("test") == "");
     618           1 :             CATCH_REQUIRE(p[3].to_string() == "es; q=1.0");
     619             :         }
     620             : 
     621           6 :         CATCH_SECTION("sort by level (weight)")
     622             :         {
     623           1 :             locale.sort_by_level();
     624             : 
     625             :             // make sure the result is 3 parts
     626             :             //
     627           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     628           1 :             CATCH_REQUIRE(p.size() == 4);
     629             : 
     630             :             // now verify that the parts are sorted by level
     631             :             //
     632           1 :             CATCH_REQUIRE(p[0].get_name() == "za");
     633           1 :             CATCH_REQUIRE(p[1].get_name() == "es");
     634           1 :             CATCH_REQUIRE(p[2].get_name() == "en");
     635           1 :             CATCH_REQUIRE(p[3].get_name() == "fr");
     636             :         }
     637             :     }
     638             : 
     639          48 :     CATCH_GIVEN("string \"de\", then \"en\", then \"fr\"")
     640             :     {
     641           8 :         edhttp::weighted_http_string locale("de");
     642             : 
     643           8 :         CATCH_SECTION("verify object")
     644             :         {
     645             :             // no error occurred
     646             :             //
     647           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     648             : 
     649             :             // original string does not change
     650             :             //
     651           1 :             CATCH_REQUIRE(locale.get_string() == "de");
     652             : 
     653             :             // get_level() with correct and wrong names
     654             :             //
     655           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), edhttp::string_part::DEFAULT_LEVEL()));
     656           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::UNDEFINED_LEVEL()));
     657           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::UNDEFINED_LEVEL()));
     658           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("es"), edhttp::string_part::UNDEFINED_LEVEL()));
     659             : 
     660             :             // convert back to a string
     661             :             //
     662           1 :             CATCH_REQUIRE(locale.to_string() == "de");
     663             : 
     664             :             // make sure the result is 1 part
     665             :             //
     666           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     667           1 :             CATCH_REQUIRE(p.size() == 1);
     668             : 
     669             :             // now verify that the parts are correct
     670             :             //
     671           1 :             CATCH_REQUIRE(p[0].get_name() == "de");
     672           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     673           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     674           1 :             CATCH_REQUIRE(p[0].to_string() == "de");
     675             :         }
     676             : 
     677           8 :         CATCH_SECTION("add \"en\"")
     678             :         {
     679             :             // the parse is expected to work (return true)
     680             :             //
     681           1 :             CATCH_REQUIRE(locale.parse("en"));
     682             : 
     683             :             // no error occurred
     684             :             //
     685           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     686             : 
     687             :             // original string does not change
     688             :             //
     689           1 :             CATCH_REQUIRE(locale.get_string() == "de,en");
     690             : 
     691             :             // get_level() with correct and wrong names
     692             :             //
     693           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), edhttp::string_part::DEFAULT_LEVEL()));
     694           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::DEFAULT_LEVEL()));
     695           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::UNDEFINED_LEVEL()));
     696           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("es"), edhttp::string_part::UNDEFINED_LEVEL()));
     697             : 
     698             :             // convert back to a string
     699             :             //
     700           1 :             CATCH_REQUIRE(locale.to_string() == "de, en");
     701             : 
     702             :             // make sure the result is 2 parts
     703             :             //
     704           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     705           1 :             CATCH_REQUIRE(p.size() == 2);
     706             : 
     707             :             // now verify that the parts are correct
     708             :             //
     709           1 :             CATCH_REQUIRE(p[0].get_name() == "de");
     710           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     711           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     712           1 :             CATCH_REQUIRE(p[0].to_string() == "de");
     713             : 
     714           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     715           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     716           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     717           1 :             CATCH_REQUIRE(p[1].to_string() == "en");
     718             :         }
     719             : 
     720           8 :         CATCH_SECTION("add \"en\" and then \"fr\"")
     721             :         {
     722             :             // the parse is expected to work (return true)
     723             :             //
     724           1 :             CATCH_REQUIRE(locale.parse("en"));
     725           1 :             CATCH_REQUIRE(locale.parse("fr"));
     726             : 
     727             :             // no error occurred
     728             :             //
     729           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     730             : 
     731             :             // original string does not change
     732             :             //
     733           1 :             CATCH_REQUIRE(locale.get_string() == "de,en,fr");
     734             : 
     735             :             // get_level() with correct and wrong names
     736             :             //
     737           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("de"), edhttp::string_part::DEFAULT_LEVEL()));
     738           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::DEFAULT_LEVEL()));
     739           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::DEFAULT_LEVEL()));
     740           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("es"), edhttp::string_part::UNDEFINED_LEVEL()));
     741             : 
     742             :             // convert back to a string
     743             :             //
     744           1 :             CATCH_REQUIRE(locale.to_string() == "de, en, fr");
     745             : 
     746             :             // make sure the result is 3 parts
     747             :             //
     748           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     749           1 :             CATCH_REQUIRE(p.size() == 3);
     750             : 
     751             :             // now verify that the parts are correct
     752             :             //
     753           1 :             CATCH_REQUIRE(p[0].get_name() == "de");
     754           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     755           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     756           1 :             CATCH_REQUIRE(p[0].to_string() == "de");
     757             : 
     758           1 :             CATCH_REQUIRE(p[1].get_name() == "en");
     759           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[1].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     760           1 :             CATCH_REQUIRE(p[1].get_parameter("test") == "");
     761           1 :             CATCH_REQUIRE(p[1].to_string() == "en");
     762             : 
     763           1 :             CATCH_REQUIRE(p[2].get_name() == "fr");
     764           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[2].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     765           1 :             CATCH_REQUIRE(p[2].get_parameter("test") == "");
     766           1 :             CATCH_REQUIRE(p[2].to_string() == "fr");
     767             :         }
     768             : 
     769           8 :         CATCH_SECTION("replace with \"mo\"")
     770             :         {
     771             :             // the parse is expected to work (return true)
     772             :             //
     773           1 :             CATCH_REQUIRE(locale.parse("mo", true));
     774             : 
     775             :             // no error occurred
     776             :             //
     777           1 :             CATCH_REQUIRE(locale.error_messages().empty());
     778             : 
     779             :             // original string does not change
     780             :             //
     781           1 :             CATCH_REQUIRE(locale.get_string() == "mo");
     782             : 
     783             :             // get_level() with correct and wrong names
     784             :             //
     785           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("mo"), edhttp::string_part::DEFAULT_LEVEL()));
     786           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("en"), edhttp::string_part::UNDEFINED_LEVEL()));
     787           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("fr"), edhttp::string_part::UNDEFINED_LEVEL()));
     788           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(locale.get_level("es"), edhttp::string_part::UNDEFINED_LEVEL()));
     789             : 
     790             :             // convert back to a string
     791             :             //
     792           1 :             CATCH_REQUIRE(locale.to_string() == "mo");
     793             : 
     794             :             // make sure the result is 1 part
     795             :             //
     796           1 :             edhttp::string_part::vector_t & p(locale.get_parts());
     797           1 :             CATCH_REQUIRE(p.size() == 1);
     798             : 
     799             :             // now verify that the parts are correct
     800             :             //
     801           1 :             CATCH_REQUIRE(p[0].get_name() == "mo");
     802           1 :             CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(p[0].get_level(), edhttp::string_part::DEFAULT_LEVEL()));
     803           1 :             CATCH_REQUIRE(p[0].get_parameter("test") == "");
     804           1 :             CATCH_REQUIRE(p[0].to_string() == "mo");
     805             :         }
     806             :     }
     807          30 : }
     808             : 
     809             : 
     810             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.13