From: wolf Date: Mon, 8 Aug 2005 17:06:21 +0000 (+0000) Subject: New test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c82e20424782758a44ae6e7770f1275e9d64181;p=dealii-svn.git New test. git-svn-id: https://svn.dealii.org/trunk@11243 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/accessor_equality.cc b/tests/bits/accessor_equality.cc new file mode 100644 index 0000000000..031919c6cd --- /dev/null +++ b/tests/bits/accessor_equality.cc @@ -0,0 +1,106 @@ +//---------------------------- accessor_equality.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005 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. +// +//---------------------------- accessor_equality.cc --------------------------- + +// test for equality of accessor objects + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + + +template +void test () +{ + deallog << dim << 'd' << std::endl; + + Triangulation tria; + GridGenerator::hyper_cube (tria,0,1); + tria.refine_global (1); + + deallog << tria.begin_active() << std::endl; + + // test a few comparison operators + { + const typename Triangulation::active_cell_iterator + cell = tria.begin_active(); + Assert (cell == cell, ExcInternalError()); + Assert (! (cell != cell), ExcInternalError()); + Assert (! (cell < cell), ExcInternalError()); + } + + // same with non-active iterators + { + const typename Triangulation::cell_iterator + cell = tria.begin(); + Assert (cell == cell, ExcInternalError()); + Assert (! (cell != cell), ExcInternalError()); + Assert (! (cell < cell), ExcInternalError()); + } + + FE_Q fe (1); + DoFHandler dof_handler (tria); + dof_handler.distribute_dofs (fe); + + // now do the same tests with the + // DoFHandler iterators + { + const typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + Assert (cell == cell, ExcInternalError()); + Assert (! (cell != cell), ExcInternalError()); + Assert (! (cell < cell), ExcInternalError()); + } + { + const typename DoFHandler::cell_iterator + cell = dof_handler.begin(); + Assert (cell == cell, ExcInternalError()); + Assert (! (cell != cell), ExcInternalError()); + Assert (! (cell < cell), ExcInternalError()); + } + + // finally check that two iterators + // pointing into different DoFHandlers + // can't be the same + // + // this test accidentally failed before a + // fix was checked in on 2005-08-08 that + // completely forbids comparing iterators + // into different DoFHandlers at all + { + DoFHandler dof_handler2 (tria); + dof_handler2.distribute_dofs (fe); + Assert (dof_handler.begin_active() != dof_handler2.begin_active(), + ExcInternalError()); + } +} + + +int main () +{ + std::ofstream logfile("accessor_equality.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + test<1> (); + test<2> (); + test<3> (); +}