From 795a01d62ea52d0a03b0940361000babca7427c3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 11 Aug 2005 15:17:21 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@11285 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/Makefile | 3 +- tests/base/utilities_01.cc | 67 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/base/utilities_01.cc diff --git a/tests/base/Makefile b/tests/base/Makefile index 7c51f7181a..ebf87b9702 100644 --- a/tests/base/Makefile +++ b/tests/base/Makefile @@ -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 index 0000000000..16bee34bf5 --- /dev/null +++ b/tests/base/utilities_01.cc @@ -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 +#include +#include +#include + +#include + + +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 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 (); +} -- 2.39.5