]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/cmp_mm_test.cpp
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/qvm/mat_operations.hpp>
7 #include <boost/qvm/mat_traits_array.hpp>
8 #include <boost/qvm/mat.hpp>
9 #include "test_qvm_matrix.hpp"
14 template <int Rows
,int Cols
>
18 using namespace boost::qvm::sfinae
;
19 test_qvm::matrix
<M1
,Rows
,Cols
> const x(42,1);
20 for( int i
=0; i
!=Rows
; ++i
)
21 for( int j
=0; j
!=Cols
; ++j
)
24 test_qvm::matrix
<M1
,Rows
,Cols
> y(x
);
25 BOOST_QVM_TEST_EQ(x
,y
);
27 BOOST_QVM_TEST_NEQ(x
,y
);
30 test_qvm::matrix
<M2
,Rows
,Cols
> y
; assign(y
,x
);
31 BOOST_QVM_TEST_EQ(x
,y
);
33 BOOST_QVM_TEST_NEQ(x
,y
);
42 test_scalar( T value
): value_(value
) {}
48 template <class T
,class U
>
50 operator()( T
const & a
, U
const & b
)
52 return a
.value_
==b
.value_
;
56 template <class A
, class B
>
60 typedef test_scalar
<A
> scalar_a
;
61 typedef test_scalar
<B
> scalar_b
;
62 typedef boost::qvm::mat
<scalar_a
, 3, 3> mat_a
;
63 typedef boost::qvm::mat
<scalar_b
, 3, 3> mat_b
;
64 mat_a
const a
= { { {42, 94, 96}, {72, 95, 81}, {12, 84, 33} } };
65 mat_b
const b
= { { {42, 94, 96}, {72, 95, 81}, {12, 84, 33} } };
66 mat_a
const c
= { { {21, 47, 48}, {36, 47, 65}, {79, 27, 41} } };
67 mat_b
const d
= { { {21, 47, 48}, {36, 47, 65}, {79, 27, 41} } };
68 BOOST_TEST(cmp(a
,a
,equal_to()));
69 BOOST_TEST(cmp(a
,b
,equal_to()));
70 BOOST_TEST(cmp(b
,a
,equal_to()));
71 BOOST_TEST(cmp(b
,b
,equal_to()));
72 BOOST_TEST(cmp(c
,c
,equal_to()));
73 BOOST_TEST(cmp(c
,d
,equal_to()));
74 BOOST_TEST(cmp(d
,c
,equal_to()));
75 BOOST_TEST(cmp(d
,d
,equal_to()));
76 BOOST_TEST(!cmp(a
,c
,equal_to()));
77 BOOST_TEST(!cmp(c
,a
,equal_to()));
78 BOOST_TEST(!cmp(a
,d
,equal_to()));
79 BOOST_TEST(!cmp(d
,a
,equal_to()));
80 BOOST_TEST(!cmp(b
,c
,equal_to()));
81 BOOST_TEST(!cmp(c
,b
,equal_to()));
82 BOOST_TEST(!cmp(b
,d
,equal_to()));
83 BOOST_TEST(!cmp(d
,b
,equal_to()));
103 test2
<int, double>();
104 test2
<double, int>();
105 test2
<double, double>();
106 return boost::report_errors();