]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test. Presently fails on mainline, but will be fixed on the PETSc branch.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Feb 2004 14:37:57 +0000 (14:37 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Feb 2004 14:37:57 +0000 (14:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@8433 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/vector_equality_1.cc [new file with mode: 0644]
tests/bits/vector_equality_2.cc [new file with mode: 0644]
tests/bits/vector_equality_3.cc [new file with mode: 0644]
tests/bits/vector_equality_4.cc [new file with mode: 0644]

diff --git a/tests/bits/vector_equality_1.cc b/tests/bits/vector_equality_1.cc
new file mode 100644 (file)
index 0000000..d2bd7d9
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  vector_equality_1.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_equality_1.cc  ---------------------------
+
+
+// check Vector<double>::operator==(Vector<double>) for vectors that are not
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+
+  Assert (!(v==w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_1.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/vector_equality_2.cc b/tests/bits/vector_equality_2.cc
new file mode 100644 (file)
index 0000000..46a3d4c
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_equality_2.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_equality_2.cc  ---------------------------
+
+
+// check Vector<double>::operator==(Vector<double>) for vectors that are
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (v==w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_2.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/vector_equality_3.cc b/tests/bits/vector_equality_3.cc
new file mode 100644 (file)
index 0000000..54593a2
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  vector_equality_3.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_equality_3.cc  ---------------------------
+
+
+// check Vector<double>::operator!=(Vector<double>) for vectors that are not
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+
+  Assert (v!=w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_3.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/vector_equality_4.cc b/tests/bits/vector_equality_4.cc
new file mode 100644 (file)
index 0000000..741ea0f
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_equality_4.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_equality_4.cc  ---------------------------
+
+
+// check Vector<double>::operator!=(Vector<double>) for vectors that are
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (! (v!=w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_4.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}

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.