]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add another test. Update another. 597/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 24 Feb 2015 23:46:55 +0000 (17:46 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 24 Feb 2015 23:46:55 +0000 (17:46 -0600)
tests/base/utilities_09.output
tests/base/utilities_10.cc [new file with mode: 0644]
tests/base/utilities_10.output [new file with mode: 0644]

index f8f85d1c683cc4c27f15e5fe8b998d518803eb6b..70feca85ab6ca64f8fdbbd3b9399f7f65db68173 100644 (file)
@@ -1,9 +1,5 @@
 
-DEAL::0042
-DEAL::42
-DEAL::3
-DEAL::413
-DEAL::1
-DEAL::-12
-DEAL::125
-DEAL::-15.3253 -67.9624 74.3805 
+DEAL::0
+DEAL::0
+DEAL::0
+DEAL::0
diff --git a/tests/base/utilities_10.cc b/tests/base/utilities_10.cc
new file mode 100644 (file)
index 0000000..61272f0
--- /dev/null
@@ -0,0 +1,76 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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 Utilities::split_string_list with a string that only contains
+// the delimiter and, possibly, spaces
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <deal.II/base/utilities.h>
+
+
+void test ()
+{
+  // verify the documented behavior of eating trailing delimiters
+  {
+    deallog << Utilities::split_string_list (",").size()
+           << std::endl;
+    deallog << Utilities::split_string_list (" , ").size()
+           << std::endl;
+  }
+
+  {
+    deallog << Utilities::split_string_list (",,").size()
+           << std::endl;
+    deallog << Utilities::split_string_list (" , , ").size()
+           << std::endl;
+  }
+
+  // try some more esoteric cases:
+  {
+    deallog << Utilities::split_string_list (" , , ", ' ').size()
+           << std::endl;
+  }
+
+  {
+    deallog << Utilities::split_string_list (" ", ' ').size()
+           << std::endl;
+    deallog << Utilities::split_string_list ("   ", ' ').size()
+           << std::endl;
+  }
+
+  Assert (Utilities::split_string_list(" ; ", ';').size() == 1,
+         ExcInternalError());
+  Assert (Utilities::split_string_list(" ; ", ';')[0] == "",
+         ExcInternalError());
+}
+
+
+
+
+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_10.output b/tests/base/utilities_10.output
new file mode 100644 (file)
index 0000000..4ce62ff
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::1
+DEAL::1
+DEAL::2
+DEAL::2
+DEAL::3
+DEAL::0
+DEAL::0

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.