]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add new test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 21 Dec 2013 13:17:28 +0000 (13:17 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 21 Dec 2013 13:17:28 +0000 (13:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@32077 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/boost_iostreams_01.cc [new file with mode: 0644]
tests/base/boost_iostreams_01.data.gz [new file with mode: 0644]
tests/base/boost_iostreams_01.output [new file with mode: 0644]

diff --git a/tests/base/boost_iostreams_01.cc b/tests/base/boost_iostreams_01.cc
new file mode 100644 (file)
index 0000000..5686ca7
--- /dev/null
@@ -0,0 +1,63 @@
+// ---------------------------------------------------------------------
+// $Id$
+//
+// Copyright (C) 2013 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 that we can use BOOST iostreams
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <boost/iostreams/filtering_stream.hpp>
+#include <boost/iostreams/filter/gzip.hpp>
+#include <boost/iostreams/device/file.hpp>
+
+
+void test ()
+{
+  // create a stream where we read from gzipped data
+  boost::iostreams::filtering_istream in;
+  in.push(boost::iostreams::basic_gzip_decompressor<>());
+  in.push(boost::iostreams::file_source(SOURCE_DIR "/boost_iostreams_01.data.gz"));
+  AssertThrow (in, ExcIO());
+
+  // read the two numbers that are in this file
+  int i;
+  double d;
+  in >> i >> d;
+
+  deallog << i << ' ' << d << std::endl;
+
+  // make sure that we got here just fine but that there is nothing else
+  AssertThrow (in, ExcIO());
+  in >> i;
+  AssertThrow (!in, ExcIO());  
+}
+
+
+
+
+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/boost_iostreams_01.data.gz b/tests/base/boost_iostreams_01.data.gz
new file mode 100644 (file)
index 0000000..37314c4
Binary files /dev/null and b/tests/base/boost_iostreams_01.data.gz differ
diff --git a/tests/base/boost_iostreams_01.output b/tests/base/boost_iostreams_01.output
new file mode 100644 (file)
index 0000000..f8a3022
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::42 3.14159

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.