]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New tests.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Feb 2004 20:06:28 +0000 (20:06 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Feb 2004 20:06:28 +0000 (20:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@8439 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/vector_equality_5.cc [new file with mode: 0644]
tests/bits/vector_equality_6.cc [new file with mode: 0644]
tests/bits/vector_equality_7.cc [new file with mode: 0644]
tests/bits/vector_equality_8.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_5.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_6.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_7.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_8.output [new file with mode: 0644]

diff --git a/tests/bits/vector_equality_5.cc b/tests/bits/vector_equality_5.cc
new file mode 100644 (file)
index 0000000..94d00f3
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  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<float>) for vectors that are not
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<float> &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());
+  Assert (!(w==v), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_5.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<float> 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_6.cc b/tests/bits/vector_equality_6.cc
new file mode 100644 (file)
index 0000000..f1ec9b6
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  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<float>) for vectors that are
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<float> &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());
+  Assert (w==v, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_6.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<float> 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_7.cc b/tests/bits/vector_equality_7.cc
new file mode 100644 (file)
index 0000000..5258ea6
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  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<float>) for vectors that are not
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<float> &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());
+  Assert (w!=v, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_7.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<float> 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_8.cc b/tests/bits/vector_equality_8.cc
new file mode 100644 (file)
index 0000000..88114fe
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  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<float>) for vectors that are
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<float> &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());
+  Assert (! (w!=v), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("vector_equality_8.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<float> 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/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_5.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_5.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_6.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_6.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_7.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_7.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_8.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/vector_equality_8.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+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.