Boost logo

Boost :

Subject: Re: [boost] How do folks test serialization code?
From: Robert Ramey (ramey_at_[hidden])
Date: 2013-08-05 12:22:10

John Maddock wrote:
> 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.

Note that a key design feature of the serialization library is that
serialization of types is meant to be totally de-coupled from
archive format. That is - any serializable type is guarenteed
to work with any any archive class and any archive class
is guarenteed to handle any serializable type. This is the
reasoning behind "carpet bombing" - testing each serializable
type in the library against every archive class.

There is also documentation in the serialization library on
how to use bjam to run this testing on your own
serializable types.

Upshot is - if your type full fills the requirement of
being a serializable type - it should just work. If
you don't trust me on this, you can easily make
one test - and run it against all known archive

I'm supposing that this is why in ten years no
one has asked this question - because it hasn't
actually come up.

Also this implies that your cp_int serialization
shouldn't have knowledge of the machine architecture.

Note that some archives - text base ones and
portable binary archives address all issues related
to portability between architectures. So your
type cp_int shouldn't need anything special as
to 16/32/64 archive compatibility.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at