]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_threefry_engine.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / test / test_threefry_engine.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Muhammad Junaid Muzammil <mjunaidmuzammil@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://kylelutz.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #define BOOST_TEST_MODULE TestThreefry
12 #include <boost/test/unit_test.hpp>
13
14 #include <boost/compute/random/threefry_engine.hpp>
15 #include <boost/compute/container/vector.hpp>
16
17 #include "check_macros.hpp"
18 #include "context_setup.hpp"
19
20 BOOST_AUTO_TEST_CASE(generate_uint)
21 {
22
23 using boost::compute::uint_;
24
25 boost::compute::threefry_engine<> rng(queue);
26
27 boost::compute::vector<uint_> vector_ctr(20, context);
28
29 uint32_t ctr[20];
30 for(int i = 0; i < 10; i++) {
31 ctr[i*2] = i;
32 ctr[i*2+1] = 0;
33 }
34
35 boost::compute::copy(ctr, ctr+20, vector_ctr.begin(), queue);
36
37 rng.generate(vector_ctr.begin(), vector_ctr.end(), queue);
38 CHECK_RANGE_EQUAL(
39 uint_, 20, vector_ctr,
40 (uint_(0x6b200159),
41 uint_(0x99ba4efe),
42 uint_(0x508efb2c),
43 uint_(0xc0de3f32),
44 uint_(0x64a626ec),
45 uint_(0xfc15e573),
46 uint_(0xb8abc4d1),
47 uint_(0x537eb86),
48 uint_(0xac6dc2bb),
49 uint_(0xa7adb3c3),
50 uint_(0x5641e094),
51 uint_(0xe4ab4fd),
52 uint_(0xa53c1ce9),
53 uint_(0xabcf1dba),
54 uint_(0x2677a25a),
55 uint_(0x76cf5efc),
56 uint_(0x2d08247f),
57 uint_(0x815480f1),
58 uint_(0x2d1fa53a),
59 uint_(0xdfe8514c))
60 );
61 }
62
63 BOOST_AUTO_TEST_SUITE_END()