]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 11 Aug 2005 15:17:21 +0000 (15:17 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 11 Aug 2005 15:17:21 +0000 (15:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@11285 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/Makefile
tests/base/utilities_01.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/base/utilities_01.output [new file with mode: 0644]

index 7c51f7181a932bf4da7d5bfc913be8286954af23..ebf87b9702f5be6bd0aa9671f9f3fbe498a2a79f 100644 (file)
@@ -38,7 +38,8 @@ tests_x =  logtest \
           anisotropic_* \
            hierarchical \
           data_out_base \
-          function_parser
+          function_parser \
+          utilities_*
 
 # from above list of regular expressions, generate the real set of
 # tests
diff --git a/tests/base/utilities_01.cc b/tests/base/utilities_01.cc
new file mode 100644 (file)
index 0000000..16bee34
--- /dev/null
@@ -0,0 +1,67 @@
+//-----------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 by the deal.II authors
+//
+//    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.
+//
+//-----------------------------------------------------------------------------
+
+// test functions in namespace Utilities
+
+#include "../tests.h"
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <base/utilities.h>
+
+
+void test () 
+{
+  deallog << Utilities::int_to_string (42,4) << std::endl;
+  deallog << Utilities::needed_digits (424) << std::endl;
+  deallog << Utilities::string_to_int (" 413 ") << std::endl;
+
+  std::vector<std::string> v;
+  v.push_back ("1");
+  v.push_back (" -12");
+  v.push_back ("+125 ");
+  Assert (Utilities::string_to_int (v).size() == 3, ExcInternalError());
+  deallog << Utilities::string_to_int (v)[0] << std::endl;
+  deallog << Utilities::string_to_int (v)[1] << std::endl;
+  deallog << Utilities::string_to_int (v)[2] << std::endl;
+
+  const char *p = "alpha, beta, gamma ";
+  Assert (Utilities::split_comma_separated_list (p).size() == 3,
+          ExcInternalError());
+  Assert (Utilities::split_comma_separated_list (p)[0] == "alpha",
+          ExcInternalError());  
+  Assert (Utilities::split_comma_separated_list (p)[1] == "beta",
+          ExcInternalError());
+  Assert (Utilities::split_comma_separated_list (p)[2] == "gamma",
+          ExcInternalError());
+
+  deallog << Utilities::generate_normal_random_number (13, 44) << ' ';
+  deallog << Utilities::generate_normal_random_number (13, 44) << ' ';
+  deallog << Utilities::generate_normal_random_number (13, 44) << ' ';
+  deallog << std::endl;
+}
+
+  
+  
+
+int main()
+{
+  std::ofstream logfile("utilities_01.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/utilities_01.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/utilities_01.output
new file mode 100644 (file)
index 0000000..5e6f720
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::0042
+DEAL::3
+DEAL::413
+DEAL::1
+DEAL::-12
+DEAL::125
+DEAL::56.7901 1.21180 47.4389 

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.