From 10ce7bd7c5b4b468252237713a0a201387dfcbed Mon Sep 17 00:00:00 2001 From: Christian Engwer <christi@dune-project.org> Date: Fri, 14 Dec 2007 00:00:08 +0000 Subject: [PATCH] test for fassign stuff [[Imported from SVN: r5028]] --- common/test/.gitignore | 5 +++++ common/test/Makefile.am | 22 +++++++++++++++++++++- common/test/testfassign.cc | 37 +++++++++++++++++++++++++++++++++++++ common/test/testfassign2.cc | 4 ++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 common/test/testfassign.cc create mode 100644 common/test/testfassign2.cc diff --git a/common/test/.gitignore b/common/test/.gitignore index ddc92a3b8..5a470863c 100644 --- a/common/test/.gitignore +++ b/common/test/.gitignore @@ -29,3 +29,8 @@ bigunsignedinttest mpihelpertest singletontest utilitytest +testfassign_fail1 +testfassign_fail2 +testfassign1 +testfassign2 +testfassign3 diff --git a/common/test/Makefile.am b/common/test/Makefile.am index 937b548e4..ba503917a 100644 --- a/common/test/Makefile.am +++ b/common/test/Makefile.am @@ -4,11 +4,16 @@ TESTPROGS = parsetest test-stack arraylisttest smartpointertest \ sllisttest iteratorfacadetest tuplestest fvectortest fmatrixtest \ poolallocatortest settest gcdlcdtest streamtest \ bigunsignedinttest mpihelpertest singletontest mpicollcomm \ - utilitytest lrutest + utilitytest lrutest \ + testfassign1 testfassign2 testfassign3 \ + testfassign_fail1 testfassign_fail2 + # which tests to run TESTS = $(TESTPROGS) +XFAIL_TESTS = testfassign_fail1 testfassign_fail2 + # programs just to build when "make check" is used check_PROGRAMS = $(TESTPROGS) @@ -76,6 +81,21 @@ singletontest_LDFLAGS = $(LOCAL_LIBS) utilitytest_SOURCES = utilitytest.cc utilitytest_LDFLAGS = $(LOCAL_LIBS) +testfassign1_SOURCES = testfassign.cc testfassign2.cc +testfassign1_CPPFLAGS = $(AM_CPPFLAGS) -D_SIZE=3 -D_VALUES="1,2,3" + +testfassign2_SOURCES = testfassign.cc +testfassign2_CPPFLAGS = $(AM_CPPFLAGS) -D_SIZE=3 -D_VALUES="1,Dune::zero" + +testfassign3_SOURCES = testfassign.cc +testfassign3_CPPFLAGS = $(AM_CPPFLAGS) -D_SIZE=3 -D_VALUES="Dune::zero" + +testfassign_fail1_SOURCES = testfassign.cc +testfassign_fail1_CPPFLAGS = $(AM_CPPFLAGS) -D_SIZE=3 -D_VALUES="1,2" + +testfassign_fail2_SOURCES = testfassign.cc +testfassign_fail2_CPPFLAGS = $(AM_CPPFLAGS) -D_SIZE=3 -D_VALUES="1,2,3,4" + sourcescheck_NOSOURCES = exprtmpl.cc timing.cc include $(top_srcdir)/am/global-rules diff --git a/common/test/testfassign.cc b/common/test/testfassign.cc new file mode 100644 index 000000000..ce2c5863c --- /dev/null +++ b/common/test/testfassign.cc @@ -0,0 +1,37 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +#include "config.h" +#include <iostream> +#include <dune/common/fvector.hh> +#include <dune/common/fassign.hh> + +int main () +{ + try + { + static const int sz = _SIZE; + Dune::FieldVector<int,sz> v; + + v <<= _VALUES; + + for (int i=0; i<sz; i++) + std::cout << "value[" << i << "] = " << v[i] << "\n"; + + return 0; + } + catch (Dune::MathError &e) + { + std::cerr << "Dune reported MathError: " << e << std::endl; + return 1; + } + catch (Dune::Exception &e) + { + std::cerr << "Dune reported error: " << e << std::endl; + return 1; + } + catch (...) + { + std::cerr << "Unknown exception thrown!" << std::endl; + return 1; + } +} diff --git a/common/test/testfassign2.cc b/common/test/testfassign2.cc new file mode 100644 index 000000000..095073460 --- /dev/null +++ b/common/test/testfassign2.cc @@ -0,0 +1,4 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +#include "config.h" +#include <dune/common/fassign.hh> -- GitLab