| 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 Row> |
| 23 | void |
| 24 | test() |
| 25 | { |
| 26 | using namespace boost::qvm; |
| 27 | test_qvm::matrix<M1,Rows,Cols> x(42,1); |
| 28 | float r1[Cols]; |
| 29 | for( int i=0; i!=Cols; ++i ) |
| 30 | r1[i]=x.a[Row][i]; |
| 31 | float r2[Cols]; |
| 32 | assign(r2,row<Row>(x)); |
| 33 | BOOST_QVM_TEST_EQ(r1,r2); |
| 34 | row<Row>(x) *= 2; |
| 35 | for( int i=0; i!=Cols; ++i ) |
| 36 | r1[i]=x.a[Row][i]; |
| 37 | assign(r2,row<Row>(x)); |
| 38 | BOOST_QVM_TEST_EQ(r1,r2); |
| 39 | row<Row>(x) + row<Row>(x); |
| 40 | -row<Row>(x); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | int |
| 45 | main() |
| 46 | { |
| 47 | test<2,1,0>(); |
| 48 | test<2,1,1>(); |
| 49 | test<3,1,0>(); |
| 50 | test<3,1,1>(); |
| 51 | test<3,1,2>(); |
| 52 | test<4,1,0>(); |
| 53 | test<4,1,1>(); |
| 54 | test<4,1,2>(); |
| 55 | test<4,1,3>(); |
| 56 | test<5,1,0>(); |
| 57 | test<5,1,1>(); |
| 58 | test<5,1,2>(); |
| 59 | test<5,1,3>(); |
| 60 | test<5,1,4>(); |
| 61 | |
| 62 | test<2,2,0>(); |
| 63 | test<2,2,1>(); |
| 64 | test<3,2,0>(); |
| 65 | test<3,2,1>(); |
| 66 | test<3,2,2>(); |
| 67 | test<4,2,0>(); |
| 68 | test<4,2,1>(); |
| 69 | test<4,2,2>(); |
| 70 | test<4,2,3>(); |
| 71 | test<5,2,0>(); |
| 72 | test<5,2,1>(); |
| 73 | test<5,2,2>(); |
| 74 | test<5,2,3>(); |
| 75 | test<5,2,4>(); |
| 76 | |
| 77 | test<2,3,0>(); |
| 78 | test<2,3,1>(); |
| 79 | test<3,3,0>(); |
| 80 | test<3,3,1>(); |
| 81 | test<3,3,2>(); |
| 82 | test<4,3,0>(); |
| 83 | test<4,3,1>(); |
| 84 | test<4,3,2>(); |
| 85 | test<4,3,3>(); |
| 86 | test<5,3,0>(); |
| 87 | test<5,3,1>(); |
| 88 | test<5,3,2>(); |
| 89 | test<5,3,3>(); |
| 90 | test<5,3,4>(); |
| 91 | |
| 92 | test<2,4,0>(); |
| 93 | test<2,4,1>(); |
| 94 | test<3,4,0>(); |
| 95 | test<3,4,1>(); |
| 96 | test<3,4,2>(); |
| 97 | test<4,4,0>(); |
| 98 | test<4,4,1>(); |
| 99 | test<4,4,2>(); |
| 100 | test<4,4,3>(); |
| 101 | test<5,4,0>(); |
| 102 | test<5,4,1>(); |
| 103 | test<5,4,2>(); |
| 104 | test<5,4,3>(); |
| 105 | test<5,4,4>(); |
| 106 | |
| 107 | test<2,5,0>(); |
| 108 | test<2,5,1>(); |
| 109 | test<3,5,0>(); |
| 110 | test<3,5,1>(); |
| 111 | test<3,5,2>(); |
| 112 | test<4,5,0>(); |
| 113 | test<4,5,1>(); |
| 114 | test<4,5,2>(); |
| 115 | test<4,5,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 | } |
| 124 | |