21 #include <boost/version.hpp> 22 #include <boost/iostreams/stream.hpp> 23 #include <boost/iostreams/device/array.hpp> 24 #if BOOST_VERSION >= 106400 28 # include <boost/serialization/array_wrapper.hpp> 30 # include <boost/serialization/array.hpp> 32 #include <boost/serialization/vector.hpp> 33 #include <boost/archive/binary_iarchive.hpp> 43 namespace io = boost::iostreams;
63 memset( sink, 0, 1000);
65 vector<double> c(10, 9.99);
68 io::stream<io::array_sink> outbuf(sink,1000);
75 BOOST_CHECK( stored > 10*
sizeof(
double) );
83 io::stream<io::array_source> inbuf(sink,1000);
89 BOOST_CHECK_CLOSE( d, 3.0, 0.01);
90 BOOST_CHECK_EQUAL( c.size(), 10);
91 for(
int i=0; i != 10; ++i) {
92 BOOST_CHECK_CLOSE( c[i], 9.99, 0.01);
104 memset( sink, 0, 1000);
105 char c[10] =
"123456789";
108 io::stream<io::array_sink> outbuf(sink,1000);
110 out << make_array(c, 10);
114 BOOST_CHECK( stored >= 10*
sizeof(
char) );
117 io::stream<io::array_source> inbuf(sink,1000);
119 #if BOOST_VERSION >= 106100 120 boost::serialization::array_wrapper<char> ma = boost::serialization::make_array(c, 10);
122 boost::serialization::array<char> ma = boost::serialization::make_array(c, 10);
127 BOOST_CHECK_EQUAL(c,
"123456789");
137 memset( sink, 0, 1000);
138 double c[10] = {-1,1,2,3,4,5,6,7,8,9};
139 double r[10] = {0,0,0,0,0,0,0,0,0,0};
142 io::stream<io::array_sink> outbuf(sink,1000);
144 out & make_nvp(
"array", make_array(c, 10) );
148 BOOST_CHECK( stored >= 10*
sizeof(
double) );
151 io::stream<io::array_source> inbuf(sink,1000);
153 in & make_nvp(
"array", make_array(r, 10) );
156 BOOST_CHECK_EQUAL(r[0], c[0]);
157 BOOST_CHECK_EQUAL(r[4], c[4]);
158 BOOST_CHECK_EQUAL(r[9], c[9]);
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
BOOST_AUTO_TEST_CASE(testBinaryDataArchive)
#define BOOST_AUTO_TEST_SUITE_END()
void rtos_disable_rt_warning()
void rtos_enable_rt_warning()