From 4b5c3290add4cffe0a8dbb621b86e3b51c59be28 Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Thu, 10 Aug 2017 23:20:07 -0500
Subject: [PATCH] tests: Fix up a couple of tests that didn't take the last
 commit lightly

---
 tests/base/is_finite.cc                        |  2 ++
 tests/base/is_finite_complex.cc                |  2 ++
 tests/base/log_nan.cc                          |  2 ++
 tests/base/polynomial_minus_equals.cc          |  5 +++--
 tests/codim_one/integrate_one_over_r_telles.cc | 10 +++-------
 tests/hp/step-27.cc                            |  1 +
 tests/integrators/maxwell_curl.cc              |  8 ++------
 tests/lac/constraints_c1.cc                    |  8 ++------
 tests/multigrid/mg_renumbered_01.cc            |  5 ++---
 9 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/tests/base/is_finite.cc b/tests/base/is_finite.cc
index c5c2325f61..96ba2548c8 100644
--- a/tests/base/is_finite.cc
+++ b/tests/base/is_finite.cc
@@ -17,7 +17,9 @@
 // check numbers::is_finite
 
 #include "../tests.h"
+
 #include <limits>
+#include <cfenv>
 
 
 template <typename T>
diff --git a/tests/base/is_finite_complex.cc b/tests/base/is_finite_complex.cc
index bf7a9d7a37..869cfcc3a9 100644
--- a/tests/base/is_finite_complex.cc
+++ b/tests/base/is_finite_complex.cc
@@ -17,7 +17,9 @@
 // check numbers::is_finite for complex arguments
 
 #include "../tests.h"
+
 #include <limits>
+#include <cfenv>
 
 
 template <typename T>
diff --git a/tests/base/log_nan.cc b/tests/base/log_nan.cc
index 240e4e3995..3b204f9121 100644
--- a/tests/base/log_nan.cc
+++ b/tests/base/log_nan.cc
@@ -18,7 +18,9 @@
 // list. the test should actually output "nan", but prints "0"
 
 #include "../tests.h"
+
 #include <limits>
+#include <cfenv>
 
 int main ()
 {
diff --git a/tests/base/polynomial_minus_equals.cc b/tests/base/polynomial_minus_equals.cc
index 1b27c8e54c..ba1e41834a 100644
--- a/tests/base/polynomial_minus_equals.cc
+++ b/tests/base/polynomial_minus_equals.cc
@@ -18,6 +18,8 @@
 //
 // check on the Polynomial::operator -=
 
+#include "../tests.h"
+
 #include <deal.II/base/polynomial.h>
 
 #include <iostream>
@@ -28,9 +30,8 @@ using namespace dealii;
 
 int main ()
 {
-  std::ofstream logfile("output");
+  initlog();
   deallog << std::setprecision(3);
-  deallog.attach(logfile);
 
   //      subtract two equal polynomials up to order p_dim
   //      the result evaluated at an arbitrary point
diff --git a/tests/codim_one/integrate_one_over_r_telles.cc b/tests/codim_one/integrate_one_over_r_telles.cc
index 8c7bee3cfb..3d9c59f56d 100644
--- a/tests/codim_one/integrate_one_over_r_telles.cc
+++ b/tests/codim_one/integrate_one_over_r_telles.cc
@@ -1,6 +1,4 @@
 // ---------------------------------------------------------------------
-// $Id: integrate_one_over_r.cc 30338 2013-08-18 22:02:27Z heltai $
-//
 // Copyright (C) 2005 - 2015 by the deal.II authors
 //
 // This file is part of the deal.II library.
@@ -14,6 +12,8 @@
 //
 // ---------------------------------------------------------------------
 
+#include "../tests.h"
+
 // integrates the function *f(x,y)/R, where f(x,y) is a power of x and
 // y on the set [0,1]x[0,1]. dim = 2 only.
 
@@ -26,8 +26,6 @@
 
 #include <string>
 
-#include <math.h>
-
 using namespace std;
 using namespace dealii;
 
@@ -39,12 +37,10 @@ exact_integral_one_over_r (
   const unsigned int i, const unsigned int j,
   const unsigned int vertex_index);
 
-ofstream logfile("output");
-
 int
 main ()
 {
-  deallog.attach(logfile);
+  initlog();
   deallog << std::fixed;
 
   deallog << endl
diff --git a/tests/hp/step-27.cc b/tests/hp/step-27.cc
index 7b3de5f80d..c2d02527a6 100644
--- a/tests/hp/step-27.cc
+++ b/tests/hp/step-27.cc
@@ -50,6 +50,7 @@
 
 #include <iostream>
 #include <complex>
+#include <fstream>
 
 
 namespace Step27
diff --git a/tests/integrators/maxwell_curl.cc b/tests/integrators/maxwell_curl.cc
index f63da24bcf..d525ec6071 100644
--- a/tests/integrators/maxwell_curl.cc
+++ b/tests/integrators/maxwell_curl.cc
@@ -18,8 +18,7 @@
 
 // Test curl related functions in integrators/maxwell.h
 
-#include <cstring>
-#include <iostream>
+#include "../tests.h"
 
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/tria.h>
@@ -96,10 +95,7 @@ void TestMaxwellCurl(Triangulation<dim> &tr)
 
 int main()
 {
-  const std::string logname = "output";
-  std::ofstream logfile(logname.c_str());
-  deallog.attach(logfile);
-  deallog.threshold_double(1.e-10);
+  initlog();
 
   Triangulation<3> tr;
   make_grid(tr);
diff --git a/tests/lac/constraints_c1.cc b/tests/lac/constraints_c1.cc
index cf7ac994d9..40ab873732 100644
--- a/tests/lac/constraints_c1.cc
+++ b/tests/lac/constraints_c1.cc
@@ -23,6 +23,7 @@
 // This is because it contains a cycle. The test now checks that this
 // is detected.
 
+#include "../tests.h"
 
 #include <deal.II/base/job_identifier.h>
 #include <deal.II/grid/grid_generator.h>
@@ -30,8 +31,6 @@
 #include <deal.II/fe/fe_q.h>
 #include <deal.II/dofs/dof_tools.h>
 
-#include <iostream>
-
 using namespace dealii;
 
 template <int dim>
@@ -167,10 +166,7 @@ run(const FiniteElement<dim> &fe)
 int main()
 {
   deal_II_exceptions::disable_abort_on_exception();
-
-  const std::string logname = "output";
-  std::ofstream logfile(logname.c_str());
-  deallog.attach(logfile);
+  initlog();
 
   FE_Q<2> fe(3);
   run(fe);
diff --git a/tests/multigrid/mg_renumbered_01.cc b/tests/multigrid/mg_renumbered_01.cc
index 883871de81..d6a413b80f 100644
--- a/tests/multigrid/mg_renumbered_01.cc
+++ b/tests/multigrid/mg_renumbered_01.cc
@@ -13,6 +13,7 @@
 //
 // ---------------------------------------------------------------------
 
+#include "../tests.h"
 
 #include <deal.II/base/quadrature_lib.h>
 #include <deal.II/base/function.h>
@@ -474,10 +475,8 @@ void LaplaceProblem<dim>::run ()
 
 int main ()
 {
-  std::ofstream logfile("output");
+  initlog();
   deallog << std::setprecision(4);
-  deallog.attach(logfile);
-  deallog.threshold_double(1.e-10);
 
   LaplaceProblem<2> laplace_problem_2d(1);
   laplace_problem_2d.run ();
-- 
2.39.5