From 28e864e65cdbc7b9d98ea6732449a9858ef9002e Mon Sep 17 00:00:00 2001 From: wolf 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 +++++++++++++++++++ .../base/utilities_01.output | 8 +++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 tests/base/utilities_01.cc create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/base/utilities_01.output 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 (); +} 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 index 0000000000..5e6f720109 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/base/utilities_01.output @@ -0,0 +1,8 @@ + +DEAL::0042 +DEAL::3 +DEAL::413 +DEAL::1 +DEAL::-12 +DEAL::125 +DEAL::56.7901 1.21180 47.4389 -- 2.39.5