]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/classic/test/actor/swap_test.cpp
1 /*=============================================================================
2 Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
3 http://spirit.sourceforge.net/
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 =============================================================================*/
10 ///////////////////////////////////////////////////////////////////////////////
11 // Test suite for and_assign_actor
12 ///////////////////////////////////////////////////////////////////////////////
14 #include "action_tests.hpp"
15 #include <boost/spirit/include/classic_core.hpp>
16 #include <boost/spirit/include/classic_swap_actor.hpp>
18 void swap_action_test()
20 using namespace BOOST_SPIRIT_CLASSIC_NS
;
22 const char* cp
= "63";
23 const char* cp_first
= cp
;
24 const char* cp_last
= cp
+ test_impl::string_length(cp
);
25 std::vector
<int> v1
,v2
;
33 scanner
<char const*> scan( cp_first
, cp_last
);
36 hit
= int_p
[ swap_a(v1
,v2
)].parse(scan
);
38 BOOST_CHECK_EQUAL(scan
.first
, scan
.last
);
39 BOOST_CHECK(v1
.size()==2);
40 BOOST_CHECK(v2
.size()==2);
41 BOOST_CHECK_EQUAL(v2
[0],0);
42 BOOST_CHECK_EQUAL(v2
[1],1);
43 BOOST_CHECK_EQUAL(v1
[0],2);
44 BOOST_CHECK_EQUAL(v1
[1],3);