LCOV - code coverage report
Current view: top level - tests - catch_demangle.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 13 13 100.0 %
Date: 2021-08-28 17:55:24 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2012-2021  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/libexcept
       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 2 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 along
      17             : // with this program; if not, write to the Free Software Foundation, Inc.,
      18             : // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      19             : 
      20             : // self
      21             : //
      22             : #include    "catch_main.h"
      23             : 
      24             : 
      25             : // eventdispatcher lib
      26             : //
      27             : #include    <libexcept/exception.h>
      28             : #include    <libexcept/demangle.h>
      29             : 
      30             : 
      31             : // C lib
      32             : //
      33             : //#include    <unistd.h>
      34             : 
      35             : 
      36             : namespace
      37             : {
      38             : 
      39             : 
      40             : class object
      41             : {
      42             : public:
      43           1 :     object(int count)
      44           1 :         : f_count(count)
      45             :     {
      46           1 :     }
      47             : 
      48           1 :     std::string demangle1()
      49             :     {
      50           1 :         return libexcept::demangle_cpp_name(typeid(std::string (*)()).name());
      51             :     }
      52             : 
      53           1 :     std::string demangle2()
      54             :     {
      55           1 :         return libexcept::demangle_cpp_name(typeid(long (*)(std::string const & filename, bool temporary, short int power)).name());
      56             :     }
      57             : 
      58             : private:
      59             :     int     f_count = 0;
      60             : };
      61             : 
      62             : 
      63             : 
      64             : }
      65             : 
      66             : 
      67           3 : CATCH_TEST_CASE("demangle", "[demangle]")
      68             : {
      69           2 :     CATCH_START_SECTION("demangle")
      70             :     {
      71           1 :         object o(5);
      72             : 
      73           1 :         CATCH_CHECK(o.demangle1() == "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (*)()");
      74           1 :         CATCH_CHECK(o.demangle2() == "long (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, short)");
      75             :     }
      76             :     CATCH_END_SECTION()
      77           7 : }
      78             : 
      79             : 
      80             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.13