Boost logo

Boost :

Subject: Re: [boost] How do folks test serialization code?
From: John Maddock (john_at_[hidden])
Date: 2013-08-05 03:56:44


> Very good questions - in ten years no one has asked this.

Oh :-(

>> Title almost says it all, how do you verify that your classes
>> serialization code is truly platform independent,
>
> This would not apply to binary archives as these are not guarenteed to
> be portable.
>
> The case were archives are created on one platform and
> loaded on another is not explicitly tested.
>
>>and doesn't accidently break later?
>
> Hmmm I'm not sure how one could test that things aren't going
> to break later.

Allow me to explain - I've experimented with adding serialization support to
Boost.Multiprecision - amounst other things this would allow those types to
be used with MPI for massively parrellel applications (but I digress).

Now, binary archives are no issue, a simple loopback test is enough.

But since I know the internals of the classes are platform specific, I've
had to come up with a serialization format (for cpp_int for example) which
is platform independent. Or at least I think it is. I tend to assume that
anything not tested doesn't work. Maybe I'll just create some sample
archives on 32 and 64 bit platforms and try reading them.

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk