]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_types.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / test / test_types.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 TestTypes
12 #include <boost/test/unit_test.hpp>
13
14 #include <string>
15 #include <sstream>
16
17 #include <boost/compute/types/fundamental.hpp>
18
19 BOOST_AUTO_TEST_CASE(vector_ctor)
20 {
21 boost::compute::int4_ i4(1, 2, 3, 4);
22 BOOST_CHECK(i4 == boost::compute::int4_(1, 2, 3, 4));
23 BOOST_CHECK_EQUAL(i4, boost::compute::int4_(1, 2, 3, 4));
24 BOOST_CHECK_EQUAL(i4[0], 1);
25 BOOST_CHECK_EQUAL(i4[1], 2);
26 BOOST_CHECK_EQUAL(i4[2], 3);
27 BOOST_CHECK_EQUAL(i4[3], 4);
28
29 i4 = boost::compute::int4_(1);
30 BOOST_CHECK(i4 == boost::compute::int4_(1, 1, 1, 1));
31 BOOST_CHECK(i4 == (boost::compute::vector_type<int, size_t(4)>(1)));
32 BOOST_CHECK_EQUAL(i4, boost::compute::int4_(1, 1, 1, 1));
33 BOOST_CHECK_EQUAL(i4[0], 1);
34 BOOST_CHECK_EQUAL(i4[1], 1);
35 BOOST_CHECK_EQUAL(i4[2], 1);
36 BOOST_CHECK_EQUAL(i4[3], 1);
37 }
38
39 BOOST_AUTO_TEST_CASE(vector_string)
40 {
41 std::stringstream stream;
42 stream << boost::compute::int2_(1, 2);
43 BOOST_CHECK_EQUAL(stream.str(), std::string("int2(1, 2)"));
44 }