ddemidov / vexcl
1
#define BOOST_TEST_MODULE Logical
2
#include <boost/test/unit_test.hpp>
3
#include <vexcl/vector.hpp>
4
#include <vexcl/element_index.hpp>
5
#include <vexcl/logical.hpp>
6
#include "context_setup.hpp"
7

8 6
BOOST_AUTO_TEST_CASE(logical)
9
{
10
    const size_t N = 1024;
11

12 6
    vex::vector<int> x(ctx, N);
13 6
    x = vex::element_index();
14

15 6
    vex::any_of any_of(ctx);
16 6
    vex::all_of all_of(ctx);
17

18 6
    BOOST_CHECK( any_of(x)       );
19 6
    BOOST_CHECK(!any_of(0 * x)   );
20 6
    BOOST_CHECK( any_of(x > N/2) );
21 6
    BOOST_CHECK(!any_of(x < 0)   );
22

23 6
    BOOST_CHECK(!all_of(x)           );
24 6
    BOOST_CHECK( all_of((x + 1) > 0) );
25 6
    BOOST_CHECK(!all_of(x > N/2)     );
26
}
27

28 6
BOOST_AUTO_TEST_SUITE_END()

Read our documentation on viewing source code .

Loading