summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/spirit/classic/test/actor
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/spirit/classic/test/actor')
-rw-r--r--src/boost/libs/spirit/classic/test/actor/action_tests.cpp26
-rw-r--r--src/boost/libs/spirit/classic/test/actor/action_tests.hpp33
-rw-r--r--src/boost/libs/spirit/classic/test/actor/assign_key_test.cpp116
-rw-r--r--src/boost/libs/spirit/classic/test/actor/assign_test.cpp65
-rw-r--r--src/boost/libs/spirit/classic/test/actor/clear_test.cpp47
-rw-r--r--src/boost/libs/spirit/classic/test/actor/decrement_test.cpp40
-rw-r--r--src/boost/libs/spirit/classic/test/actor/erase_at_test.cpp54
-rw-r--r--src/boost/libs/spirit/classic/test/actor/increment_test.cpp42
-rw-r--r--src/boost/libs/spirit/classic/test/actor/insert_at_test.cpp109
-rw-r--r--src/boost/libs/spirit/classic/test/actor/insert_key_test.cpp116
-rw-r--r--src/boost/libs/spirit/classic/test/actor/push_back_test.cpp56
-rw-r--r--src/boost/libs/spirit/classic/test/actor/push_front_test.cpp53
-rw-r--r--src/boost/libs/spirit/classic/test/actor/swap_test.cpp47
-rw-r--r--src/boost/libs/spirit/classic/test/actor/unit_test.cpp10
14 files changed, 814 insertions, 0 deletions
diff --git a/src/boost/libs/spirit/classic/test/actor/action_tests.cpp b/src/boost/libs/spirit/classic/test/actor/action_tests.cpp
new file mode 100644
index 00000000..792ba8c0
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/action_tests.cpp
@@ -0,0 +1,26 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#include "action_tests.hpp"
+
+int
+main()
+{
+ assign_action_test();
+ assign_key_action_test();
+ clear_action_test();
+ decrement_action_test();
+ erase_action_test();
+ increment_action_test();
+ insert_key_action_test();
+ push_front_action_test();
+ push_back_action_test();
+ swap_action_test();
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/spirit/classic/test/actor/action_tests.hpp b/src/boost/libs/spirit/classic/test/actor/action_tests.hpp
new file mode 100644
index 00000000..a17499e1
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/action_tests.hpp
@@ -0,0 +1,33 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_ACTOR_TEST_HPP
+#define BOOST_SPIRIT_ACTOR_TEST_HPP
+#include <boost/detail/lightweight_test.hpp>
+#include "../impl/string_length.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for actors
+///////////////////////////////////////////////////////////////////////////////
+void assign_action_test();
+void assign_key_action_test();
+void clear_action_test();
+void decrement_action_test();
+void erase_action_test();
+void increment_action_test();
+void insert_key_action_test();
+void insert_at_action_test();
+void push_back_action_test();
+void push_front_action_test();
+void swap_action_test();
+
+#define BOOST_CHECK(t) BOOST_TEST((t));
+#define BOOST_CHECK_EQUAL(a, b) BOOST_TEST((a == b));
+#define BOOST_MESSAGE(m) std::cout << m << std::endl
+
+#endif
diff --git a/src/boost/libs/spirit/classic/test/actor/assign_key_test.cpp b/src/boost/libs/spirit/classic/test/actor/assign_key_test.cpp
new file mode 100644
index 00000000..f599b5e2
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/assign_key_test.cpp
@@ -0,0 +1,116 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for assign_key_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_confix.hpp>
+#include <boost/spirit/include/classic_lists.hpp>
+#include <map>
+#include <cstring>
+#include <iostream>
+#include <boost/spirit/include/classic_assign_key_actor.hpp>
+#include <boost/spirit/include/classic_assign_actor.hpp>
+
+void assign_key_single_argument_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "(one,0),(two,1),(three,2)";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ typedef std::map<int,std::string> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+ std::string str;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p(
+ confix_p(
+ '(',
+ (*alpha_p)[ assign(str)]
+ >>ch_p(',')
+ >> int_p[ assign_key_a(c,str)]
+ ,
+ ')'
+ )
+ ,
+ ch_p(',')
+ ).parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(3));
+ for (i=0;i<3;++i)
+ {
+ it_find = c.find(i);
+ BOOST_CHECK( it_find != c.end() );
+ BOOST_CHECK_EQUAL( i,it_find->first);
+ BOOST_CHECK_EQUAL( cp_i[i],it_find->second);
+ }
+
+}
+
+void assign_key_two_arguments_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "(0,one),(1,two),(2,three)";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ typedef std::map<std::string, int> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+ std::string str;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p(
+ confix_p(
+ '(',
+ int_p[ assign_a(i)]
+ >>ch_p(',')
+ >> (*alpha_p)[ assign_key_a(c,i)]
+ ,
+ ')'
+ )
+ ,
+ ch_p(',')
+ ).parse(scan);
+
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(3));
+
+ for (i=0;i<3;++i)
+ {
+ it_find = c.find(cp_i[i]);
+ BOOST_CHECK( it_find != c.end() );
+ BOOST_CHECK_EQUAL( i,it_find->second);
+ BOOST_CHECK_EQUAL( cp_i[i],it_find->first);
+ }
+ scan.first = cp;
+
+}
+
+void assign_key_action_test()
+{
+ assign_key_single_argument_test();
+ assign_key_two_arguments_test();
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/assign_test.cpp b/src/boost/libs/spirit/classic/test/actor/assign_test.cpp
new file mode 100644
index 00000000..e59fcc2c
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/assign_test.cpp
@@ -0,0 +1,65 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for assign_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_assign_actor.hpp>
+
+void assign_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "63";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ int h=127;
+ int hm=h;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = int_p[ assign_a(hm)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+
+ h=63;
+ BOOST_CHECK_EQUAL( hm,h);
+}
+
+void assign_test_ref()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+
+ const char* cp = "63";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ int h=127;
+ int hm=63;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = int_p[ assign_a(h,hm)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+
+ BOOST_CHECK_EQUAL( hm,h);
+}
+
+void assign_action_test()
+{
+ assign_test();
+ assign_test_ref();
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/clear_test.cpp b/src/boost/libs/spirit/classic/test/actor/clear_test.cpp
new file mode 100644
index 00000000..b39d9114
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/clear_test.cpp
@@ -0,0 +1,47 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for clear_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <vector>
+#include <boost/spirit/include/classic_clear_actor.hpp>
+
+void clear_action_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ BOOST_MESSAGE("clear_test");
+
+ const char* cp = "63";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ std::vector<int> c;
+ c.push_back(1);
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = int_p[ clear_a(c)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK( c.empty() );
+ scan.first = cp;
+ c.push_back(1);
+
+ hit = str_p("63")[ clear_a(c)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK( c.empty() );
+}
+
+
diff --git a/src/boost/libs/spirit/classic/test/actor/decrement_test.cpp b/src/boost/libs/spirit/classic/test/actor/decrement_test.cpp
new file mode 100644
index 00000000..728c838c
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/decrement_test.cpp
@@ -0,0 +1,40 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for increment_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_decrement_actor.hpp>
+
+void decrement_action_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ BOOST_MESSAGE("decrement_test");
+
+ const char* cp = "63";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ int h=127;
+ int hm=h;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = int_p[ decrement_a(hm)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+
+ --h;
+ BOOST_CHECK_EQUAL( hm,h);
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/erase_at_test.cpp b/src/boost/libs/spirit/classic/test/actor/erase_at_test.cpp
new file mode 100644
index 00000000..9254b177
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/erase_at_test.cpp
@@ -0,0 +1,54 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for push_front_actor, pop_front_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_erase_actor.hpp>
+#include <map>
+
+void erase_action_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "one,two,three";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};
+ typedef std::map<std::string, int> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+
+ scanner<char const*> scan(cp_first, cp_last);
+ match<> hit;
+
+ c["one"]=1;
+ c["two"]=2;
+ c["three"]=3;
+ c["four"]=4;
+
+ hit = (*((+alpha_p)[ erase_a(c) ] >> !ch_p(','))).parse(scan);
+
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(1));
+ for (int i=0;i<3;++i)
+ {
+ it_find = c.find(cp_i[i]);
+ BOOST_CHECK( it_find == c.end() );
+ }
+ scan.first = cp;
+
+}
+
+
+
diff --git a/src/boost/libs/spirit/classic/test/actor/increment_test.cpp b/src/boost/libs/spirit/classic/test/actor/increment_test.cpp
new file mode 100644
index 00000000..57f59970
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/increment_test.cpp
@@ -0,0 +1,42 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for increment_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_increment_actor.hpp>
+
+void increment_action_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ BOOST_MESSAGE("increment_test");
+
+ const char* cp = "63";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ int h=127;
+ int hm=h;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = int_p[ increment_a(hm)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+
+ ++h;
+ BOOST_CHECK_EQUAL( hm,h);
+}
+
+
+
diff --git a/src/boost/libs/spirit/classic/test/actor/insert_at_test.cpp b/src/boost/libs/spirit/classic/test/actor/insert_at_test.cpp
new file mode 100644
index 00000000..5ef6a102
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/insert_at_test.cpp
@@ -0,0 +1,109 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for insert_at_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <map>
+#include <cstring>
+#include <iostream>
+#include <boost/spirit/include/classic_spirit.hpp>
+#include <boost/spirit/include/classic_insert_at_actor.hpp>
+
+void insert_at_single_argument_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "(one,0),(two,1),(three,2)";
+ const char* cp_first = cp;
+ const char* cp_last = cp + std::strlen(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ typedef std::map<std::string,int> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+ std::string str;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p(
+ confix_p(
+ '(',
+ (*alpha_p)[ assign(str)]
+ >>ch_p(',')
+ >> int_p[ insert_at_a(c,str)]
+ ,
+ ')'
+ )
+ ,
+ ch_p(',')
+ ).parse(scan);
+
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(3));
+ for (i=0;i<3;++i)
+ {
+ it_find = c.find(cp_i[i]);
+ BOOST_CHECK( it_find != c.end() );
+ BOOST_CHECK_EQUAL( i,it_find->second);
+ BOOST_CHECK_EQUAL( cp_i[i],it_find->first);
+ }
+}
+
+void insert_at_two_arguments_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "(0,one),(1,two),(2,three)";
+ const char* cp_first = cp;
+ const char* cp_last = cp + std::strlen(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ typedef std::map<int,std::string> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+ std::string str;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p(
+ confix_p(
+ '(',
+ int_p[ assign(i)]
+ >>ch_p(',')
+ >> (*alpha_p)[ insert_at_a(c,i)]
+ ,
+ ')'
+ )
+ ,
+ ch_p(',')
+ ).parse(scan);
+
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(3));
+ for (i=0;i<3;++i)
+ {
+ it_find = c.find(i);
+ BOOST_CHECK( it_find != c.end() );
+ BOOST_CHECK_EQUAL( i,it_find->first);
+ BOOST_CHECK_EQUAL( cp_i[i],it_find->second);
+ }
+}
+
+void insert_at_action_test()
+{
+ insert_at_single_argument_test();
+ insert_at_two_arguments_test();
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/insert_key_test.cpp b/src/boost/libs/spirit/classic/test/actor/insert_key_test.cpp
new file mode 100644
index 00000000..4f6eb0b5
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/insert_key_test.cpp
@@ -0,0 +1,116 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for insert_key_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_confix.hpp>
+#include <boost/spirit/include/classic_lists.hpp>
+#include <map>
+#include <cstring>
+#include <iostream>
+#include <boost/spirit/include/classic_insert_key_actor.hpp>
+#include <boost/spirit/include/classic_assign_actor.hpp>
+
+void insert_key_single_argument_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "(one,0),(two,1),(three,2)";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ typedef std::map<int,std::string> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+ std::string str;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p(
+ confix_p(
+ '(',
+ (*alpha_p)[ assign_a(str)]
+ >>ch_p(',')
+ >> int_p[ insert_key_a(c,str)]
+ ,
+ ')'
+ )
+ ,
+ ch_p(',')
+ ).parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(3));
+ for (i=0;i<3;++i)
+ {
+ it_find = c.find(i);
+ BOOST_CHECK( it_find != c.end() );
+ BOOST_CHECK_EQUAL( i,it_find->first);
+ BOOST_CHECK_EQUAL( cp_i[i],it_find->second);
+ }
+
+}
+
+void insert_key_two_arguments_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "(0,one),(1,two),(2,three)";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ typedef std::map<std::string, int> map_string_type;
+ map_string_type c;
+ map_string_type::const_iterator it_find;
+ std::string str;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p(
+ confix_p(
+ '(',
+ int_p[ assign_a(i)]
+ >>ch_p(',')
+ >> (*alpha_p)[ insert_key_a(c,i)]
+ ,
+ ')'
+ )
+ ,
+ ch_p(',')
+ ).parse(scan);
+
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<map_string_type::size_type>(3));
+
+ for (i=0;i<3;++i)
+ {
+ it_find = c.find(cp_i[i]);
+ BOOST_CHECK( it_find != c.end() );
+ BOOST_CHECK_EQUAL( i,it_find->second);
+ BOOST_CHECK_EQUAL( cp_i[i],it_find->first);
+ }
+ scan.first = cp;
+
+}
+
+void insert_key_action_test()
+{
+ insert_key_single_argument_test();
+ insert_key_two_arguments_test();
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/push_back_test.cpp b/src/boost/libs/spirit/classic/test/actor/push_back_test.cpp
new file mode 100644
index 00000000..ee83c19a
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/push_back_test.cpp
@@ -0,0 +1,56 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for push_back_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <string>
+#include <vector>
+#include <deque>
+#include <cstring>
+#include <iostream>
+#include <boost/spirit/include/classic_core.hpp>
+#include <algorithm>
+#include <boost/bind.hpp>
+#include <boost/spirit/include/classic_push_back_actor.hpp>
+#include <boost/spirit/include/classic_lists.hpp>
+
+template<typename ContainerT>
+void push_back_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "one,two,three";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};
+ int i;
+ ContainerT c;
+ typename ContainerT::const_iterator it;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p( (*alpha_p)[ push_back_a(c)] , ch_p(',') ).parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<typename ContainerT::size_type>(3));
+ for (i=0, it = c.begin();i<3 && it != c.end();++i, ++it)
+ BOOST_CHECK_EQUAL( cp_i[i], *it);
+ scan.first = cp;
+}
+
+void push_back_action_test()
+{
+ push_back_test< std::deque<std::string> >();
+ push_back_test< std::vector<std::string> >();
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/push_front_test.cpp b/src/boost/libs/spirit/classic/test/actor/push_front_test.cpp
new file mode 100644
index 00000000..ac42708e
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/push_front_test.cpp
@@ -0,0 +1,53 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for push_front_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <string>
+#include <vector>
+#include <deque>
+#include <cstring>
+#include <iostream>
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_push_front_actor.hpp>
+#include <boost/spirit/include/classic_lists.hpp>
+
+template<typename ContainerT>
+void push_front_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "one,two,three";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ const char* cp_i[] = {"one","two","three"};;
+ int i;
+ ContainerT c;
+ typename ContainerT::const_iterator it;
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = list_p( (*alpha_p)[ push_front_a(c)] , ch_p(',') ).parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK_EQUAL( c.size(), static_cast<typename ContainerT::size_type>(3));
+ for (i=2, it = c.begin();i>=0 && it != c.end();--i, ++it)
+ BOOST_CHECK_EQUAL( cp_i[i], *it);
+ scan.first = cp;
+}
+
+void push_front_action_test()
+{
+ push_front_test< std::deque<std::string> >();
+}
+
diff --git a/src/boost/libs/spirit/classic/test/actor/swap_test.cpp b/src/boost/libs/spirit/classic/test/actor/swap_test.cpp
new file mode 100644
index 00000000..0ba203de
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/swap_test.cpp
@@ -0,0 +1,47 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Test suite for and_assign_actor
+///////////////////////////////////////////////////////////////////////////////
+
+#include "action_tests.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_swap_actor.hpp>
+
+void swap_action_test()
+{
+ using namespace BOOST_SPIRIT_CLASSIC_NS;
+
+ const char* cp = "63";
+ const char* cp_first = cp;
+ const char* cp_last = cp + test_impl::string_length(cp);
+ std::vector<int> v1,v2;
+
+ v1.push_back(0);
+ v1.push_back(1);
+
+ v2.push_back(2);
+ v2.push_back(3);
+
+ scanner<char const*> scan( cp_first, cp_last );
+ match<> hit;
+
+ hit = int_p[ swap_a(v1,v2)].parse(scan);
+ BOOST_CHECK(hit);
+ BOOST_CHECK_EQUAL(scan.first, scan.last);
+ BOOST_CHECK(v1.size()==2);
+ BOOST_CHECK(v2.size()==2);
+ BOOST_CHECK_EQUAL(v2[0],0);
+ BOOST_CHECK_EQUAL(v2[1],1);
+ BOOST_CHECK_EQUAL(v1[0],2);
+ BOOST_CHECK_EQUAL(v1[1],3);
+}
+
+
diff --git a/src/boost/libs/spirit/classic/test/actor/unit_test.cpp b/src/boost/libs/spirit/classic/test/actor/unit_test.cpp
new file mode 100644
index 00000000..f908155c
--- /dev/null
+++ b/src/boost/libs/spirit/classic/test/actor/unit_test.cpp
@@ -0,0 +1,10 @@
+/*=============================================================================
+ Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+