]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add a test 4300/head
authorDenis Davydov <davydden@gmail.com>
Mon, 24 Apr 2017 15:51:38 +0000 (17:51 +0200)
committerDenis Davydov <davydden@gmail.com>
Mon, 24 Apr 2017 15:51:38 +0000 (17:51 +0200)
tests/base/point_02.cc [new file with mode: 0644]
tests/base/point_02.output [new file with mode: 0644]

diff --git a/tests/base/point_02.cc b/tests/base/point_02.cc
new file mode 100644 (file)
index 0000000..6a68967
--- /dev/null
@@ -0,0 +1,56 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2010 - 2015 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.
+//
+// ---------------------------------------------------------------------
+
+
+// test for Point::distance_square()
+
+#include "../tests.h"
+#include <deal.II/base/point.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/vector.h>
+#include <fstream>
+#include <iomanip>
+
+
+template <int dim>
+void check ()
+{
+  Point<dim> p1, p2;
+  for (unsigned int i=0; i<dim; ++i)
+    {
+      p1[i] = 10.0 + 0.12345 * i;
+      p1[i] = 0.5 + 0.6789   * i;
+    }
+
+  const double d  = p1.distance(p2);
+  const double d2 = p1.distance_square(p2);
+
+  AssertThrow(std::abs(d-std::sqrt(d2)) < 1e-10,
+              ExcInternalError())
+
+  deallog << "Ok" << std::endl;
+}
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.threshold_double(1.e-10);
+
+  check<1>();
+  check<2>();
+  check<3>();
+}
diff --git a/tests/base/point_02.output b/tests/base/point_02.output
new file mode 100644 (file)
index 0000000..9800fc0
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL::Ok
+DEAL::Ok
+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.