From 969a61d618c4217439aad5b8e6bd30053cfb5172 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 1 Nov 2018 08:23:07 -0600 Subject: [PATCH] Add a few tests. --- .../dynamic_sparsity_pattern_iterator_07.cc | 77 ++++++++++++++++++ ...ynamic_sparsity_pattern_iterator_07.output | 2 + .../dynamic_sparsity_pattern_iterator_08.cc | 77 ++++++++++++++++++ ...ynamic_sparsity_pattern_iterator_08.output | 2 + .../sparsity/sparsity_pattern_iterator_07.cc | 79 +++++++++++++++++++ .../sparsity_pattern_iterator_07.output | 2 + .../sparsity/sparsity_pattern_iterator_08.cc | 77 ++++++++++++++++++ .../sparsity_pattern_iterator_08.output | 2 + 8 files changed, 318 insertions(+) create mode 100644 tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc create mode 100644 tests/sparsity/dynamic_sparsity_pattern_iterator_07.output create mode 100644 tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc create mode 100644 tests/sparsity/dynamic_sparsity_pattern_iterator_08.output create mode 100644 tests/sparsity/sparsity_pattern_iterator_07.cc create mode 100644 tests/sparsity/sparsity_pattern_iterator_07.output create mode 100644 tests/sparsity/sparsity_pattern_iterator_08.cc create mode 100644 tests/sparsity/sparsity_pattern_iterator_08.output 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 -- 2.39.5