andreww / fox

A Fortran XML library
https://andreww.github.io/fox/
Other
60 stars 51 forks source link

Added more tests cases (those located into Fox_library/test folder. #40

Open victorsndvg opened 9 years ago

victorsndvg commented 9 years ago

Tests will be compiled and performed with CTest if BUILD_TESTING CMake variable is set to ON.

Minor fix in sax/test/m_canonicalize.f90 when applying len() to a dictionary_t type.

Note: Some tests failed! I don't know if it is the expected behaviour, but I cannot check all the existing tests. Some tests are dependant on a test.xml file that actually doesn't exists, maybe there are dependencies between tests (something like first write then read)?

andreww commented 8 years ago

Sorry - dropped the ball on this... start of term here. Anyway, thanks for the patch.

I think the failures are because some test cases are supposed to exit with an error. For example, we want to test that an attempt to write '' with wxml fails with an error. This is an example - and we check that this comes out on standard error.

I guess the question is if we can do this sort of testing with cmake. That is check that we get certain output as well as check that the code builds and runs without returning a non-zero exit code (which is what I think is happening now). Our general rule is that tests called "file.f90" alongside a file called "file.xml" should run and produce the XML document. Tests called "file.f90" alongside a file called "file.out" should fail to run and generate the error message in the .out file. The current test harness is cobbled together out of shell scripts and sticky tape, and I wonder if it is possible to replicate this.

I'll try and think about this some more, and read the ctest documentation properly. But I don't know that I'll be able to do this quickly.

victorsndvg commented 8 years ago

Hi @andreww ,

is a good question, but I cannot give you light on that.

I hope to have some time as soon as possible to read about that and give you an answer, but actually I don't know how do this kind of test/comparisson.

In a fast search I've found the following post:

http://cmake.3232098.n2.nabble.com/testing-with-standard-output-td3256689.html

It makes reference to the execute_process CMake command and the CMake comparisson util (cmake -E compare_files)