Line data Source code
1 :
2 : /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #include "test.h"
19 : #include "serialize.h"
20 :
21 : #include <boost/foreach.hpp>
22 :
23 :
24 1 : int main( int, char** )
25 : {
26 1 : std::list< lunchbox::Any > testValues;
27 1 : testValues.push_back( int8_t( -1 ));
28 1 : testValues.push_back( uint8_t( 1 ));
29 1 : testValues.push_back( int16_t( -10 ));
30 1 : testValues.push_back( uint16_t( 10 ));
31 1 : testValues.push_back( int32_t( -100 ));
32 1 : testValues.push_back( uint32_t( 100 ));
33 1 : testValues.push_back( int64_t( -1000 ));
34 1 : testValues.push_back( uint64_t( 1000 ));
35 1 : testValues.push_back( bool( false ));
36 1 : testValues.push_back( float( 5.42f ));
37 1 : testValues.push_back( double( 17.56789 ));
38 1 : testValues.push_back( std::string( "blablub" ));
39 1 : testValues.push_back( servus::uint128_t( servus::make_uint128( "bla")));
40 2 : Foo foo = {42, 1.5f, false, "blablub"};
41 1 : testValues.push_back( foo );
42 :
43 15 : BOOST_FOREACH( const lunchbox::Any& any, testValues )
44 : {
45 14 : textSerializeAndTest( any );
46 14 : binarySerializeAndTest( any );
47 : }
48 :
49 2 : return EXIT_SUCCESS;
50 3 : }
|