|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56915 - trunk/libs/spirit/test/karma
From: hartmut.kaiser_at_[hidden]
Date: 2009-10-16 09:04:01
Author: hkaiser
Date: 2009-10-16 09:04:00 EDT (Fri, 16 Oct 2009)
New Revision: 56915
URL: http://svn.boost.org/trac/boost/changeset/56915
Log:
Spirit: added test detecting endianess/truncation problem on little endian systems
Text files modified:
trunk/libs/spirit/test/karma/alternative.cpp | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/test/karma/alternative.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/alternative.cpp (original)
+++ trunk/libs/spirit/test/karma/alternative.cpp 2009-10-16 09:04:00 EDT (Fri, 16 Oct 2009)
@@ -49,6 +49,17 @@
BOOST_TEST(test("c", int_ | char_ | lit('a'), v));
}
+ // testing for alignment/truncation problems on little endian systems
+ // (big endian systems will fail one of the other tests below)
+ {
+ std::basic_string<wchar_t> generated;
+ std::back_insert_iterator<std::basic_string<wchar_t> > outit(generated);
+ boost::variant<int, char> v(10);
+ bool result = karma::generate_delimited(outit
+ , karma::int_ | karma::char_, karma::char_(' '), v);
+ BOOST_TEST(result && generated == L"10 ");
+ }
+
{
// test if alternatives with all components having unused
// attribute generate first alternative
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