2
0
mirror of https://github.com/boostorg/gil.git synced 2026-01-22 17:22:26 +00:00
Files
gil/test/extension/toolbox/get_num_bits.cpp
Mateusz Łoskot dda885e5ff Replace Boost.Test with Boost.LightweightTest in test/ (#459)
Motivation is to:
- use on simpler and light test framework,
- eliminate dependency on libraries like Boost.MPL,
- achieve faster compilation times for CI builds (20% seems feasible)
- have test programs easy to run and debug
- avoid macros

Remove outdated FIXME-s for bugs that have been already fixed.
Fix off-by-one bug in test/core/test_fixture.hpp generators.
Minor corrections and tidying up.

Add missing test assertions to numeric extension tests.
Fixes #458
2020-03-21 22:53:09 +01:00

42 lines
1.5 KiB
C++

//
// Copyright 2013 Christian Henning
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
#include <boost/gil.hpp>
#include <boost/gil/extension/toolbox/metafunctions/channel_type.hpp>
#include <boost/gil/extension/toolbox/metafunctions/get_num_bits.hpp>
namespace gil = boost::gil;
void test_get_num_bits()
{
using image_t = gil::bit_aligned_image4_type<4, 4, 4, 4, gil::rgb_layout_t>::type;
using channel_t = gil::channel_type<image_t::view_t::reference>::type;
static_assert(gil::get_num_bits<channel_t>::value == 4, "");
using const_channel_t = gil::channel_type<image_t::const_view_t::reference>::type;
static_assert(gil::get_num_bits<const_channel_t>::value == 4, "");
using bits_t = gil::packed_channel_value<23>;
static_assert(gil::get_num_bits<bits_t>::value == 23, "");
static_assert(gil::get_num_bits<bits_t const>::value == 23, "");
static_assert(gil::get_num_bits<unsigned char >::value == 8, "");
static_assert(gil::get_num_bits<unsigned char const>::value == 8, "");
using gray8_channel_t = gil::channel_type<gil::gray8_image_t::view_t::value_type>::type;
static_assert(gil::get_num_bits<gray8_channel_t>::value == 8, "");
using rgba32_channel_t = gil::channel_type<gil::rgba32_image_t::view_t::value_type>::type;
static_assert(gil::get_num_bits<rgba32_channel_t>::value == 32, "");
}
int main()
{
test_get_num_bits();
}