]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/core/image/test_fixture.cpp
bump version to 15.2.11-pve1
[ceph.git] / ceph / src / boost / libs / gil / test / core / image / test_fixture.cpp
1 //
2 // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
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/config.hpp>
9 #include <boost/core/ignore_unused.hpp>
10
11 #if defined(BOOST_CLANG)
12 #pragma clang diagnostic push
13 #pragma clang diagnostic ignored "-Wconversion"
14 #pragma clang diagnostic ignored "-Wfloat-equal"
15 #pragma clang diagnostic ignored "-Wsign-conversion"
16 #elif BOOST_GCC >= 40700
17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wconversion"
19 #pragma GCC diagnostic ignored "-Wfloat-equal"
20 #pragma GCC diagnostic ignored "-Wsign-conversion"
21 #endif
22
23 #include <boost/gil.hpp>
24
25 #include <algorithm>
26 #include <cstdint>
27 #include <vector>
28
29 #define BOOST_TEST_MODULE test_ext_numeric_test_fixture
30 #include "unit_test.hpp"
31 #include "test_fixture.hpp"
32
33 namespace gil = boost::gil;
34 namespace fixture = boost::gil::test::fixture;
35
36 BOOST_AUTO_TEST_CASE(consecutive_value)
37 {
38 fixture::consecutive_value<std::uint8_t> v(10);
39 BOOST_TEST(v() = std::uint8_t{11});
40 BOOST_TEST(v() = std::uint8_t{12});
41 BOOST_TEST(v() = std::uint8_t{13});
42 }
43
44 BOOST_AUTO_TEST_CASE(reverse_consecutive_value)
45 {
46 fixture::reverse_consecutive_value<std::uint8_t> v(10);
47 BOOST_TEST(v() = std::uint8_t{9});
48 BOOST_TEST(v() = std::uint8_t{8});
49 BOOST_TEST(v() = std::uint8_t{7});
50 }
51
52 BOOST_AUTO_TEST_CASE(random_value)
53 {
54 // Generate N pseudo-random values
55 fixture::random_value<std::uint8_t> random;
56 std::vector<std::uint8_t> v(10, 0);
57 for (auto& i : v) i = random();
58
59 // Require not all of N values are equal (duplicates are possible!)
60 std::sort(v.begin(), v.end());
61 auto last = std::unique(v.begin(), v.end());
62 v.erase(last, v.end());
63 BOOST_TEST(v.size() > 0);
64 BOOST_TEST(v.size() <= 10);
65 }