1 /*============================================================================= 2 Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) 3 http://spirit.sourceforge.net/ 4 5 Use, modification and distribution is subject to the Boost Software 6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 =============================================================================*/ 9 10 /////////////////////////////////////////////////////////////////////////////// 11 // Test suite for increment_actor 12 /////////////////////////////////////////////////////////////////////////////// 13 14 #include "action_tests.hpp" 15 #include <boost/spirit/include/classic_core.hpp> 16 #include <boost/spirit/include/classic_decrement_actor.hpp> 17 decrement_action_test()18void decrement_action_test() 19 { 20 using namespace BOOST_SPIRIT_CLASSIC_NS; 21 22 BOOST_MESSAGE("decrement_test"); 23 24 const char* cp = "63"; 25 const char* cp_first = cp; 26 const char* cp_last = cp + test_impl::string_length(cp); 27 int h=127; 28 int hm=h; 29 30 scanner<char const*> scan( cp_first, cp_last ); 31 match<> hit; 32 33 hit = int_p[ decrement_a(hm)].parse(scan); 34 BOOST_CHECK(hit); 35 BOOST_CHECK_EQUAL(scan.first, scan.last); 36 37 --h; 38 BOOST_CHECK_EQUAL( hm,h); 39 } 40 41