On 2013-04-09 12:22, Lars Vingli Odsæter wrote:
What would be the best practise for such unit tests?
The unit test should:
(1) Return 0 from main if success, other values indicate failure
(2) Not write anything to console if success
(3) Only read or write files in the current directory
Regarding point (3) I have been thinking if perhaps a directory with
input files should be passed on the command-line, but that would require
us to call `make check` instead of `make test`.
Currently, the files listed in TEST_DATA_FILES in CMakeLists_files.cmake
are copied from the source tree to the build tree (if different), so you
can have the reference solutions there.
boost::unit_test is preferred as the framework, because this is already
probed for and configured by the build system, but is not required.
Will all *_test.cpp files in opm-upscaling/tests automatically be
recognised as unit tests by the build system and ran when calling
'make test'?
Not anymore. Each file that are listed in TEST_SOURCE_FILES, defined in
CMakeLists_files.cmake are compiled into a corresponding test (program
in bin/) and executed as part of the test suite.
It is preferred that these have the prefix "test_" so they don't collide
with any other executables (examples and utilities) that may be built.
At this time, only one compilation unit is allowed as part of each test
(i.e. you cannot have common routines in a module that is linked in with
both). Also, you cannot use other libraries that those already used by
the main library. And: yes, these are a serious shortcomings.
--
Roland.
_______________________________________________
Opm mailing list
[email protected]
http://www.opm-project.org/mailman/listinfo/opm