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_mat.hpp>
7 #include <boost/qvm/mat_operations.hpp>
8 #include <boost/qvm/mat_traits_array.hpp>
9 #include <boost/qvm/mat.hpp>
10 #include "test_qvm.hpp"
11 #include "test_qvm_matrix.hpp"
12 #include "gold.hpp"
13 
14 namespace
15     {
16     template <int Rows,int Cols,int Row>
17     void
test()18     test()
19         {
20         using namespace boost::qvm;
21         test_qvm::matrix<M1,Rows,Cols> x(42,1);
22         float r1[Rows-1][Cols];
23         for( int i=0; i!=Rows-1; ++i )
24             for( int j=0; j!=Cols; ++j )
25                 r1[i][j]=x.a[i+(i>=Row)][j];
26         float r2[Rows-1][Cols];
27         assign(r2,del_row<Row>(x));
28         BOOST_QVM_TEST_EQ(r1,r2);
29         del_row<Row>(x) *= 2;
30         for( int i=0; i!=Rows-1; ++i )
31             for( int j=0; j!=Cols; ++j )
32                 r1[i][j]=x.a[i+(i>=Row)][j];
33         assign(r2,del_row<Row>(x));
34         BOOST_QVM_TEST_EQ(r1,r2);
35         del_row<Row>(x)+del_row<Row>(x);
36         -del_row<Row>(x);
37         }
38     }
39 
40 int
main()41 main()
42     {
43     test<2,2,0>();
44     test<2,2,1>();
45 
46     test<3,3,0>();
47     test<3,3,1>();
48     test<3,3,2>();
49 
50     test<4,4,0>();
51     test<4,4,1>();
52     test<4,4,2>();
53     test<4,4,3>();
54 
55     test<5,5,0>();
56     test<5,5,1>();
57     test<5,5,2>();
58     test<5,5,3>();
59     test<5,5,4>();
60     return boost::report_errors();
61     }
62