]>
Commit | Line | Data |
---|---|---|
92f5a8d4 | 1 | // |
f67539c2 | 2 | // Copyright 2018-2020 Mateusz Loskot <mateusz at loskot dot net> |
92f5a8d4 TL |
3 | // |
4 | // Distributed under the Boost Software License, Version 1.0 | |
5 | // See accompanying file LICENSE_1_0.txt or copy at | |
6 | // http://www.boost.org/LICENSE_1_0.txt | |
7 | // | |
8 | #include <boost/gil/channel.hpp> | |
9 | #include <boost/gil/typedefs.hpp> | |
f67539c2 TL |
10 | |
11 | #include <boost/core/lightweight_test.hpp> | |
12 | ||
92f5a8d4 TL |
13 | #include <cstdint> |
14 | #include <limits> | |
15 | ||
92f5a8d4 TL |
16 | namespace gil = boost::gil; |
17 | ||
18 | template <typename T> | |
19 | void test_channel_minmax() | |
20 | { | |
f67539c2 TL |
21 | BOOST_TEST_EQ(gil::channel_traits<T>::min_value(), std::numeric_limits<T>::min()); |
22 | BOOST_TEST_EQ(gil::channel_traits<T>::max_value(), std::numeric_limits<T>::max()); | |
92f5a8d4 TL |
23 | } |
24 | ||
f67539c2 | 25 | void test_channel_minmax_uint8_t() |
92f5a8d4 TL |
26 | { |
27 | test_channel_minmax<std::uint8_t>(); | |
28 | } | |
29 | ||
f67539c2 | 30 | void test_channel_minmax_int8_t() |
92f5a8d4 TL |
31 | { |
32 | test_channel_minmax<std::int8_t>(); | |
33 | } | |
34 | ||
f67539c2 | 35 | void test_channel_minmax_uint16_t() |
92f5a8d4 TL |
36 | { |
37 | test_channel_minmax<std::uint16_t>(); | |
38 | } | |
39 | ||
f67539c2 | 40 | void test_channel_minmax_int16_t() |
92f5a8d4 TL |
41 | { |
42 | test_channel_minmax<std::int16_t>(); | |
43 | } | |
44 | ||
f67539c2 | 45 | void test_channel_minmax_uint32_t() |
92f5a8d4 TL |
46 | { |
47 | test_channel_minmax<std::uint32_t>(); | |
48 | } | |
49 | ||
f67539c2 | 50 | void test_channel_minmax_int32_t() |
92f5a8d4 TL |
51 | { |
52 | test_channel_minmax<std::int32_t>(); | |
53 | } | |
f67539c2 TL |
54 | |
55 | int main() | |
56 | { | |
57 | test_channel_minmax_uint8_t(); | |
58 | test_channel_minmax_int8_t(); | |
59 | test_channel_minmax_uint16_t(); | |
60 | test_channel_minmax_int16_t(); | |
61 | test_channel_minmax_uint32_t(); | |
62 | test_channel_minmax_int32_t(); | |
63 | ||
64 | return ::boost::report_errors(); | |
65 | } |