2
0
mirror of https://github.com/boostorg/gil.git synced 2026-02-27 17:12:10 +00:00

Fix GCC -Wsign-compare warning in tests (#217)

Fixes at least two warnings issued by channel tests due to
comparison of unsigned channel value with signed integer 1:

../../boost/test/tools/assertion.hpp:72:13:
  warning: comparison between signed and unsigned
    integer expressions [-Wsign-compare]
This commit is contained in:
Mateusz Loskot
2019-01-19 15:05:35 +01:00
committed by GitHub
parent 585e9226c8
commit e22c7cb108
2 changed files with 13 additions and 8 deletions

View File

@@ -27,6 +27,7 @@ void test_channel_arithmetic_mutable(boost::mpl::true_)
using channel_value_t = typename fixture_t::channel_value_t;
fixture_t f;
channel_value_t const v = f.min_v_;
channel_value_t const one = 1;
++f.min_v_;
f.min_v_++;
@@ -34,16 +35,16 @@ void test_channel_arithmetic_mutable(boost::mpl::true_)
f.min_v_--;
BOOST_TEST(v == f.min_v_);
f.min_v_ += 1;
f.min_v_ -= 1;
f.min_v_ += one;
f.min_v_ -= one;
BOOST_TEST(v == f.min_v_);
f.min_v_ *= 1;
f.min_v_ /= 1;
f.min_v_ *= one;
f.min_v_ /= one;
BOOST_TEST(v == f.min_v_);
f.min_v_ = 1; // assignable to scalar
BOOST_TEST(f.min_v_ == 1);
f.min_v_ = one; // assignable to scalar
BOOST_TEST(f.min_v_ == one);
f.min_v_ = v; // and to value type
BOOST_TEST(f.min_v_ == v);