[Dune] [Dune-Commit] dune-common r6629 - trunk/dune/common/test

Christian Engwer christian.engwer at uni-muenster.de
Tue Apr 17 16:18:08 CEST 2012


Dear Christoph,

while I welcome cleanup work in general, I would still like you to
discuss such changes before applying them. There was no real need for
this change and we do not have any policy for the naming of test
programs. Once there is a more general decision for such type of
changes it is fine to apply any change that is necessary to fulfill
the policy.

In this context I would like you review your changes a bit more
carefully before committing (also in the light of Olivers recent email)
and want to remind Robert, that he agreed to mentor/sponsor you.

Beside these critics, I want to thank you for all the other work.

Cheers
Christian

On Tue, Apr 17, 2012 at 01:38:47PM +0200, gruenich at dune-project.org wrote:
> Author: gruenich
> Date: 2012-04-17 13:38:46 +0200 (Tue, 17 Apr 2012)
> New Revision: 6629
> 
> Added:
>    trunk/dune/common/test/testfloatcmp.cc
> Removed:
>    trunk/dune/common/test/float_cmp.cc
> Modified:
>    trunk/dune/common/test/
>    trunk/dune/common/test/Makefile.am
> Log:
> Renamed test float_cmp.cc to testfloatcmp.cc to avoid name clash with dune/common/float_cmp.cc.
> 
> 
> 
> Property changes on: trunk/dune/common/test
> ___________________________________________________________________
> Modified: svn:ignore
>    - Makefile
> Makefile.in
> .deps
> .libs
> semantic.cache
> dynvectortest
> fvectortest
> mpicollcomm
> lrutest
> test-stack
> arraylisttest
> shared_ptrtest
> float_cmp
> bitsetvectortest
> iteratorfacadetest
> sllisttest
> tuplestest
> tupleutilitytest
> enumsettest
> fmatrixtest
> dynmatrixtest
> polyallocator
> poolallocatortest
> *.gcda
> *.gcno
> gmon.out
> gcdlcmtest
> streamtest
> exprtmpl
> timing_xpr
> timing_old
> timing_flt
> bigunsignedinttest
> mpiguardtest
> mpihelpertest
> singletontest
> utilitytest
> testfassign_fail1
> testfassign_fail2
> testfassign_fail3
> testfassign_fail4
> testfassign_fail5
> testfassign_fail6
> testfassign1
> testfassign2
> testfassign3
> testfassign4
> smallobject
> conversiontest
> configparsertest
> nullptr-test
> blockbitfieldtest
> deprtuplestest
> fassigntest
> iteratorfacadetest2
> static_assert_test
> parametertreetest
> tags
> pathtest
> TAGS
> mpihelpertest2
> testfconstruct
> arraytest
> shared_ptrtest_config
> shared_ptrtest_dune
> tuplestest_dune
> tuplestest_std
> tuplestest_tr1
> check_fvector_size
> 
>    + Makefile
> Makefile.in
> .deps
> .libs
> semantic.cache
> dynvectortest
> fvectortest
> mpicollcomm
> lrutest
> test-stack
> arraylisttest
> shared_ptrtest
> testfloatcmp
> bitsetvectortest
> iteratorfacadetest
> sllisttest
> tuplestest
> tupleutilitytest
> enumsettest
> fmatrixtest
> dynmatrixtest
> polyallocator
> poolallocatortest
> *.gcda
> *.gcno
> gmon.out
> gcdlcmtest
> streamtest
> exprtmpl
> timing_xpr
> timing_old
> timing_flt
> bigunsignedinttest
> mpiguardtest
> mpihelpertest
> singletontest
> utilitytest
> testfassign_fail1
> testfassign_fail2
> testfassign_fail3
> testfassign_fail4
> testfassign_fail5
> testfassign_fail6
> testfassign1
> testfassign2
> testfassign3
> testfassign4
> smallobject
> conversiontest
> configparsertest
> nullptr-test
> blockbitfieldtest
> deprtuplestest
> fassigntest
> iteratorfacadetest2
> static_assert_test
> parametertreetest
> tags
> pathtest
> TAGS
> mpihelpertest2
> testfconstruct
> arraytest
> shared_ptrtest_config
> shared_ptrtest_dune
> tuplestest_dune
> tuplestest_std
> tuplestest_tr1
> check_fvector_size
> 
> 
> Modified: trunk/dune/common/test/Makefile.am
> ===================================================================
> --- trunk/dune/common/test/Makefile.am	2012-04-17 10:04:47 UTC (rev 6628)
> +++ trunk/dune/common/test/Makefile.am	2012-04-17 11:38:46 UTC (rev 6629)
> @@ -13,7 +13,6 @@
>      dynvectortest \
>      enumsettest \
>      fassigntest \
> -    float_cmp \
>      fmatrixtest \
>      fvectortest \
>      gcdlcmtest \
> @@ -45,6 +44,7 @@
>      testfassign_fail5 \
>      testfassign_fail6 \
>      testfconstruct \
> +    testfloatcmp \
>      tuplestest_dune \
>      tuplestest_std \
>      tuplestest_tr1 \
> @@ -239,7 +239,7 @@
>  
>  sourcescheck_NOSOURCES = exprtmpl.cc timing.cc
>  
> -float_cmp_SOURCES = float_cmp.cc
> +testfloatcmp_SOURCES = testfloatcmp.cc
>  
>  genericiterator_compile_fail_SOURCES = genericiterator_compile_fail.cc
>  
> 
> Deleted: trunk/dune/common/test/float_cmp.cc
> ===================================================================
> --- trunk/dune/common/test/float_cmp.cc	2012-04-17 10:04:47 UTC (rev 6628)
> +++ trunk/dune/common/test/float_cmp.cc	2012-04-17 11:38:46 UTC (rev 6629)
> @@ -1,156 +0,0 @@
> -// Test the new (Dune) interface of float_cmp
> -
> -#ifdef HAVE_CONFIG_H
> -#include "config.h"
> -#endif
> -
> -#include <iostream>
> -
> -#include <dune/common/float_cmp.hh>
> -
> -using std::cout;
> -using std::endl;
> -using std::flush;
> -
> -/////////////////////////
> -//
> -//  compile time checks
> -//
> -
> -// check that we can access the functions as FloatCmp::function from within the Dune namespace
> -namespace Dune {
> -  void checkNamespaceAccess() {
> -    FloatCmp::eq(0.0, 0.0);
> -  }
> -} // namespace Dune
> -// check that we can access the functions as FloatCmp::function with using namespace Dune
> -void checkUsingAccess() {
> -  using namespace Dune;
> -  FloatCmp::eq(0.0, 0.0);
> -}
> -
> -// run time checks
> -const char* repr(bool b) {
> -  if(b) return "true ";
> -  else  return "false";
> -}
> -
> -int passed = 0;
> -int failed = 0;
> -
> -void count(bool pass) {
> -  if(pass) { cout << "passed"; ++passed; }
> -  else     { cout << "failed"; ++failed; }
> -}
> -
> -template<typename F>
> -void tests(F f1, F f2, typename Dune::FloatCmp::EpsilonType<F>::Type eps, bool inside)
> -{
> -  bool result;
> -
> -  cout << "eq(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> -  result = Dune::FloatCmp::eq(f1, f2, eps);
> -  cout << repr(result) << "\t";
> -  count(result == inside);
> -  cout << endl;
> -
> -  cout << "ge(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> -  result = Dune::FloatCmp::ge(f1, f2, eps);
> -  cout << repr(result) << "\t";
> -  count(result == (inside || f1 > f2));
> -  cout << endl;
> -
> -  cout << "le(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> -  result = Dune::FloatCmp::le(f1, f2, eps);
> -  cout << repr(result) << "\t";
> -  count(result == (inside || f1 < f2));
> -  cout << endl;
> -
> -  cout << "ne(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> -  result = Dune::FloatCmp::ne(f1, f2, eps);
> -  cout << repr(result) << "\t";
> -  count(result == !inside);
> -  cout << endl;
> -
> -  cout << "gt(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> -  result = Dune::FloatCmp::gt(f1, f2, eps);
> -  cout << repr(result) << "\t";
> -  count(result == (!inside && f1 > f2));
> -  cout << endl;
> -
> -  cout << "lt(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> -  result = Dune::FloatCmp::lt(f1, f2, eps);
> -  cout << repr(result) << "\t";
> -  count(result == (!inside && f1 < f2));
> -  cout << endl;
> -}
> -
> -template<typename F>
> -void tests(F f1, F f2, const typename Dune::FloatCmpOps<F> &ops, bool inside)
> -{
> -  bool result;
> -  cout << "ops = operations(" << ops.epsilon() << ")" << endl;
> -
> -  cout << "ops.eq(" << f1 << ", " << f2 << ") = " << flush;
> -  result = ops.eq(f1, f2);
> -  cout << repr(result) << "\t";
> -  count(result == inside);
> -  cout << endl;
> -
> -  cout << "ops.ge(" << f1 << ", " << f2 << ") = " << flush;
> -  result = ops.ge(f1, f2);
> -  cout << repr(result) << "\t";
> -  count(result == (inside || f1 > f2));
> -  cout << endl;
> -
> -  cout << "ops.le(" << f1 << ", " << f2 << ") = " << flush;
> -  result = ops.le(f1, f2);
> -  cout << repr(result) << "\t";
> -  count(result == (inside || f1 < f2));
> -  cout << endl;
> -
> -  cout << "ops.ne(" << f1 << ", " << f2 << ") = " << flush;
> -  result = ops.ne(f1, f2);
> -  cout << repr(result) << "\t";
> -  count(result == !inside);
> -  cout << endl;
> -
> -  cout << "ops.gt(" << f1 << ", " << f2 << ") = " << flush;
> -  result = ops.gt(f1, f2);
> -  cout << repr(result) << "\t";
> -  count(result == (!inside && f1 > f2));
> -  cout << endl;
> -
> -  cout << "ops.lt(" << f1 << ", " << f2 << ") = " << flush;
> -  result = ops.lt(f1, f2);
> -  cout << repr(result) << "\t";
> -  count(result == (!inside && f1 < f2));
> -  cout << endl;
> -}
> -
> -int main() {
> -  cout.setf(std::ios_base::scientific, std::ios_base::floatfield);
> -  cout.precision(16);
> -  Dune::FloatCmpOps<double> ops(1e-7);
> -
> -  cout << "Tests inside the epsilon environment" << endl;
> -  tests<double>(1.0, 1.00000001, 1e-7, true);
> -  tests<double>(1.0, 1.00000001, ops,  true);
> -
> -  cout << "Tests outside the epsilon environment, f1 < f2" << endl;
> -  tests<double>(1.0, 1.000001, 1e-7, false);
> -  tests<double>(1.0, 1.000001, ops,  false);
> -
> -  cout << "Tests outside the epsilon environment, f1 > f2" << endl;
> -  tests<double>(1.000001, 1.0, 1e-7, false);
> -  tests<double>(1.000001, 1.0, ops,  false);
> -
> -  cout << "Tests with f1 = f2 = 0" << endl;
> -  tests<double>(0, 0, 1e-7, true);
> -  tests<double>(0, 0, ops,  true);
> -
> -  int total = passed + failed;
> -  cout << passed << "/" << total << " tests passed; " << failed << "/" << total << " tests failed" << endl;
> -  if(failed > 0) return 1;
> -  else           return 0;
> -}
> 
> Copied: trunk/dune/common/test/testfloatcmp.cc (from rev 6628, trunk/dune/common/test/float_cmp.cc)
> ===================================================================
> --- trunk/dune/common/test/testfloatcmp.cc	                        (rev 0)
> +++ trunk/dune/common/test/testfloatcmp.cc	2012-04-17 11:38:46 UTC (rev 6629)
> @@ -0,0 +1,156 @@
> +// Test the new (Dune) interface of float_cmp
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include <iostream>
> +
> +#include <dune/common/float_cmp.hh>
> +
> +using std::cout;
> +using std::endl;
> +using std::flush;
> +
> +/////////////////////////
> +//
> +//  compile time checks
> +//
> +
> +// check that we can access the functions as FloatCmp::function from within the Dune namespace
> +namespace Dune {
> +  void checkNamespaceAccess() {
> +    FloatCmp::eq(0.0, 0.0);
> +  }
> +} // namespace Dune
> +// check that we can access the functions as FloatCmp::function with using namespace Dune
> +void checkUsingAccess() {
> +  using namespace Dune;
> +  FloatCmp::eq(0.0, 0.0);
> +}
> +
> +// run time checks
> +const char* repr(bool b) {
> +  if(b) return "true ";
> +  else  return "false";
> +}
> +
> +int passed = 0;
> +int failed = 0;
> +
> +void count(bool pass) {
> +  if(pass) { cout << "passed"; ++passed; }
> +  else     { cout << "failed"; ++failed; }
> +}
> +
> +template<typename F>
> +void tests(F f1, F f2, typename Dune::FloatCmp::EpsilonType<F>::Type eps, bool inside)
> +{
> +  bool result;
> +
> +  cout << "eq(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> +  result = Dune::FloatCmp::eq(f1, f2, eps);
> +  cout << repr(result) << "\t";
> +  count(result == inside);
> +  cout << endl;
> +
> +  cout << "ge(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> +  result = Dune::FloatCmp::ge(f1, f2, eps);
> +  cout << repr(result) << "\t";
> +  count(result == (inside || f1 > f2));
> +  cout << endl;
> +
> +  cout << "le(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> +  result = Dune::FloatCmp::le(f1, f2, eps);
> +  cout << repr(result) << "\t";
> +  count(result == (inside || f1 < f2));
> +  cout << endl;
> +
> +  cout << "ne(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> +  result = Dune::FloatCmp::ne(f1, f2, eps);
> +  cout << repr(result) << "\t";
> +  count(result == !inside);
> +  cout << endl;
> +
> +  cout << "gt(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> +  result = Dune::FloatCmp::gt(f1, f2, eps);
> +  cout << repr(result) << "\t";
> +  count(result == (!inside && f1 > f2));
> +  cout << endl;
> +
> +  cout << "lt(" << f1 << ", " << f2 << ", " << eps << ") = " << flush;
> +  result = Dune::FloatCmp::lt(f1, f2, eps);
> +  cout << repr(result) << "\t";
> +  count(result == (!inside && f1 < f2));
> +  cout << endl;
> +}
> +
> +template<typename F>
> +void tests(F f1, F f2, const typename Dune::FloatCmpOps<F> &ops, bool inside)
> +{
> +  bool result;
> +  cout << "ops = operations(" << ops.epsilon() << ")" << endl;
> +
> +  cout << "ops.eq(" << f1 << ", " << f2 << ") = " << flush;
> +  result = ops.eq(f1, f2);
> +  cout << repr(result) << "\t";
> +  count(result == inside);
> +  cout << endl;
> +
> +  cout << "ops.ge(" << f1 << ", " << f2 << ") = " << flush;
> +  result = ops.ge(f1, f2);
> +  cout << repr(result) << "\t";
> +  count(result == (inside || f1 > f2));
> +  cout << endl;
> +
> +  cout << "ops.le(" << f1 << ", " << f2 << ") = " << flush;
> +  result = ops.le(f1, f2);
> +  cout << repr(result) << "\t";
> +  count(result == (inside || f1 < f2));
> +  cout << endl;
> +
> +  cout << "ops.ne(" << f1 << ", " << f2 << ") = " << flush;
> +  result = ops.ne(f1, f2);
> +  cout << repr(result) << "\t";
> +  count(result == !inside);
> +  cout << endl;
> +
> +  cout << "ops.gt(" << f1 << ", " << f2 << ") = " << flush;
> +  result = ops.gt(f1, f2);
> +  cout << repr(result) << "\t";
> +  count(result == (!inside && f1 > f2));
> +  cout << endl;
> +
> +  cout << "ops.lt(" << f1 << ", " << f2 << ") = " << flush;
> +  result = ops.lt(f1, f2);
> +  cout << repr(result) << "\t";
> +  count(result == (!inside && f1 < f2));
> +  cout << endl;
> +}
> +
> +int main() {
> +  cout.setf(std::ios_base::scientific, std::ios_base::floatfield);
> +  cout.precision(16);
> +  Dune::FloatCmpOps<double> ops(1e-7);
> +
> +  cout << "Tests inside the epsilon environment" << endl;
> +  tests<double>(1.0, 1.00000001, 1e-7, true);
> +  tests<double>(1.0, 1.00000001, ops,  true);
> +
> +  cout << "Tests outside the epsilon environment, f1 < f2" << endl;
> +  tests<double>(1.0, 1.000001, 1e-7, false);
> +  tests<double>(1.0, 1.000001, ops,  false);
> +
> +  cout << "Tests outside the epsilon environment, f1 > f2" << endl;
> +  tests<double>(1.000001, 1.0, 1e-7, false);
> +  tests<double>(1.000001, 1.0, ops,  false);
> +
> +  cout << "Tests with f1 = f2 = 0" << endl;
> +  tests<double>(0, 0, 1e-7, true);
> +  tests<double>(0, 0, ops,  true);
> +
> +  int total = passed + failed;
> +  cout << passed << "/" << total << " tests passed; " << failed << "/" << total << " tests failed" << endl;
> +  if(failed > 0) return 1;
> +  else           return 0;
> +}
> 
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
> 




More information about the Dune mailing list