From e6485b055bd7803e4d2e981870f39b0134940bb4 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 27 Dec 2017 19:19:35 +0100 Subject: [PATCH] tests: add a quick test for Zlib with Boost --- tests/quick_tests/CMakeLists.txt | 4 +++ tests/quick_tests/boost_zlib.cc | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 tests/quick_tests/boost_zlib.cc diff --git a/tests/quick_tests/CMakeLists.txt b/tests/quick_tests/CMakeLists.txt index e9e6638daf..0e81ba8e8d 100644 --- a/tests/quick_tests/CMakeLists.txt +++ b/tests/quick_tests/CMakeLists.txt @@ -178,6 +178,10 @@ IF (DEAL_II_WITH_SCALAPACK) make_quicktest("scalapack" ${_mybuild} 5) ENDIF() +# Test Zlib and Boost +IF (DEAL_II_WITH_ZLIB) +make_quicktest("boost_zlib" ${_mybuild} "") +ENDIF() # A custom test target: ADD_CUSTOM_TARGET(test diff --git a/tests/quick_tests/boost_zlib.cc b/tests/quick_tests/boost_zlib.cc new file mode 100644 index 0000000000..6d81c4e621 --- /dev/null +++ b/tests/quick_tests/boost_zlib.cc @@ -0,0 +1,57 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 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. +// +// --------------------------------------------------------------------- + +// Adoptation of base/utilities_pack_unpack_01.cc as a quick test. + +// test Utilities::pack/unpack on some types. + +#include +#include + +using namespace dealii; + +template +void test(const unsigned int &size) +{ + std::vector > points(size); + + unsigned int i=0; + for (auto &p : points) + for (unsigned int d = 0; d < dim; ++d) + p[d] = 11*d + size*10 + 3*i++; + + auto buffer = Utilities::pack(points); + + auto unpacked = Utilities::unpack > >(buffer); + + i = 0; + bool ok = true; + for (const auto &p : points) + if (p.distance(unpacked[i++]) > 1e-12) + { + std::cout << "NOT OK: " + << p << " != " << unpacked[i-1] << std::endl; + ok = false; + } + + AssertThrow(ok, ExcInternalError()); +} + +int main() +{ + test<1>(10); + test<2>(10); + test<3>(10); +} -- 2.39.5