]> https://gitweb.dealii.org/ - dealii.git/commitdiff
added a failing test
authorDenis Davydov <davydden@gmail.com>
Tue, 3 Feb 2015 14:01:06 +0000 (15:01 +0100)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 3 Feb 2015 15:21:29 +0000 (09:21 -0600)
tests/base/tensor_nondefault_constructor.cc [new file with mode: 0644]
tests/base/tensor_nondefault_constructor.output [new file with mode: 0644]

diff --git a/tests/base/tensor_nondefault_constructor.cc b/tests/base/tensor_nondefault_constructor.cc
new file mode 100644 (file)
index 0000000..6357f57
--- /dev/null
@@ -0,0 +1,72 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 1998 - 2014 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// Same as tensor.cc, but uses tensors based on floats instead of doubles
+
+#include "../tests.h"
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/vector.h>
+#include <fstream>
+#include <iomanip>
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  float a[3][3] = {{1, 2, 3}, {3, 4, 5}, {6, 7, 8}};
+  float b[3]    = {25,31,37};
+
+  const unsigned int dim=3;
+  
+  // rank 2
+  {
+       Tensor<2,dim,float> t(a);
+       Tensor<2,dim,double> dt(t), dt2;
+       dt2 = t;
+       Assert (dt2 == dt, ExcInternalError());
+  
+       Tensor<2,dim,float> ft(dt), ft2;
+       ft2 = dt;
+       Assert (ft2 == ft, ExcInternalError());
+  
+       Tensor<2,dim,std::complex<double> > ct(dt), ct2;
+       ct2 = dt;
+       Assert (ct2 == ct, ExcInternalError());
+  }
+  
+  // rank 1
+  {
+       Tensor<1,dim,float> t(b);
+       Tensor<1,dim,double> dt(t), dt2;
+       dt2 = t;
+       Assert (dt2 == dt, ExcInternalError());
+  
+       Tensor<1,dim,float> ft(dt),ft2;
+    ft2 = dt;
+    Assert (ft2 == ft, ExcInternalError());
+  
+    Tensor<1,dim,std::complex<double>> ct(dt), ct2;
+    ct2 = dt;
+       Assert (ct2 == ct, ExcInternalError());
+  }
+  
+  deallog << "OK." << std::endl;
+}
diff --git a/tests/base/tensor_nondefault_constructor.output b/tests/base/tensor_nondefault_constructor.output
new file mode 100644 (file)
index 0000000..6b3ab10
--- /dev/null
@@ -0,0 +1 @@
+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.