LCOV - code coverage report
Current view: top level - core/test - print_test.cpp (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 14 14 100.0 %
Date: 2024-04-19 03:43:27 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): Wieger Wesselink
       2             : // Copyright: see the accompanying file COPYING or copy at
       3             : // https://github.com/mCRL2org/mCRL2/blob/master/COPYING
       4             : //
       5             : // Distributed under the Boost Software License, Version 1.0.
       6             : // (See accompanying file LICENSE_1_0.txt or copy at
       7             : // http://www.boost.org/LICENSE_1_0.txt)
       8             : //
       9             : /// \file print_test.cpp
      10             : /// \brief Add your file description here.
      11             : 
      12             : #define BOOST_TEST_MODULE print_test
      13             : 
      14             : #include <boost/test/included/unit_test.hpp>
      15             : #include "mcrl2/core/print.h"
      16             : 
      17             : using namespace mcrl2;
      18             : 
      19           1 : void test_print()
      20             : {
      21             :   // print directly using core::detail::printer
      22           1 :   std::ostringstream out1;
      23           1 :   core::detail::apply_printer<core::detail::printer> printer(out1);
      24           2 :   core::identifier_string s("abc");
      25           1 :   printer.apply(s);
      26           1 :   BOOST_CHECK(out1.str() == "abc");
      27             : 
      28             :   // print using the one argument function print
      29           1 :   std::ostringstream out2;
      30           1 :   core::stream_printer()(s, out2);
      31           1 :   BOOST_CHECK(out2.str() == "abc");
      32             : 
      33             :   // print using the two argument function print
      34           1 :   BOOST_CHECK(core::pp(s) == "abc");
      35             : 
      36           1 : }
      37             : 
      38           2 : BOOST_AUTO_TEST_CASE(test_main)
      39             : {
      40           1 :   test_print();
      41           1 : }

Generated by: LCOV version 1.14