]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_clamp_range.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / test / test_clamp_range.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
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 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #define BOOST_TEST_MODULE TestClampRange
12 #include <boost/test/unit_test.hpp>
13
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/container/vector.hpp>
16 #include <boost/compute/experimental/clamp_range.hpp>
17
18 #include "check_macros.hpp"
19 #include "context_setup.hpp"
20
21 namespace compute = boost::compute;
22
23 BOOST_AUTO_TEST_CASE(clamp_float_range)
24 {
25 float data[] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
26 compute::vector<float> input(data, data + 8, queue);
27
28 compute::vector<float> result(8, context);
29 compute::experimental::clamp_range(
30 input.begin(),
31 input.end(),
32 result.begin(),
33 3.f, // low
34 6.f, // high
35 queue
36 );
37 CHECK_RANGE_EQUAL(
38 float, 8, result,
39 (3.f, 3.f, 3.f, 4.f, 5.f, 6.f, 6.f, 6.f)
40 );
41 }
42
43 BOOST_AUTO_TEST_SUITE_END()