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 : 14 : #include <boost/test/included/unit_test.hpp> 15 : #include "mcrl2/pbes/pbes_gauss_elimination.h" 16 : #include "mcrl2/pbes/parse.h" 17 : #include "mcrl2/pbes/small_progress_measures.h" 18 : 19 : using namespace mcrl2; 20 : using namespace mcrl2::pbes_system; 21 : 22 3 : void run_all_algorithms(std::string const& b, bool expected_outcome) 23 : { 24 3 : pbes b1; 25 3 : std::stringstream from; 26 3 : from << "pbes\n" << b << std::endl; 27 3 : from >> b1; 28 : 29 3 : std::clog << "solving the following input bes: \n" << pbes_system::pp(b1) << std::endl; 30 : 31 3 : BOOST_CHECK_EQUAL(small_progress_measures(b1), expected_outcome); 32 3 : BOOST_CHECK_EQUAL(gauss_elimination(b1), expected_outcome); 33 3 : } 34 : 35 2 : BOOST_AUTO_TEST_CASE(test_simple_nu_mu) 36 : { 37 : std::string b( 38 : "mu X1 = X2;\n" 39 : "nu X2 = X1;\n" 40 : "init X1;\n" 41 1 : ); 42 1 : run_all_algorithms(b, false); 43 1 : } 44 : 45 2 : BOOST_AUTO_TEST_CASE(test_simple_mu_nu) 46 : { 47 : std::string b( 48 : "nu X1 = X2;\n" 49 : "mu X2 = X1;\n" 50 : "init X1;\n" 51 1 : ); 52 1 : run_all_algorithms(b, true); 53 1 : } 54 : 55 2 : BOOST_AUTO_TEST_CASE(test_simple) 56 : { 57 : std::string b( 58 : "mu X1 = X2 && X1; \n" 59 : "nu X2 = X1 || X3; \n" 60 : "mu X3 = X1 || X2; \n" 61 : " \n" 62 : "init X1; \n" 63 1 : ); 64 1 : run_all_algorithms(b, false); 65 1 : }