From 55185d951a3ccefe46facff819ad960a9873a3f2 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 29 Apr 2004 17:39:20 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@9121 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/petsc_62.cc | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/bits/petsc_62.cc diff --git a/tests/bits/petsc_62.cc b/tests/bits/petsc_62.cc new file mode 100644 index 0000000000..5a05cdbbf2 --- /dev/null +++ b/tests/bits/petsc_62.cc @@ -0,0 +1,80 @@ +//---------------------------- petsc_62.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. +// +//---------------------------- petsc_62.cc --------------------------- + + +// check PETScWrappers::MatrixBase::clear () + +#include "../tests.h" +#include +#include + +#include +#include +#include + + +void test (PETScWrappers::MatrixBase &m) +{ + Assert (m.m() != 0, ExcInternalError()); + Assert (m.n() != 0, ExcInternalError()); + + m.clear (); + + Assert (m.m() == 0, ExcInternalError()); + Assert (m.n() == 0, ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main (int argc,char **argv) +{ + std::ofstream logfile("petsc_62.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + try + { + PetscInitialize(&argc,&argv,0,0); + { + PETScWrappers::SparseMatrix v (100,100,5); + test (v); + } + PetscFinalize(); + } + 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