Refactor TestReferenceData lifetime management
authorTeemu Murtola <teemu.murtola@gmail.com>
Sat, 1 Aug 2015 18:40:20 +0000 (21:40 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 8 Sep 2015 11:13:49 +0000 (13:13 +0200)
commit6e4b7f9bf393c4b4b26028f7518b1bb4157f0481
tree2f690a517db3ceaad88626bc6f9d8ad5685ea303
parentfb61c93bdb9379ea0ceab14af72fee6ddd1636fc
Refactor TestReferenceData lifetime management

Keep a global instance of the TestReferenceData implementation object,
and add a test event listener that interacts with it.  This allows
moving the final processing for the reference data out of the
destructor, making it behave better with exceptions, and still keeping
the same simple interface that the class provides.  This enables further
refactoring that would otherwise add a lot more logic into the
destructor.  Also, better sanity checks are possible for incorrect usage
of the reference data (e.g., creating multiple instances within the same
test).

Move libxml2 cleanup into the same listener to have it done at a more
appropriate step.

Change-Id: I69f85aca68a0e0374093ea169bd4ef6c0431caff
src/testutils/refdata.cpp
src/testutils/refdata.h
src/testutils/testinit.cpp