]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a testcase for a recent patch.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 8 Jan 2015 07:00:33 +0000 (01:00 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 8 Jan 2015 07:00:33 +0000 (01:00 -0600)
tests/base/utilities_08.cc [new file with mode: 0644]
tests/base/utilities_08.output [new file with mode: 0644]

diff --git a/tests/base/utilities_08.cc b/tests/base/utilities_08.cc
new file mode 100644 (file)
index 0000000..33c7045
--- /dev/null
@@ -0,0 +1,53 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2013, 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.
+//
+// ---------------------------------------------------------------------
+
+
+// Utilities::int_to_string produced wrong results with numbers larger
+// than 10 digits (including padding)
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <deal.II/base/utilities.h>
+
+
+void test ()
+{
+  deallog << Utilities::int_to_string (9,10) << std::endl;
+  deallog << Utilities::int_to_string (99,10) << std::endl;
+  deallog << Utilities::int_to_string (999,10) << std::endl;
+  deallog << Utilities::int_to_string (9999,10) << std::endl;
+  deallog << Utilities::int_to_string (99999,10) << std::endl;
+  deallog << Utilities::int_to_string (999999,10) << std::endl;
+  deallog << Utilities::int_to_string (9999999,10) << std::endl;
+  deallog << Utilities::int_to_string (99999999,10) << std::endl;
+  deallog << Utilities::int_to_string (999999999,10) << std::endl;
+}
+
+
+
+
+int main()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
diff --git a/tests/base/utilities_08.output b/tests/base/utilities_08.output
new file mode 100644 (file)
index 0000000..8bb06f4
--- /dev/null
@@ -0,0 +1,10 @@
+
+DEAL::0000000009
+DEAL::0000000099
+DEAL::0000000999
+DEAL::0000009999
+DEAL::0000099999
+DEAL::0000999999
+DEAL::0009999999
+DEAL::0099999999
+DEAL::0999999999

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.