From: wolf Date: Thu, 26 Feb 2004 23:04:24 +0000 (+0000) Subject: Add test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee5d42e4f424dc7b5cb9b221627413f138b4251a;p=dealii-svn.git Add test. git-svn-id: https://svn.dealii.org/trunk@8586 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/vector_49.cc b/tests/bits/vector_49.cc new file mode 100644 index 0000000000..fa4263d036 --- /dev/null +++ b/tests/bits/vector_49.cc @@ -0,0 +1,82 @@ +//---------------------------- vector_49.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- vector_49.cc --------------------------- + + +// check copy constructor Vector::Vector(Vector) for same template +// argument + +#include "../tests.h" +#include +#include +#include +#include + + +void test (Vector &v) +{ + // set some entries of the vector + for (unsigned int i=0; i w (v); + + // make sure they're equal + deallog << v*w << ' ' << v.l2_norm() * w.l2_norm() + << ' ' << v*w - v.l2_norm() * w.l2_norm() << std::endl; + Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < 1e-14*(v*w), + ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main () +{ + std::ofstream logfile("vector_49.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + try + { + Vector v (100); + test (v); + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +}