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/mat_operations.hpp> 7 #include "test_qvm_matrix.hpp" 8 9 namespace 10 { 11 template <int Dim> 12 void test()13 test() 14 { 15 using namespace boost::qvm; 16 test_qvm::matrix<M1,Dim,Dim> m=identity_mat<float,Dim>(); 17 for( int i=0; i!=Dim; ++i ) 18 for( int j=0; j!=Dim; ++j ) 19 BOOST_TEST(m.a[i][j]==float(i==j)); 20 test_qvm::matrix<M2,Dim,Dim> n(42,1); 21 set_identity(n); 22 for( int i=0; i!=Dim; ++i ) 23 for( int j=0; j!=Dim; ++j ) 24 BOOST_TEST(n.a[i][j]==float(i==j)); 25 } 26 } 27 28 int main()29main() 30 { 31 test<2>(); 32 test<3>(); 33 test<4>(); 34 test<5>(); 35 return boost::report_errors(); 36 } 37