From 35feb971beebff4d64ecf89262cc7f95eba72488 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 24 Feb 2015 17:46:55 -0600 Subject: [PATCH] Add another test. Update another. --- tests/base/utilities_09.output | 12 ++---- tests/base/utilities_10.cc | 76 ++++++++++++++++++++++++++++++++++ tests/base/utilities_10.output | 8 ++++ 3 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 tests/base/utilities_10.cc create mode 100644 tests/base/utilities_10.output diff --git a/tests/base/utilities_09.output b/tests/base/utilities_09.output index f8f85d1c68..70feca85ab 100644 --- a/tests/base/utilities_09.output +++ b/tests/base/utilities_09.output @@ -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 index 0000000000..61272f03fe --- /dev/null +++ b/tests/base/utilities_10.cc @@ -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 +#include +#include +#include + +#include + + +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 index 0000000000..4ce62ff548 --- /dev/null +++ b/tests/base/utilities_10.output @@ -0,0 +1,8 @@ + +DEAL::1 +DEAL::1 +DEAL::2 +DEAL::2 +DEAL::3 +DEAL::0 +DEAL::0 -- 2.39.5