dune-community / dune-xt-common

Other
2 stars 3 forks source link

Make float compare (tests) work (meaningfully) for integer types #14

Closed renefritze closed 8 years ago

renefritze commented 8 years ago

I ran into the problem of having written generic code that uses our float compare to handle vector valued comparisons and only afterwards got integers as input. Float compare tests currently are only run for double and complex<double>. In the https://github.com/dune-community/dune-xt-common/tree/float_cmp_tests_for_integer branch I've started work towards fixing that. I'm however now getting an exception from the test fixture ctor telling me that the requested configuration subtree is not available. Could you maybe have a look at that @tobiasleibner ? I don't easily see what's going on there.

tobiasleibner commented 8 years ago

That is a problem of using the dynamic variations feature of dune-testtools for the test. You have to add the corresponding .ini file to the test call, e.g. for test_float_cmp_long_numpy the call would be

./test_float_cmp_long_numpy long_numpy.ini

This should be done automatically by the CTest tests. Currently, we are using the dynamic variations only to avoid "code will never be executed" warnings in the

if (/* comparison is relative */)
   /* do something */
else
  /* do something else */

parts of the test that would arise if we do the differentiation between relative and absolute comparisons statically. Maybe we could think of a better way to avoid this warning so we can statically set the comparison type in the test file.

renefritze commented 8 years ago

Since I get the exception on ninja test as well, does that mean the meta-ini magic is constructing a wrong ini file name for the long case?

tobiasleibner commented 8 years ago

I am not getting these failures locally. I fixed some errors in the actual test code in f0e5c9e4b4ae6777e65a9e603e9fec7f00bd355d and now both ctest and ninja test compile and run without failures for me.

renefritze commented 8 years ago

Still no clue what happend here, but it works now w/o exception after pulling you change. Thanks! I've simplified the setup a little by replacing the extra config option with a type traits check.