]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 15 Oct 2009 20:21:17 +0000 (20:21 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 15 Oct 2009 20:21:17 +0000 (20:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@19889 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/base/index_set_11.cc b/tests/base/index_set_11.cc
new file mode 100644 (file)
index 0000000..2f545d5
--- /dev/null
@@ -0,0 +1,71 @@
+//-----------------------------------------------------------------------------
+//    $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::add_indices
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <base/index_set.h>
+
+
+void test ()
+{
+  IndexSet index_set (10);
+
+  {
+    const unsigned int array[] = { 2, 3, 4 };
+    index_set.add_indices ((const unsigned int*)array, array+sizeof(array)/sizeof(array[0]));
+  }
+  {
+    const unsigned int array[] = { 7,6 };
+    index_set.add_indices ((const unsigned int*)array, array+sizeof(array)/sizeof(array[0]));
+  }
+
+  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;
+
+
+  {
+    const unsigned int array[] = { 5 };
+    index_set.add_indices ((const unsigned int*)array, array+sizeof(array)/sizeof(array[0]));
+  }
+
+  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;
+
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+
+int main()
+{
+  std::ofstream logfile("index_set_11/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
diff --git a/tests/base/index_set_11/cmp/generic b/tests/base/index_set_11/cmp/generic
new file mode 100644 (file)
index 0000000..7e19ed2
--- /dev/null
@@ -0,0 +1,22 @@
+
+DEAL::0 false
+DEAL::1 false
+DEAL::2 true
+DEAL::3 true
+DEAL::4 true
+DEAL::5 false
+DEAL::6 true
+DEAL::7 true
+DEAL::8 false
+DEAL::9 false
+DEAL::0 false
+DEAL::1 false
+DEAL::2 true
+DEAL::3 true
+DEAL::4 true
+DEAL::5 true
+DEAL::6 true
+DEAL::7 true
+DEAL::8 false
+DEAL::9 false
+DEAL::OK

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.