From a212d3097d84239be7469474dee29c09022a9898 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 24 Feb 2015 16:33:33 -0600 Subject: [PATCH] Add a test for a patch by Menno Fraters this morning. --- tests/base/utilities_09.cc | 63 ++++++++++++++++++++++++++++++++++ tests/base/utilities_09.output | 9 +++++ 2 files changed, 72 insertions(+) create mode 100644 tests/base/utilities_09.cc create mode 100644 tests/base/utilities_09.output diff --git a/tests/base/utilities_09.cc b/tests/base/utilities_09.cc new file mode 100644 index 0000000000..01749e4aad --- /dev/null +++ b/tests/base/utilities_09.cc @@ -0,0 +1,63 @@ +// --------------------------------------------------------------------- +// +// 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 an empty string + +#include "../tests.h" +#include +#include +#include +#include + +#include + + +void test () +{ + // test an empty string -- should yield a list of zero elements with + // any delimiter + { + const char *p = ""; + deallog << Utilities::split_string_list (p).size() + << std::endl; + deallog << Utilities::split_string_list (p, ' ').size() + << std::endl; + } + + // also test a string that consists only of whitespace. this should + // yield a list of zero elements even if (maybe not very usefully) + // the delimiter is chosen as a whitespace itself + { + const char *p = " "; + deallog << Utilities::split_string_list (p).size() + << std::endl; + deallog << Utilities::split_string_list (p, ' ').size() + << 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_09.output b/tests/base/utilities_09.output new file mode 100644 index 0000000000..f8f85d1c68 --- /dev/null +++ b/tests/base/utilities_09.output @@ -0,0 +1,9 @@ + +DEAL::0042 +DEAL::42 +DEAL::3 +DEAL::413 +DEAL::1 +DEAL::-12 +DEAL::125 +DEAL::-15.3253 -67.9624 74.3805 -- 2.39.5