|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60995 - in trunk/libs/spirit/example/scheme: . test
From: joel_at_[hidden]
Date: 2010-04-02 00:58:48
Author: djowel
Date: 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
New Revision: 60995
URL: http://svn.boost.org/trac/boost/changeset/60995
Log:
rearrangin: moved some files to test dir
Added:
trunk/libs/spirit/example/scheme/test/
trunk/libs/spirit/example/scheme/test/out.txt (contents, props changed)
trunk/libs/spirit/example/scheme/test/sexpr_input_test.cpp (contents, props changed)
trunk/libs/spirit/example/scheme/test/sexpr_output_test.cpp (contents, props changed)
trunk/libs/spirit/example/scheme/test/sexpr_test.txt (contents, props changed)
trunk/libs/spirit/example/scheme/test/utree_test.cpp (contents, props changed)
Removed:
trunk/libs/spirit/example/scheme/out.txt
trunk/libs/spirit/example/scheme/sexpr_output_test.cpp
trunk/libs/spirit/example/scheme/sexpr_test.cpp
trunk/libs/spirit/example/scheme/sexpr_test.txt
trunk/libs/spirit/example/scheme/simple_print.hpp
trunk/libs/spirit/example/scheme/utree_test.cpp
Deleted: trunk/libs/spirit/example/scheme/out.txt
==============================================================================
--- trunk/libs/spirit/example/scheme/out.txt 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
+++ (empty file)
@@ -1,2 +0,0 @@
-success: (123.45 true false 255 63 "this is a ⬠string" "Τη γλÏÏÏα μοÏ
ÎδÏÏαν ελληνική" b0123456789abcdef123456789abcdef (92 ("another string" apple Sîne)))
-
Deleted: trunk/libs/spirit/example/scheme/sexpr_output_test.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/sexpr_output_test.cpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
+++ (empty file)
@@ -1,105 +0,0 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-//
-// Distributed under 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/config/warning_disable.hpp>
-
-#define BOOST_SPIRIT_UNICODE
-
-#include <iostream>
-#include <fstream>
-#include <iterator>
-
-#include "input/parse_sexpr_impl.hpp"
-#include "output/generate_sexpr_impl.hpp"
-
-namespace client
-{
- bool parse_sexpr_from_file(char const* filename, scheme::utree& result)
- {
- std::ifstream in(filename, std::ios_base::in);
-
- if (!in)
- {
- std::cerr << "Error: Could not open input file: "
- << filename << std::endl;
- exit(-1);
- }
-
- // Ignore the BOM marking the beginning of a UTF-8 file in Windows
- char c = in.peek();
- if (c == '\xef')
- {
- char s[3];
- in >> s[0] >> s[1] >> s[2];
- s[3] = '\0';
- if (s != std::string("\xef\xbb\xbf"))
- {
- std::cerr << "Error: Unexpected characters from input file: "
- << filename << std::endl;
- exit(-1);
- }
- }
-
- return scheme::input::parse_sexpr(in, result);
- }
-
- bool generate_sexpr_to_file(scheme::utree const& tree, char const* filename)
- {
- std::ofstream out(filename);
-
- if (!out)
- {
- std::cerr << "Error: Could not open output file: "
- << filename << std::endl;
- exit(-1);
- }
-
- return scheme::output::generate_sexpr(out, tree);
- }
-}
-
-int main(int argc, char **argv)
-{
- char const* filename_in;
- if (argc > 1)
- {
- filename_in = argv[1];
- }
- else
- {
- std::cerr << "Error: No input file provided." << std::endl;
- return -1;
- }
-
- char const* filename_out;
- if (argc > 2)
- {
- filename_out = argv[2];
- }
- else
- {
- std::cerr << "Error: No output file provided." << std::endl;
- return -1;
- }
-
- scheme::utree result;
- if (client::parse_sexpr_from_file(filename_in, result))
- {
- if (client::generate_sexpr_to_file(result, filename_out))
- {
- std::cout << "success!" << std::endl;
- }
- else
- {
- std::cout << "generate error" << std::endl;
- }
- }
- else
- {
- std::cout << "parse error" << std::endl;
- }
-
- return 0;
-}
Deleted: trunk/libs/spirit/example/scheme/sexpr_test.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/sexpr_test.cpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
+++ (empty file)
@@ -1,72 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2010 Joel de Guzman
-
- Distributed under 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/config/warning_disable.hpp>
-
-#include "input/sexpr.hpp"
-#include "input/parse_sexpr_impl.hpp"
-#include "simple_print.hpp"
-#include <iostream>
-#include <fstream>
-
-///////////////////////////////////////////////////////////////////////////////
-// Main program
-///////////////////////////////////////////////////////////////////////////////
-int main(int argc, char **argv)
-{
- using ::detail::println;
-
- char const* filename;
- if (argc > 1)
- {
- filename = argv[1];
- }
- else
- {
- std::cerr << "Error: No input file provided." << std::endl;
- return 1;
- }
-
- std::ifstream in(filename, std::ios_base::in);
-
- if (!in)
- {
- std::cerr << "Error: Could not open input file: "
- << filename << std::endl;
- return 1;
- }
-
- // Ignore the BOM marking the beginning of a UTF-8 file in Windows
- char c = in.peek();
- if (c == '\xef')
- {
- char s[3];
- in >> s[0] >> s[1] >> s[2];
- s[3] = '\0';
- if (s != std::string("\xef\xbb\xbf"))
- {
- std::cerr << "Error: Unexpected characters from input file: "
- << filename << std::endl;
- return 1;
- }
- }
-
- scheme::utree result;
- if (scheme::input::parse_sexpr(in, result))
- {
- std::cout << "success: ";
- println(std::cout, result);
- std::cout << std::endl;
- }
- else
- {
- std::cout << "parse error" << std::endl;
- }
-
- return 0;
-}
-
-
Deleted: trunk/libs/spirit/example/scheme/sexpr_test.txt
==============================================================================
--- trunk/libs/spirit/example/scheme/sexpr_test.txt 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
+++ (empty file)
@@ -1,13 +0,0 @@
-(
- 123.45
- true
- false
- 0xFF
- 077
- "this is a \u20AC string" ; A UTF-8 string
- "Τη γλÏÏÏα μοÏ
ÎδÏÏαν ελληνική" ; Another UTF-8 string
- b0123456789ABCDEF0123456789abcdef ; A binary stream
- (
- 92 ("another string" apple Sîne)
- )
-)
\ No newline at end of file
Deleted: trunk/libs/spirit/example/scheme/simple_print.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/simple_print.hpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
+++ (empty file)
@@ -1,22 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2010 Joel de Guzman
-
- Distributed under 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)
-=============================================================================*/
-#if !defined(UTREE_SIMPLE_PRINT)
-#define UTREE_SIMPLE_PRINT
-
-#include "utree.hpp"
-#include <iostream>
-
-namespace detail
-{
- inline std::ostream& println(std::ostream& out, scheme::utree const& val)
- {
- out << val << std::endl;
- return out;
- }
-}
-
-#endif
\ No newline at end of file
Added: trunk/libs/spirit/example/scheme/test/out.txt
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/example/scheme/test/out.txt 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
@@ -0,0 +1,2 @@
+success: (123.45 true false 255 63 "this is a ⬠string" "Τη γλÏÏÏα μοÏ
ÎδÏÏαν ελληνική" b0123456789abcdef123456789abcdef (92 ("another string" apple Sîne)))
+
Added: trunk/libs/spirit/example/scheme/test/sexpr_input_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/example/scheme/test/sexpr_input_test.cpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
@@ -0,0 +1,72 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+
+ Distributed under 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/config/warning_disable.hpp>
+
+#include "input/sexpr.hpp"
+#include "input/parse_sexpr_impl.hpp"
+#include "simple_print.hpp"
+#include <iostream>
+#include <fstream>
+
+///////////////////////////////////////////////////////////////////////////////
+// Main program
+///////////////////////////////////////////////////////////////////////////////
+int main(int argc, char **argv)
+{
+ using ::detail::println;
+
+ char const* filename;
+ if (argc > 1)
+ {
+ filename = argv[1];
+ }
+ else
+ {
+ std::cerr << "Error: No input file provided." << std::endl;
+ return 1;
+ }
+
+ std::ifstream in(filename, std::ios_base::in);
+
+ if (!in)
+ {
+ std::cerr << "Error: Could not open input file: "
+ << filename << std::endl;
+ return 1;
+ }
+
+ // Ignore the BOM marking the beginning of a UTF-8 file in Windows
+ char c = in.peek();
+ if (c == '\xef')
+ {
+ char s[3];
+ in >> s[0] >> s[1] >> s[2];
+ s[3] = '\0';
+ if (s != std::string("\xef\xbb\xbf"))
+ {
+ std::cerr << "Error: Unexpected characters from input file: "
+ << filename << std::endl;
+ return 1;
+ }
+ }
+
+ scheme::utree result;
+ if (scheme::input::parse_sexpr(in, result))
+ {
+ std::cout << "success: ";
+ println(std::cout, result);
+ std::cout << std::endl;
+ }
+ else
+ {
+ std::cout << "parse error" << std::endl;
+ }
+
+ return 0;
+}
+
+
Added: trunk/libs/spirit/example/scheme/test/sexpr_output_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/example/scheme/test/sexpr_output_test.cpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
@@ -0,0 +1,105 @@
+// Copyright (c) 2001-2010 Hartmut Kaiser
+//
+// Distributed under 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/config/warning_disable.hpp>
+
+#define BOOST_SPIRIT_UNICODE
+
+#include <iostream>
+#include <fstream>
+#include <iterator>
+
+#include "input/parse_sexpr_impl.hpp"
+#include "output/generate_sexpr_impl.hpp"
+
+namespace client
+{
+ bool parse_sexpr_from_file(char const* filename, scheme::utree& result)
+ {
+ std::ifstream in(filename, std::ios_base::in);
+
+ if (!in)
+ {
+ std::cerr << "Error: Could not open input file: "
+ << filename << std::endl;
+ exit(-1);
+ }
+
+ // Ignore the BOM marking the beginning of a UTF-8 file in Windows
+ char c = in.peek();
+ if (c == '\xef')
+ {
+ char s[3];
+ in >> s[0] >> s[1] >> s[2];
+ s[3] = '\0';
+ if (s != std::string("\xef\xbb\xbf"))
+ {
+ std::cerr << "Error: Unexpected characters from input file: "
+ << filename << std::endl;
+ exit(-1);
+ }
+ }
+
+ return scheme::input::parse_sexpr(in, result);
+ }
+
+ bool generate_sexpr_to_file(scheme::utree const& tree, char const* filename)
+ {
+ std::ofstream out(filename);
+
+ if (!out)
+ {
+ std::cerr << "Error: Could not open output file: "
+ << filename << std::endl;
+ exit(-1);
+ }
+
+ return scheme::output::generate_sexpr(out, tree);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ char const* filename_in;
+ if (argc > 1)
+ {
+ filename_in = argv[1];
+ }
+ else
+ {
+ std::cerr << "Error: No input file provided." << std::endl;
+ return -1;
+ }
+
+ char const* filename_out;
+ if (argc > 2)
+ {
+ filename_out = argv[2];
+ }
+ else
+ {
+ std::cerr << "Error: No output file provided." << std::endl;
+ return -1;
+ }
+
+ scheme::utree result;
+ if (client::parse_sexpr_from_file(filename_in, result))
+ {
+ if (client::generate_sexpr_to_file(result, filename_out))
+ {
+ std::cout << "success!" << std::endl;
+ }
+ else
+ {
+ std::cout << "generate error" << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "parse error" << std::endl;
+ }
+
+ return 0;
+}
Added: trunk/libs/spirit/example/scheme/test/sexpr_test.txt
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/example/scheme/test/sexpr_test.txt 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
@@ -0,0 +1,13 @@
+(
+ 123.45
+ true
+ false
+ 0xFF
+ 077
+ "this is a \u20AC string" ; A UTF-8 string
+ "Τη γλÏÏÏα μοÏ
ÎδÏÏαν ελληνική" ; Another UTF-8 string
+ b0123456789ABCDEF0123456789abcdef ; A binary stream
+ (
+ 92 ("another string" apple Sîne)
+ )
+)
\ No newline at end of file
Added: trunk/libs/spirit/example/scheme/test/utree_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/example/scheme/test/utree_test.cpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
@@ -0,0 +1,194 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+
+ Distributed under 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/config/warning_disable.hpp>
+
+#include "utree.hpp"
+#include "simple_print.hpp"
+#include <iostream>
+
+int main()
+{
+ using scheme::utree;
+ using ::detail::println;
+
+ {
+ // test the size
+ std::cout << "size of utree is: "
+ << sizeof(scheme::utree) << " bytes" << std::endl;
+ }
+
+ {
+ utree val;
+ println(std::cout, val);
+ }
+
+ {
+ utree val(true);
+ println(std::cout, val);
+ }
+
+ {
+ utree val(123);
+ println(std::cout, val);
+ }
+
+ {
+ utree val(123.456);
+ println(std::cout, val);
+ }
+
+ {
+ utree val("Hello, World");
+ println(std::cout, val);
+ utree val2;
+ val2 = val;
+ println(std::cout, val2);
+ utree val3("Hello, World. Chuckie is back!!!");
+ val = val3;
+ println(std::cout, val);
+
+ utree val4("Apple");
+ utree val5("Apple");
+ BOOST_ASSERT(val4 == val5);
+
+ utree val6("ApplePie");
+ BOOST_ASSERT(val4 < val6);
+ }
+
+ {
+ utree val;
+ val.push_back(123);
+ val.push_back("Chuckie");
+ utree val2;
+ val2.push_back(123.456);
+ val2.push_back("Mah Doggie");
+ val.push_back(val2);
+ println(std::cout, val);
+ println(std::cout, val.front());
+
+ utree val3;
+ val3.swap(val);
+ println(std::cout, val);
+ val3.swap(val);
+ println(std::cout, val);
+ val.push_back("another string");
+ println(std::cout, val);
+ val.pop_front();
+ println(std::cout, val);
+ utree::iterator i = val.begin();
+ ++++i;
+ val.insert(i, "Right in the middle");
+ BOOST_ASSERT(val.size() == 4);
+ println(std::cout, val);
+ val.pop_back();
+ println(std::cout, val);
+ BOOST_ASSERT(val.size() == 3);
+ val.erase(val.end());
+ println(std::cout, val);
+ BOOST_ASSERT(val.size() == 2);
+
+ val.insert(val.begin(), val2.begin(), val2.end());
+ println(std::cout, val);
+ }
+
+ {
+ utree val;
+ val.insert(val.end(), 123);
+ val.insert(val.end(), "Mia");
+ val.insert(val.end(), "Chuckie");
+ val.insert(val.end(), "Poly");
+ val.insert(val.end(), "Mochi");
+ println(std::cout, val);
+ }
+
+ {
+ utree a, b;
+ BOOST_ASSERT(a == b);
+ a = 123;
+ BOOST_ASSERT(a != b);
+ b = 123;
+ BOOST_ASSERT(a == b);
+ a = 100.00;
+ BOOST_ASSERT(a < b);
+
+ b = a = utree();
+ BOOST_ASSERT(a == b);
+ a.push_back(1);
+ a.push_back("two");
+ a.push_back(3.0);
+ b.push_back(1);
+ b.push_back("two");
+ b.push_back(3.0);
+ BOOST_ASSERT(a == b);
+ b.push_back(4);
+ BOOST_ASSERT(a != b);
+ BOOST_ASSERT(a < b);
+ }
+
+ {
+ utree a;
+ a.push_back(1);
+ a.push_back(2);
+ a.push_back(3);
+ a.push_back(4);
+ a.push_back(5);
+ a.push_back(6);
+ a.push_back(7);
+ a.push_back(8);
+ a.push_back(9);
+ a.push_back(10);
+ a.push_back(11);
+ a.push_back(12);
+
+ BOOST_ASSERT(a[0] == utree(1));
+ BOOST_ASSERT(a[1] == utree(2));
+ BOOST_ASSERT(a[2] == utree(3));
+ BOOST_ASSERT(a[3] == utree(4));
+ BOOST_ASSERT(a[4] == utree(5));
+ BOOST_ASSERT(a[5] == utree(6));
+ BOOST_ASSERT(a[6] == utree(7));
+ BOOST_ASSERT(a[7] == utree(8));
+ BOOST_ASSERT(a[8] == utree(9));
+ BOOST_ASSERT(a[9] == utree(10));
+ BOOST_ASSERT(a[10] == utree(11));
+ BOOST_ASSERT(a[11] == utree(12));
+ }
+
+ { // test references
+ utree val(123);
+ utree ref(boost::ref(val));
+ println(std::cout, ref);
+ BOOST_ASSERT(ref == utree(123));
+
+ val.clear();
+ val.push_back(1);
+ val.push_back(2);
+ val.push_back(3);
+ val.push_back(4);
+ println(std::cout, ref);
+ BOOST_ASSERT(ref[0] == utree(1));
+ BOOST_ASSERT(ref[1] == utree(2));
+ BOOST_ASSERT(ref[2] == utree(3));
+ BOOST_ASSERT(ref[3] == utree(4));
+ }
+
+ { // put it in an array
+
+ utree vals[] = {
+ utree(123),
+ utree("Hello, World"),
+ utree(123.456)
+ };
+
+ println(std::cout, vals[0]);
+ println(std::cout, vals[1]);
+ println(std::cout, vals[2]);
+ }
+
+ return 0;
+}
Deleted: trunk/libs/spirit/example/scheme/utree_test.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/utree_test.cpp 2010-04-02 00:58:46 EDT (Fri, 02 Apr 2010)
+++ (empty file)
@@ -1,194 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2010 Joel de Guzman
-
- Distributed under 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/config/warning_disable.hpp>
-
-#include "utree.hpp"
-#include "simple_print.hpp"
-#include <iostream>
-
-int main()
-{
- using scheme::utree;
- using ::detail::println;
-
- {
- // test the size
- std::cout << "size of utree is: "
- << sizeof(scheme::utree) << " bytes" << std::endl;
- }
-
- {
- utree val;
- println(std::cout, val);
- }
-
- {
- utree val(true);
- println(std::cout, val);
- }
-
- {
- utree val(123);
- println(std::cout, val);
- }
-
- {
- utree val(123.456);
- println(std::cout, val);
- }
-
- {
- utree val("Hello, World");
- println(std::cout, val);
- utree val2;
- val2 = val;
- println(std::cout, val2);
- utree val3("Hello, World. Chuckie is back!!!");
- val = val3;
- println(std::cout, val);
-
- utree val4("Apple");
- utree val5("Apple");
- BOOST_ASSERT(val4 == val5);
-
- utree val6("ApplePie");
- BOOST_ASSERT(val4 < val6);
- }
-
- {
- utree val;
- val.push_back(123);
- val.push_back("Chuckie");
- utree val2;
- val2.push_back(123.456);
- val2.push_back("Mah Doggie");
- val.push_back(val2);
- println(std::cout, val);
- println(std::cout, val.front());
-
- utree val3;
- val3.swap(val);
- println(std::cout, val);
- val3.swap(val);
- println(std::cout, val);
- val.push_back("another string");
- println(std::cout, val);
- val.pop_front();
- println(std::cout, val);
- utree::iterator i = val.begin();
- ++++i;
- val.insert(i, "Right in the middle");
- BOOST_ASSERT(val.size() == 4);
- println(std::cout, val);
- val.pop_back();
- println(std::cout, val);
- BOOST_ASSERT(val.size() == 3);
- val.erase(val.end());
- println(std::cout, val);
- BOOST_ASSERT(val.size() == 2);
-
- val.insert(val.begin(), val2.begin(), val2.end());
- println(std::cout, val);
- }
-
- {
- utree val;
- val.insert(val.end(), 123);
- val.insert(val.end(), "Mia");
- val.insert(val.end(), "Chuckie");
- val.insert(val.end(), "Poly");
- val.insert(val.end(), "Mochi");
- println(std::cout, val);
- }
-
- {
- utree a, b;
- BOOST_ASSERT(a == b);
- a = 123;
- BOOST_ASSERT(a != b);
- b = 123;
- BOOST_ASSERT(a == b);
- a = 100.00;
- BOOST_ASSERT(a < b);
-
- b = a = utree();
- BOOST_ASSERT(a == b);
- a.push_back(1);
- a.push_back("two");
- a.push_back(3.0);
- b.push_back(1);
- b.push_back("two");
- b.push_back(3.0);
- BOOST_ASSERT(a == b);
- b.push_back(4);
- BOOST_ASSERT(a != b);
- BOOST_ASSERT(a < b);
- }
-
- {
- utree a;
- a.push_back(1);
- a.push_back(2);
- a.push_back(3);
- a.push_back(4);
- a.push_back(5);
- a.push_back(6);
- a.push_back(7);
- a.push_back(8);
- a.push_back(9);
- a.push_back(10);
- a.push_back(11);
- a.push_back(12);
-
- BOOST_ASSERT(a[0] == utree(1));
- BOOST_ASSERT(a[1] == utree(2));
- BOOST_ASSERT(a[2] == utree(3));
- BOOST_ASSERT(a[3] == utree(4));
- BOOST_ASSERT(a[4] == utree(5));
- BOOST_ASSERT(a[5] == utree(6));
- BOOST_ASSERT(a[6] == utree(7));
- BOOST_ASSERT(a[7] == utree(8));
- BOOST_ASSERT(a[8] == utree(9));
- BOOST_ASSERT(a[9] == utree(10));
- BOOST_ASSERT(a[10] == utree(11));
- BOOST_ASSERT(a[11] == utree(12));
- }
-
- { // test references
- utree val(123);
- utree ref(boost::ref(val));
- println(std::cout, ref);
- BOOST_ASSERT(ref == utree(123));
-
- val.clear();
- val.push_back(1);
- val.push_back(2);
- val.push_back(3);
- val.push_back(4);
- println(std::cout, ref);
- BOOST_ASSERT(ref[0] == utree(1));
- BOOST_ASSERT(ref[1] == utree(2));
- BOOST_ASSERT(ref[2] == utree(3));
- BOOST_ASSERT(ref[3] == utree(4));
- }
-
- { // put it in an array
-
- utree vals[] = {
- utree(123),
- utree("Hello, World"),
- utree(123.456)
- };
-
- println(std::cout, vals[0]);
- println(std::cout, vals[1]);
- println(std::cout, vals[2]);
- }
-
- return 0;
-}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk