Project

General

Profile

Task #823

Implement unit tests for src/gromacs/analysisdata

Added by Teemu Murtola over 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
testing
Target version:
Difficulty:
uncategorized
Close

Description

Currently only very basic tests exist for code under src/gromacs/analysisdata/, but the code would benefit from more thorough testing. It would not be too difficult to write some supporting functionality using Google Mock and src/testutils/refdata.h that would allow testing the basic AnalysisData class as well as all classes that implement both AnalysisDataModuleInterface and AbstractAnalysisData (which covers most of the modules/ subdirectory) with very little additional code; the main effort would then be to produce good input data and check that the output is correct.

Associated revisions

Revision 3ff5a60a (diff)
Added by Teemu Murtola about 8 years ago

Remove state from TestReferenceData.

Moved all check*() methods from TestReferenceData into a separate class,
TestReferenceChecker. Also replaced startCompound()/finishCompound()
pair with a checkCompound() method that returns a new instance of
TestReferenceChecker that works within that compound. This allows one
to create multiple TestReferenceChecker objects within one test and
use them independently to compare different data against the reference.
It also simplifies the internal logic in the classes somewhat.

Also some minor updates to documentation of the classes.

Prerequisite for issue #823.

Conflicts:

src/gromacs/selection/tests/selectioncollection.cpp

Change-Id: I822e60d469462d4f5d441fe8243836d800cbb82d

Revision 5d47c268 (diff)
Added by Teemu Murtola about 8 years ago

Improve array handling in TestReferenceChecher.

Make it possible to use the checker with const arrays and with
real-valued arrays. For simplicity, renamed all the array overloads to
checkSequenceArray(), since there should be no reason to call an
overload that does not match the type.

Prerequisite for issue #823.

Change-Id: I34de06bcc9ddd392bc3d5390e4aabaf97952270a

Revision 706acb16 (diff)
Added by Teemu Murtola about 8 years ago

Unused TestReferenceData no longer does anything.

The reference data framework no longer creates a refdata/ directory for
every test binary (even if the test binary did not use the framework).
Also, TestReferenceData now only reports failure for missing data if
rootChecker() is actually called. Similarly, reference data is only
written if rootChecker() has been called. This makes it easier to write
test fixtures that provide reference data comparison that may not be
used in all tests.

Helps implementing issue #823.

Change-Id: I7c8dc18a8de9d47f41977ab7c9a7052df582b53d

Revision e666f7b6 (diff)
Added by Teemu Murtola almost 8 years ago

Added more analysisdata unit tests.

There is now a framework that makes it quite easy to write tests for
classes that implement the AbstractAnalysisData interface.
Used the framework to implement a more thorough set of tests for the
AnalysisData class, and some simple tests for AnalysisDataAverageModule.

Part of issue #823.

Change-Id: I3bea1f722848e6ebb0bd6fb8f5983ea09f1aeb9e

Revision 9af5fe15 (diff)
Added by Teemu Murtola almost 8 years ago

Added some more analysisdata unit tests.

Added support for multipoint data to the analysis data testing
framework, and added some more tests for AnalysisData using it.

Also fixed a bug (found by the new tests) with frameCount() not being
properly updated for multipoint data. The count is now kept by
AbstractAnalysisData, so derived classes no longer need to worry about
keeping it up-to-date.

Part of issue #823.

Change-Id: I672fbfb2ec5898b8118616574646f1432c7c0ce1

Revision 92501485 (diff)
Added by Teemu Murtola almost 8 years ago

Rewrote analysisdata histograms and added tests.

There were a few bugs and some usability issues with the histogram
implementation in the analysisdata module. Fixing those resulted in a
rewrite of most of the code, but only a few changes outside the module.

Also added unit tests for the histogram modules. This required slight
improvements to the handling of multipoint data in the analysisdata test
framework.

Will add a few more tests for the AbstractAverageHistogram class in a
separate commit, as this requires some additional changes in the test
framework, and this commit is already quite large.

Part of issue #823.

Change-Id: I81b37ce437262e3aabc48c08b0f4faf5e6738545

Revision 89c1e2b6 (diff)
Added by Teemu Murtola almost 8 years ago

Added unit tests for array data and minor improvements.

Added unit tests for AnalysisArrayData and some non-trivial methods in
AbstractAverageHistogram. The analysis data test framework now contains
a method for filling an array data object from test input data.

Also fixed some issues in AbstractAnalysisArrayData, made read-only
accessors in public, added a few more methods to extract information,
and made the class use std::vector internally for memory management
instead of snew/sfree.

Part of issue #823.

Change-Id: I1d768e2763861f326b4e5a7cb94f5f82f0d56a9e

History

#1 Updated by Teemu Murtola over 8 years ago

  • Assignee set to Teemu Murtola

#2 Updated by Teemu Murtola over 8 years ago

  • Status changed from New to In Progress

#3 Updated by Teemu Murtola about 8 years ago

  • Status changed from In Progress to Feedback wanted
  • Target version set to 5.0

There is now a series of commits (Ibb4a5ac4 to I1d768e27) that adds unit tests for most of the analysisdata module. The main things missing are the displacement module (which is more of a mock-up quality, so it is better to add tests when it is in a bit more final form) and the plot module (which is quite simple, and would require a different testing approach to check the produced files). For now, the tests added in those commits should be sufficient to close this issue.

#4 Updated by Teemu Murtola almost 8 years ago

  • Status changed from Feedback wanted to Closed

Mentioned changes have been merged a while back.

#5 Updated by Teemu Murtola almost 6 years ago

  • Project changed from Next-generation analysis tools to GROMACS
  • Category set to testing

Also available in: Atom PDF