LCOV - code coverage report
Current view: top level - atermpp/test - function_test.cpp (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 17 17 100.0 %
Date: 2020-02-13 00:44:47 Functions: 4 4 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 function_test.cpp
      10             : /// \brief Add your file description here.
      11             : 
      12             : #define BOOST_TEST_MODULE function_test
      13             : #include <boost/test/included/unit_test_framework.hpp>
      14             : 
      15             : #include "mcrl2/atermpp/aterm_io.h"
      16             : 
      17             : using namespace std;
      18             : using namespace atermpp;
      19             : 
      20           3 : BOOST_AUTO_TEST_CASE(test_aterm_function)
      21             : {
      22             :   // create an unquoted function symbol
      23           2 :   function_symbol sym("f", 1);
      24           2 :   atermpp::aterm x ( read_term_from_string("x"));
      25             : 
      26           2 :   aterm_appl a(sym, x);
      27           1 :   BOOST_CHECK(pp(a) == "f(x)");
      28           1 :   BOOST_CHECK(a.function() == sym);
      29             : 
      30           2 :   string s = pp(a);
      31           2 :   aterm_appl b ( read_appl_from_string(s));
      32           1 :   BOOST_CHECK(pp(a) == "f(x)");
      33           1 :   BOOST_CHECK(b.function() == sym); 
      34             : 
      35           2 :   aterm_appl c (read_appl_from_string(s));
      36           1 :   BOOST_CHECK(pp(c) == "f(x)");
      37           1 :   BOOST_CHECK(c.function() == sym); 
      38             : 
      39           2 :   aterm_appl f ( read_appl_from_string("f(g(a,b),c)"));
      40           2 :   aterm_appl g ( read_appl_from_string("g(a,b)"));
      41           1 :   BOOST_CHECK(f[0] == g);
      42           4 : }

Generated by: LCOV version 1.13