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