Den 9. apr. 2013 kl. 12:22 skrev Lars Vingli Odsæter:

> Hi list,
> 
> I have just started the work of providing opm-upscaling with some unit tests. 
> Other modules, e.g. opm-porsol, have some unit tests that are called by 'make 
> test', so I find it natural to use the same test environment. I see that 
> these use some boost-routines (e.g. BOOST_AUTO_TEST_CASE). The aim for the 
> unit tests for opm-upscaling is to check whether the applications in 
> build/bin/ calculates correctly, i.e., give as input some small test models 
> and compare the results to a reference solution. What would be the best 
> practise for such unit tests? And how should these tests be added to the 
> build system? 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'?

I think such tests or benchmarks are very useful, thank you for starting with 
this. There are some difficulties though, for example a change to a linear 
solver can result in slightly different answers while being just as valid. As a 
result, you cannot expect identical output for such a case. The boost test 
environment includes BOOST_TEST_CLOSE to handle such things.

For building, you need to add it in CMakeLists_files.cmake:

list (APPEND TEST_SOURCE_FILES
 tests/test_something.cpp
 …

Atgeirr


_______________________________________________
Opm mailing list
[email protected]
http://www.opm-project.org/mailman/listinfo/opm

Reply via email to