From 4920472b88d309d961eaff8639e9bb2dc2ac5478 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 13 Jul 2012 22:22:42 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@25700 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/utilities_05.cc | 66 +++++++++++++++++++ tests/base/utilities_05/cmp/generic | 8 +++ .../cmp/powerpc-apple-darwin8.10.0+gcc4.0 | 9 +++ .../cmp/powerpc-apple-darwin8.8.0+gcc4.0 | 9 +++ 4 files changed, 92 insertions(+) create mode 100644 tests/base/utilities_05.cc create mode 100644 tests/base/utilities_05/cmp/generic create mode 100644 tests/base/utilities_05/cmp/powerpc-apple-darwin8.10.0+gcc4.0 create mode 100644 tests/base/utilities_05/cmp/powerpc-apple-darwin8.8.0+gcc4.0 diff --git a/tests/base/utilities_05.cc b/tests/base/utilities_05.cc new file mode 100644 index 0000000000..90801dd1ff --- /dev/null +++ b/tests/base/utilities_05.cc @@ -0,0 +1,66 @@ +//----------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005, 2006, 2011, 2012 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. +// +//----------------------------------------------------------------------------- + +// Utilities::get_integer_at_position + +#include "../tests.h" +#include +#include +#include +#include +#include + +#include + +using namespace dealii; + + + + +void test () +{ + int number = 5; + for (unsigned int i=0; i<7; ++i) + { + std::ostringstream s; + s << "test test" << number << "test test"; + + Assert (Utilities::get_integer_at_position (s.str(), + 9).first + == number, + ExcInternalError()); + Assert (Utilities::get_integer_at_position (s.str(), + 9).second + == i+1, + ExcInternalError()); + + deallog << i << ' ' << Utilities::get_integer_at_position (s.str(), + 9).first + << std::endl; + + number = number*10 + i; + } +} + + + + +int main() +{ + std::ofstream logfile("utilities_05/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test (); +} diff --git a/tests/base/utilities_05/cmp/generic b/tests/base/utilities_05/cmp/generic new file mode 100644 index 0000000000..654fa661ae --- /dev/null +++ b/tests/base/utilities_05/cmp/generic @@ -0,0 +1,8 @@ + +DEAL::0 5 +DEAL::1 50 +DEAL::2 501 +DEAL::3 5012 +DEAL::4 50123 +DEAL::5 501234 +DEAL::6 5012345 diff --git a/tests/base/utilities_05/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/base/utilities_05/cmp/powerpc-apple-darwin8.10.0+gcc4.0 new file mode 100644 index 0000000000..902f619d9c --- /dev/null +++ b/tests/base/utilities_05/cmp/powerpc-apple-darwin8.10.0+gcc4.0 @@ -0,0 +1,9 @@ + +DEAL::0042 +DEAL::42 +DEAL::3 +DEAL::413 +DEAL::1 +DEAL::-12 +DEAL::125 +DEAL::-177.002 -36.2427 43.4584 diff --git a/tests/base/utilities_05/cmp/powerpc-apple-darwin8.8.0+gcc4.0 b/tests/base/utilities_05/cmp/powerpc-apple-darwin8.8.0+gcc4.0 new file mode 100644 index 0000000000..902f619d9c --- /dev/null +++ b/tests/base/utilities_05/cmp/powerpc-apple-darwin8.8.0+gcc4.0 @@ -0,0 +1,9 @@ + +DEAL::0042 +DEAL::42 +DEAL::3 +DEAL::413 +DEAL::1 +DEAL::-12 +DEAL::125 +DEAL::-177.002 -36.2427 43.4584 -- 2.39.5