From 06eab8b8bb319cb7afe6c8f356a1470f585ef6ed Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 26 Feb 2004 23:04:24 +0000 Subject: [PATCH] Add test. git-svn-id: https://svn.dealii.org/trunk@8586 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/vector_49.cc | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 tests/bits/vector_49.cc 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; + }; +} -- 2.39.5