From b3085c736faa835617f7cbdfbb81eaa905c00736 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 23 Aug 2017 11:05:05 -0600 Subject: [PATCH] Add tests. --- tests/dofs/invalid_iterators_01.cc | 49 ++++++++++++++++++++++++++ tests/dofs/invalid_iterators_01.output | 4 +++ tests/dofs/invalid_iterators_02.cc | 48 +++++++++++++++++++++++++ tests/dofs/invalid_iterators_02.output | 4 +++ 4 files changed, 105 insertions(+) create mode 100644 tests/dofs/invalid_iterators_01.cc create mode 100644 tests/dofs/invalid_iterators_01.output create mode 100644 tests/dofs/invalid_iterators_02.cc create mode 100644 tests/dofs/invalid_iterators_02.output diff --git a/tests/dofs/invalid_iterators_01.cc b/tests/dofs/invalid_iterators_01.cc new file mode 100644 index 0000000000..6122de94f7 --- /dev/null +++ b/tests/dofs/invalid_iterators_01.cc @@ -0,0 +1,49 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// check that assigning one invalid iterator to another works. this +// test is for ::DoFHandler + +#include "../tests.h" +#include +#include +#include + + +template +void check () +{ + typename DoFHandler::active_cell_iterator invalid_1; + + // try copy constructor + typename DoFHandler::active_cell_iterator invalid_2 = invalid_1; + + // now also try copy operator + invalid_1 = invalid_2; + + deallog << "OK" << std::endl; +} + + + +int main() +{ + initlog(); + + check<1>(); + check<2>(); + check<3>(); +} diff --git a/tests/dofs/invalid_iterators_01.output b/tests/dofs/invalid_iterators_01.output new file mode 100644 index 0000000000..fb71de2867 --- /dev/null +++ b/tests/dofs/invalid_iterators_01.output @@ -0,0 +1,4 @@ + +DEAL::OK +DEAL::OK +DEAL::OK diff --git a/tests/dofs/invalid_iterators_02.cc b/tests/dofs/invalid_iterators_02.cc new file mode 100644 index 0000000000..221355e59d --- /dev/null +++ b/tests/dofs/invalid_iterators_02.cc @@ -0,0 +1,48 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// check that assigning one invalid iterator to another works. this +// test is for hp::DoFHandler + +#include "../tests.h" +#include +#include +#include + + +template +void check () +{ + typename hp::DoFHandler::active_cell_iterator invalid_1; + + // try copy constructor + typename hp::DoFHandler::active_cell_iterator invalid_2 = invalid_1; + + // now also try copy operator + invalid_1 = invalid_2; + + deallog << "OK" << std::endl; +} + + + +int main() +{ + initlog(); + + check<1>(); + check<2>(); + check<3>(); +} diff --git a/tests/dofs/invalid_iterators_02.output b/tests/dofs/invalid_iterators_02.output new file mode 100644 index 0000000000..fb71de2867 --- /dev/null +++ b/tests/dofs/invalid_iterators_02.output @@ -0,0 +1,4 @@ + +DEAL::OK +DEAL::OK +DEAL::OK -- 2.39.5