LCOV - code coverage report
Current view: top level - tests - catch_main.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 7 7
Test Date: 2025-08-03 08:53:08 Functions: 100.0 % 1 1
Legend: Lines: hit not hit

            Line data    Source code
       1              : // Copyright (c) 2006-2025  Made to Order Software Corp.  All Rights Reserved
       2              : //
       3              : // https://snapwebsites.org/project/libutf8
       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              : #pragma once
      19              : 
      20              : // libutf8
      21              : //
      22              : #include    <libutf8/libutf8.h>     // for the ostream
      23              : 
      24              : 
      25              : // catch2
      26              : //
      27              : #include    <catch2/snapcatch2.hpp>
      28              : 
      29              : 
      30              : // C++
      31              : //
      32              : #include    <string>
      33              : #include    <cstring>
      34              : #include    <cstdlib>
      35              : #include    <iostream>
      36              : 
      37              : 
      38              : // last include
      39              : //
      40              : #include    <snapdev/poison.h>
      41              : 
      42              : 
      43              : 
      44              : namespace SNAP_CATCH2_NAMESPACE
      45              : {
      46              : 
      47              : 
      48              : 
      49              : 
      50      2098472 : inline char32_t rand_char(bool full_range = false)
      51              : {
      52      2098472 :     char32_t const max((full_range ? 0x0110000 : 0x0010000) - (0xE000 - 0xD800));
      53              : 
      54              :     char32_t wc;
      55              :     do
      56              :     {
      57      2098503 :         wc = ((rand() << 16) ^ rand()) % max;
      58              :     }
      59      2098503 :     while(wc == 0);
      60      2098472 :     if(wc >= 0xD800)
      61              :     {
      62              :         // skip the surrogates
      63              :         //
      64       272891 :         wc += 0xE000 - 0xD800;
      65              :     }
      66              : 
      67      2098472 :     return wc;
      68              : }
      69              : 
      70              : 
      71              : 
      72              : }
      73              : // unittest namespace
      74              : // vim: ts=4 sw=4 et
        

Generated by: LCOV version 2.0-1

Snap C++ | List of projects | List of versions