예제 #1
0
파일: serialize.cpp 프로젝트: asuBeta/dash
int main( int , char ** )
{
    dash::NodePtr root = createSampleNode();

    dash::NodePtr outRoot = new dash::Node;

    textSerialize( *root, *outRoot );
    TEST( areEqual( root, outRoot ));

    binarySerialize( *root, *outRoot );
    TEST( areEqual( root, outRoot ));

    return EXIT_SUCCESS;
}
예제 #2
0
파일: serialize.cpp 프로젝트: garfy7/dash
int dash::test::main( int argc, char **argv )
{
    dash::AttributePtr outAttribute = new dash::Attribute;

    dash::AttributePtr intAttribute = new dash::Attribute( 42 );
    textSerialize( *intAttribute, *outAttribute );
    TEST( intAttribute->get<int>() == outAttribute->get<int>( ))
    binarySerialize( *intAttribute, *outAttribute );
    TEST( intAttribute->get<int>() == outAttribute->get<int>( ))

    dash::AttributePtr floatAttribute = new dash::Attribute( 42.f );
    textSerialize( *floatAttribute, *outAttribute );
    TEST( floatAttribute->get<float>() == outAttribute->get<float>( ))

    dash::AttributePtr stringAttribute =
                                     new dash::Attribute( std::string( "bla" ));
    textSerialize( *stringAttribute, *outAttribute );
    TEST( stringAttribute->get<std::string>() ==
          outAttribute->get<std::string>( ))

    dash::AttributePtr uint128Attribute =
                      new dash::Attribute( lunchbox::uint128_t( 12345, 54321 ));
    textSerialize( *uint128Attribute, *outAttribute );
    TEST( uint128Attribute->get<lunchbox::uint128_t>() ==
          outAttribute->get<lunchbox::uint128_t>( ))

    Foo foo = {42, 1.5f, false, "blablub"};
    dash::AttributePtr fooAttribute = new dash::Attribute( foo );
    textSerialize( *fooAttribute, *outAttribute );
    const Foo& outFoo = outAttribute->get<Foo>();
    TEST( foo.i == outFoo.i );
    TEST( foo.f == outFoo.f );
    TEST( foo.b == outFoo.b );
    TEST( foo.s == outFoo.s );

    return EXIT_SUCCESS;
}