LCOV - code coverage report
Current view: top level - bes/test - bes_io_test.cpp (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 39 39 100.0 %
Date: 2019-06-26 00:32:26 Functions: 7 7 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 bes_io_test.cpp
      10             : /// \brief Some io tests for boolean equation systems.
      11             : 
      12             : #include <sstream>
      13             : #include <string>
      14             : #include <boost/test/minimal.hpp>
      15             : #include "mcrl2/bes/boolean_equation_system.h"
      16             : #include "mcrl2/bes/io.h"
      17             : #include "mcrl2/bes/parse.h"
      18             : #include "mcrl2/bes/print.h"
      19             : #include "mcrl2/pbes/pbes.h"
      20             : #include "mcrl2/bes/pbesinst_conversion.h"
      21             : 
      22             : using namespace mcrl2;
      23             : using namespace mcrl2::bes;
      24             : 
      25           1 : std::string bes1 =
      26             :   "pbes              \n"
      27             :   "                  \n"
      28             :   "nu X1 = X2 && X1; \n"
      29             :   "mu X2 = X1 || X2; \n"
      30             :   "                  \n"
      31             :   "init X1;          \n"
      32             :   ;
      33             : 
      34           1 : void test_parse_bes()
      35             : {
      36           2 :   boolean_equation_system b;
      37           2 :   std::stringstream from(bes1);
      38           1 :   from >> b;
      39           1 :   std::cout << "b = \n" << bes::pp(b) << std::endl;
      40             : 
      41             :   // check if the pretty printed BES can be parsed again
      42           2 :   std::string bes2 = bes::pp(b);
      43           2 :   std::stringstream from2(bes1);
      44           1 :   from2 >> b;
      45             : 
      46           1 : }
      47             : 
      48           1 : void test_bes()
      49             : {
      50           2 :   boolean_equation_system b;
      51           2 :   std::stringstream bes_stream(bes1);
      52           1 :   bes_stream >> b;
      53             : 
      54           2 :   std::stringstream out;
      55           1 :   bes::save_bes(b, out, bes_format_internal());
      56           1 : }
      57             : 
      58           1 : void test_pbes()
      59             : {
      60           2 :   pbes_system::pbes b;
      61           2 :   std::stringstream bes_stream(bes1);
      62           1 :   bes_stream >> b;
      63             : 
      64           2 :   std::stringstream out;
      65           1 :   bes::save_pbes(b, out, bes_format_internal());
      66           1 : }
      67             : 
      68           1 : void test_pgsolver()
      69             : {
      70           2 :   boolean_equation_system b;
      71           2 :   std::stringstream bes_stream(bes1);
      72           1 :   bes_stream >> b;
      73             : 
      74           2 :   std::stringstream out;
      75           1 :   bes::save_bes_pgsolver(b, out);
      76             : 
      77           1 :   std::clog << out.str() << std::endl;
      78           1 : }
      79             : 
      80           1 : int test_main(int argc, char* argv[])
      81             : {
      82           1 :   test_parse_bes();
      83           1 :   test_bes();
      84           1 :   test_pbes();
      85           1 :   test_pgsolver();
      86             : 
      87           1 :   return 0;
      88           3 : }

Generated by: LCOV version 1.12