LCOV - code coverage report
Current view: top level - bes/test - solve_test.cpp (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 21 21 100.0 %
Date: 2019-09-14 00:54:39 Functions: 9 9 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 solve_test.cpp
      10             : /// \brief Test for BES solvers.
      11             : 
      12             : #define BOOST_TEST_MODULE solve_test
      13             : #include "mcrl2/bes/gauss_elimination.h"
      14             : #include "mcrl2/bes/parse.h"
      15             : #include "mcrl2/bes/print.h"
      16             : #include "mcrl2/bes/small_progress_measures.h"
      17             : #include <boost/test/included/unit_test_framework.hpp>
      18             : #include <sstream>
      19             : #include <string>
      20             : 
      21             : using namespace mcrl2;
      22             : using namespace mcrl2::bes;
      23             : 
      24           3 : void run_all_algorithms(std::string const& b, bool expected_outcome)
      25             : {
      26           6 :   boolean_equation_system b1;
      27           6 :   std::stringstream from;
      28           3 :   from << "pbes\n" << b << std::endl;
      29           3 :   from >> b1;
      30             : 
      31           3 :   std::clog << "solving the following input bes: \n" << bes::pp(b1) << std::endl;
      32             : 
      33           3 :   BOOST_CHECK_EQUAL(small_progress_measures(b1), expected_outcome);
      34           3 :   BOOST_CHECK_EQUAL(gauss_elimination(b1), expected_outcome);
      35           3 : }
      36             : 
      37           3 : BOOST_AUTO_TEST_CASE(test_simple_nu_mu)
      38             : {
      39             :   std::string b(
      40             :     "mu X1 = X2;\n"
      41             :     "nu X2 = X1;\n"
      42             :     "init X1;\n"
      43           2 :   );
      44           1 :   run_all_algorithms(b, false);
      45           1 : }
      46             : 
      47           3 : BOOST_AUTO_TEST_CASE(test_simple_mu_nu)
      48             : {
      49             :   std::string b(
      50             :     "nu X1 = X2;\n"
      51             :     "mu X2 = X1;\n"
      52             :     "init X1;\n"
      53           2 :   );
      54           1 :   run_all_algorithms(b, true);
      55           1 : }
      56             : 
      57           3 : BOOST_AUTO_TEST_CASE(test_simple)
      58             : {
      59             :   std::string b(
      60             :     "mu X1 = X2 && X1; \n"
      61             :     "nu X2 = X1 || X3; \n"
      62             :     "mu X3 = X1 || X2; \n"
      63             :     "                  \n"
      64             :     "init X1;          \n"
      65           2 :   );
      66           1 :   run_all_algorithms(b, false);
      67           4 : }

Generated by: LCOV version 1.12