From: Wolfgang Bangerth Date: Thu, 1 Nov 2018 14:23:07 +0000 (-0600) Subject: Add a few tests. X-Git-Tag: v9.1.0-rc1~583^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=969a61d618c4217439aad5b8e6bd30053cfb5172;p=dealii.git Add a few tests. --- diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc b/tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc new file mode 100644 index 0000000000..94e3af2216 --- /dev/null +++ b/tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc @@ -0,0 +1,77 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// test that DynamicSparsityPattern::iterator yields something +// sensible for empty sparsity patterns + +#include + +#include "../tests.h" + + +void +test() +{ + DynamicSparsityPattern sp(5, 5); + // put nothing into the sparsity pattern + sp.compress(); + + DynamicSparsityPattern::const_iterator i = sp.begin(); + for (; i != sp.end(); ++i) + deallog << i->row() << ' ' << i->column() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int +main() +{ + initlog(); + + try + { + test(); + } + catch (std::exception &exc) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_07.output b/tests/sparsity/dynamic_sparsity_pattern_iterator_07.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/sparsity/dynamic_sparsity_pattern_iterator_07.output @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc b/tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc new file mode 100644 index 0000000000..288d6000e6 --- /dev/null +++ b/tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc @@ -0,0 +1,77 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// test that DynamicSparsityPattern::iterator yields something +// sensible for empty sparsity patterns with zero rows/columns + +#include + +#include "../tests.h" + + +void +test() +{ + DynamicSparsityPattern sp; + // put nothing into the sparsity pattern + sp.compress(); + + DynamicSparsityPattern::const_iterator i = sp.begin(); + for (; i != sp.end(); ++i) + deallog << i->row() << ' ' << i->column() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int +main() +{ + initlog(); + + try + { + test(); + } + catch (std::exception &exc) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_08.output b/tests/sparsity/dynamic_sparsity_pattern_iterator_08.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/sparsity/dynamic_sparsity_pattern_iterator_08.output @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/sparsity/sparsity_pattern_iterator_07.cc b/tests/sparsity/sparsity_pattern_iterator_07.cc new file mode 100644 index 0000000000..350812553b --- /dev/null +++ b/tests/sparsity/sparsity_pattern_iterator_07.cc @@ -0,0 +1,79 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// test that SparsityPattern::iterator yields something +// sensible for empty sparsity patterns + +#include + +#include "../tests.h" + + +void +test() +{ + // use a non-square sparsity pattern to make sure the object does + // not automatically store the diagonals + SparsityPattern sp(5, 6, 3); + // put nothing into the sparsity pattern + sp.compress(); + + SparsityPattern::const_iterator i = sp.begin(); + for (; i != sp.end(); ++i) + deallog << i->row() << ' ' << i->column() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int +main() +{ + initlog(); + + try + { + test(); + } + catch (std::exception &exc) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/sparsity/sparsity_pattern_iterator_07.output b/tests/sparsity/sparsity_pattern_iterator_07.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_iterator_07.output @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/sparsity/sparsity_pattern_iterator_08.cc b/tests/sparsity/sparsity_pattern_iterator_08.cc new file mode 100644 index 0000000000..1461a11a67 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_iterator_08.cc @@ -0,0 +1,77 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// test that SparsityPattern::iterator yields something +// sensible for empty sparsity patterns with zero rows/columns + +#include + +#include "../tests.h" + + +void +test() +{ + SparsityPattern sp; + // put nothing into the sparsity pattern + sp.compress(); + + SparsityPattern::const_iterator i = sp.begin(); + for (; i != sp.end(); ++i) + deallog << i->row() << ' ' << i->column() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int +main() +{ + initlog(); + + try + { + test(); + } + catch (std::exception &exc) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + deallog << std::endl + << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/sparsity/sparsity_pattern_iterator_08.output b/tests/sparsity/sparsity_pattern_iterator_08.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_iterator_08.output @@ -0,0 +1,2 @@ + +DEAL::OK