]> https://gitweb.dealii.org/ - dealii.git/commitdiff
More tests.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 10 Oct 2009 01:45:32 +0000 (01:45 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 10 Oct 2009 01:45:32 +0000 (01:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@19796 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/index_set_01.cc
tests/base/index_set_02.cc [new file with mode: 0644]
tests/base/index_set_02/cmp/generic [new file with mode: 0644]

index afb74844dd8d3844432fad557a527b20c9ab5bdc..522637e27f801a4f12f9297d6b04f5f1808c0726 100644 (file)
@@ -11,7 +11,7 @@
 //
 //-----------------------------------------------------------------------------
 
-// test functions in namespace Utilities
+// test IndexSet::is_element
 
 #include "../tests.h"
 #include <iomanip>
diff --git a/tests/base/index_set_02.cc b/tests/base/index_set_02.cc
new file mode 100644 (file)
index 0000000..86d1708
--- /dev/null
@@ -0,0 +1,60 @@
+//-----------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2009 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.
+//
+//-----------------------------------------------------------------------------
+
+// test IndexSet::is_contiguous and compress()
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <base/index_set.h>
+
+
+void test ()
+{
+  IndexSet index_set (10);
+  index_set.add_index (2);
+  index_set.add_index (3);
+  index_set.add_index (4);
+  deallog << (index_set.is_contiguous() ? "true" : "false")
+         << std::endl;
+  Assert (index_set.is_contiguous() == true, ExcInternalError());
+
+  for (unsigned int i=0; i<index_set.size(); ++i)
+    deallog << i << ' ' << (index_set.is_element(i) ? "true" : "false")
+           << std::endl;
+
+  index_set.add_index (6);
+  deallog << (index_set.is_contiguous() ? "true" : "false")
+         << std::endl;
+  Assert (index_set.is_contiguous() == false, ExcInternalError());
+
+  for (unsigned int i=0; i<index_set.size(); ++i)
+    deallog << i << ' ' << (index_set.is_element(i) ? "true" : "false")
+           << std::endl;
+}
+
+
+
+
+int main()
+{
+  std::ofstream logfile("index_set_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
diff --git a/tests/base/index_set_02/cmp/generic b/tests/base/index_set_02/cmp/generic
new file mode 100644 (file)
index 0000000..00d6009
--- /dev/null
@@ -0,0 +1,21 @@
+
+DEAL::0 false
+DEAL::1 false
+DEAL::2 true
+DEAL::3 true
+DEAL::4 false
+DEAL::5 false
+DEAL::6 true
+DEAL::7 false
+DEAL::8 true
+DEAL::9 false
+DEAL::10 false
+DEAL::11 false
+DEAL::12 true
+DEAL::13 true
+DEAL::14 true
+DEAL::15 true
+DEAL::16 true
+DEAL::17 true
+DEAL::18 false
+DEAL::19 false

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.