Imported Upstream version 1.71.0
[platform/upstream/boost.git] / libs / gil / test / core / channel / algorithm_channel_multiply.cpp
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 // Copyright 2018 Mateusz Loskot <mateusz at loskot dot net>
4 //
5 // Distributed under the Boost Software License, Version 1.0
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8 //
9 #include <boost/gil/channel_algorithm.hpp>
10
11 #define BOOST_TEST_MODULE test_algorithm_channel_multiply
12 #include "unit_test.hpp"
13 #include "test_fixture.hpp"
14
15 namespace gil = boost::gil;
16 namespace fixture = boost::gil::test::fixture;
17
18 template <typename ChannelFixtureBase>
19 void test_channel_multiply()
20 {
21     fixture::channel<ChannelFixtureBase> f;
22     BOOST_TEST(gil::channel_multiply(f.min_v_, f.min_v_) == f.min_v_);
23     BOOST_TEST(gil::channel_multiply(f.max_v_, f.max_v_) == f.max_v_);
24     BOOST_TEST(gil::channel_multiply(f.max_v_, f.min_v_) == f.min_v_);
25 }
26
27 BOOST_AUTO_TEST_CASE_TEMPLATE(channel_value, Channel, fixture::channel_byte_types)
28 {
29     using fixture_t = fixture::channel_value<Channel>;
30     test_channel_multiply<fixture_t>();
31 }
32
33 BOOST_AUTO_TEST_CASE_TEMPLATE(channel_reference, Channel, fixture::channel_byte_types)
34 {
35     using fixture_t = fixture::channel_reference<Channel&>;
36     test_channel_multiply<fixture_t>();
37 }
38
39 BOOST_AUTO_TEST_CASE_TEMPLATE(
40     channel_reference_const, Channel, fixture::channel_byte_types)
41 {
42     using fixture_t = fixture::channel_reference<Channel const&>;
43     test_channel_multiply<fixture_t>();
44 }
45
46 BOOST_AUTO_TEST_CASE_TEMPLATE(
47     packed_channel_reference, BitField, fixture::channel_bitfield_types)
48 {
49     using channels565_t = fixture::packed_channels565<BitField>;
50     test_channel_multiply<typename channels565_t::fixture_0_5_t>();
51     test_channel_multiply<typename channels565_t::fixture_5_6_t >();
52     test_channel_multiply<typename channels565_t::fixture_11_5_t>();
53 }
54
55 BOOST_AUTO_TEST_CASE_TEMPLATE(
56     packed_dynamic_channel_reference, BitField, fixture::channel_bitfield_types)
57 {
58     using channels565_t = fixture::packed_dynamic_channels565<BitField>;
59     test_channel_multiply<typename channels565_t::fixture_5_t>();
60     test_channel_multiply<typename channels565_t::fixture_6_t>();
61 }