Update of /cvsroot/pclasses/pclasses2/src/s11n
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12146/src/s11n
Modified Files:
test.cpp
Log Message:
Now actually demonstrates that the deser'd data was what it serialized.
Index: test.cpp
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/src/s11n/test.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test.cpp 26 Dec 2004 01:54:34 -0000 1.3
+++ test.cpp 26 Dec 2004 02:06:57 -0000 1.4
@@ -97,7 +97,7 @@
{
CERR << "P::s11n tests...\n";
typedef std::auto_ptr<TheBase> BAP;
- BAP b1 = BAP( new AType );
+ BAP b1 = BAP( new BType );
NODE_TYPE node;
assert( SERIALIZE(node,TheBase,b1.get() ) );
CERR << "Serialize Workie!\n";
@@ -127,19 +127,36 @@
bool worked;
CERR << "Containers...\n";
- assert( SERIALIZE(node,ListT,list) );
+ assert( ::P::s11n::serialize(node,list) );
list.clear();
worked = ::P::s11n::deserialize( node, list );
assert( worked && "deser list failed :(" );
- CERR << "deser list.size() == " << list.size()<<"\n";
node.clear();
- assert( SERIALIZE(node,MapT,map) );
+ assert( ::P::s11n::serialize(node,map) );
map.clear();
worked = ::P::s11n::deserialize( node, map );
assert( worked && "deser map failed :(" );
+
+ CERR << "Deserialized:\n";
+
+ CERR << "deser list.size() == " << list.size()<<"\n";
CERR << "map.size() == " << map.size()<<"\n";
+ // now prove it...
+
+ ListT::const_iterator lit = list.begin();
+ size_t at = 0;
+ while( lit != list.end() )
+ {
+ CERR << "list["<<at++<<"] = " << (*(lit++))<<"\n";
+ }
+ MapT::const_iterator mit = map.begin();
+ while( mit != map.end() )
+ {
+ CERR << "map["<<(*mit).first<<"] = "<<(*mit).second<<"\n";
+ ++mit;
+ }
return 0;
}
|