On Sat, Dec 23, 2017 at 11:25 AM, Robert Ramey via Boost < boost@lists.boost.org> wrote:
On 12/23/17 7:58 AM, James E. King, III via Boost wrote:
I'm looking at adding a test to write out a version 0 and then read it in when the current version is 1, but I don't want to add test-only support code to the headers that get shipped, so if anyone can point me at a current example unit test that writes out a "n-1" version and then reads in a "n" version with boost::serialization I would appreciate it.
This is something which would be very useful and has always been desired.
a) It would be quite a bit of work to implement such a series of tests b) and describe how to set it up c) The serialization library already places a lot of burden on the testing infrastructure. This would increases that load significantly.
Robert Ramey
Two ways I can see doing this: 1. Craft a version 0 output stream manually or with the help of serialization code directly in the test, then read it in. 2. Typically the conditionals for version are on the load() side; is there a way to tell archive to: ar << use_version<boost::posix_time::ptime, 0>() << ptime(some_value) and add conditional code to the save() code path so that it would write out a version 0 like the previous release did? I'm not sure it's typical to see the version number actually used in the save() code path. That would be pretty useful and allow for understandable unit tests, but I don't know how easy it would be to implement. - Jim