]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/col_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / qvm / test / col_test.cpp
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
2
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)
5
6 #include <boost/qvm/map_mat_vec.hpp>
7 #include <boost/qvm/vec_traits_array.hpp>
8 #include <boost/qvm/mat_operations.hpp>
9 #include <boost/qvm/vec_operations.hpp>
10 #include <boost/qvm/vec.hpp>
11 #include "test_qvm.hpp"
12 #include "test_qvm_matrix.hpp"
13 #include "gold.hpp"
14
15 namespace
16 {
17 template <int Rows,int Cols,int Col>
18 void
19 test()
20 {
21 using namespace boost::qvm;
22 test_qvm::matrix<M1,Rows,Cols> x(42,1);
23 float r1[Rows];
24 for( int i=0; i!=Rows; ++i )
25 r1[i]=x.a[i][Col];
26 float r2[Rows];
27 assign(r2,col<Col>(x));
28 BOOST_QVM_TEST_EQ(r1,r2);
29 col<Col>(x) *= 2;
30 for( int i=0; i!=Rows; ++i )
31 r1[i]=x.a[i][Col];
32 assign(r2,col<Col>(x));
33 BOOST_QVM_TEST_EQ(r1,r2);
34 col<Col>(x) + col<Col>(x);
35 -col<Col>(x);
36 }
37 }
38
39 int
40 main()
41 {
42 test<1,2,0>();
43 test<1,2,1>();
44 test<1,3,0>();
45 test<1,3,1>();
46 test<1,3,2>();
47 test<1,4,0>();
48 test<1,4,1>();
49 test<1,4,2>();
50 test<1,4,3>();
51 test<1,5,0>();
52 test<1,5,1>();
53 test<1,5,2>();
54 test<1,5,3>();
55 test<1,5,4>();
56
57 test<2,2,0>();
58 test<2,2,1>();
59 test<2,3,0>();
60 test<2,3,1>();
61 test<2,3,2>();
62 test<2,4,0>();
63 test<2,4,1>();
64 test<2,4,2>();
65 test<2,4,3>();
66 test<2,5,0>();
67 test<2,5,1>();
68 test<2,5,2>();
69 test<2,5,3>();
70 test<2,5,4>();
71
72 test<3,2,0>();
73 test<3,2,1>();
74 test<3,3,0>();
75 test<3,3,1>();
76 test<3,3,2>();
77 test<3,4,0>();
78 test<3,4,1>();
79 test<3,4,2>();
80 test<3,4,3>();
81 test<3,5,0>();
82 test<3,5,1>();
83 test<3,5,2>();
84 test<3,5,3>();
85 test<3,5,4>();
86
87 test<4,2,0>();
88 test<4,2,1>();
89 test<4,3,0>();
90 test<4,3,1>();
91 test<4,3,2>();
92 test<4,4,0>();
93 test<4,4,1>();
94 test<4,4,2>();
95 test<4,4,3>();
96 test<4,5,0>();
97 test<4,5,1>();
98 test<4,5,2>();
99 test<4,5,3>();
100 test<4,5,4>();
101
102 test<5,2,0>();
103 test<5,2,1>();
104 test<5,3,0>();
105 test<5,3,1>();
106 test<5,3,2>();
107 test<5,4,0>();
108 test<5,4,1>();
109 test<5,4,2>();
110 test<5,4,3>();
111 test<5,5,0>();
112 test<5,5,1>();
113 test<5,5,2>();
114 test<5,5,3>();
115 test<5,5,4>();
116
117 return boost::report_errors();
118 }