]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/gil/test/extension/numeric/convolve_rows.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / gil / test / extension / numeric / convolve_rows.cpp
index 8e50d282d0dd0d33aafd0aa8e259c31684ee5634..d9b73547969d27360f094a5fc43247e962971efa 100644 (file)
@@ -1,5 +1,5 @@
 //
-// Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
+// Copyright 2019-2020 Mateusz Loskot <mateusz at loskot dot net>
 //
 // Distributed under the Boost Software License, Version 1.0
 // See accompanying file LICENSE_1_0.txt or copy at
@@ -8,45 +8,66 @@
 #include <boost/gil.hpp>
 #include <boost/gil/extension/numeric/convolve.hpp>
 
+#include <boost/core/lightweight_test.hpp>
+
 #include <tuple>
 #include <type_traits>
 
-#define BOOST_TEST_MODULE test_ext_numeric_colvolve_rows
-#include "unit_test.hpp"
-#include "unit_test_utility.hpp"
 #include "test_fixture.hpp"
 #include "core/image/test_fixture.hpp"
 
 namespace gil = boost::gil;
 namespace fixture = boost::gil::test::fixture;
 
-BOOST_AUTO_TEST_SUITE(convolve_rows)
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(image_1x1_kernel_1x1_identity, Image, fixture::image_types)
+struct test_image_1x1_kernel_1x1_identity
 {
-    auto const img = fixture::create_image<Image>(1, 1, 7);
-    auto img_out = fixture::create_image<Image>(1, 1, 0);
+    template <typename Image>
+    void operator()(Image const&)
+    {
+        using image_t = Image;
+        auto const img = fixture::create_image<image_t>(1, 1, 7);
+        auto img_out = fixture::create_image<image_t>(1, 1, 0);
 
-    using pixel_t = typename Image::value_type;
-    using channel_t = typename gil::channel_type<pixel_t>::type;
-    auto const kernel = fixture::create_kernel<channel_t>({1});
-    gil::convolve_rows<pixel_t>(const_view(img), kernel, view(img_out));
+        using pixel_t = typename image_t::value_type;
+        using channel_t = typename gil::channel_type<pixel_t>::type;
+        auto const kernel = fixture::create_kernel<channel_t>({1});
+        gil::convolve_rows<pixel_t>(const_view(img), kernel, view(img_out));
 
-    // 1x1 kernel reduces convolution to multiplication
-    BOOST_TEST(gil::const_view(img).front() == gil::const_view(img_out).front());
-}
+        // 1x1 kernel reduces convolution to multiplication
+        BOOST_TEST(gil::const_view(img).front() == gil::const_view(img_out).front());
+    }
+    static void run()
+    {
+        boost::mp11::mp_for_each<fixture::image_types>(test_image_1x1_kernel_1x1_identity{});
+    }
+};
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(image_1x1_kernel_3x3_identity, Image, fixture::image_types)
+struct test_image_1x1_kernel_3x3_identity
 {
-    auto const img = fixture::create_image<Image>(1, 1, 7);
-    auto img_out = fixture::create_image<Image>(1, 1, 0);
+    template <typename Image>
+    void operator()(Image const&)
+    {
+        using image_t = Image;
+        auto const img = fixture::create_image<image_t>(1, 1, 7);
+        auto img_out = fixture::create_image<image_t>(1, 1, 0);
 
-    using pixel_t = typename Image::value_type;
-    using channel_t = typename gil::channel_type<pixel_t>::type;
-    auto const kernel = fixture::create_kernel<channel_t>({0, 0, 0, 0, 1, 0, 0, 0, 0});
-    gil::convolve_rows<pixel_t>(const_view(img), kernel, view(img_out));
+        using pixel_t = typename image_t::value_type;
+        using channel_t = typename gil::channel_type<pixel_t>::type;
+        auto const kernel = fixture::create_kernel<channel_t>({0, 0, 0, 0, 1, 0, 0, 0, 0});
+        gil::convolve_rows<pixel_t>(const_view(img), kernel, view(img_out));
 
-    BOOST_TEST(gil::const_view(img).front() == gil::const_view(img_out).front());
-}
+        BOOST_TEST(gil::const_view(img).front() == gil::const_view(img_out).front());
+    }
+    static void run()
+    {
+        boost::mp11::mp_for_each<fixture::image_types>(test_image_1x1_kernel_3x3_identity{});
+    }
+};
 
-BOOST_AUTO_TEST_SUITE_END()
+int main()
+{
+    test_image_1x1_kernel_1x1_identity::run();
+    test_image_1x1_kernel_3x3_identity::run();
+
+    return ::boost::report_errors();
+}