del_row_test.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/qvm/map_mat_mat.hpp>
  5. #include <boost/qvm/mat_operations.hpp>
  6. #include <boost/qvm/mat_traits_array.hpp>
  7. #include <boost/qvm/mat.hpp>
  8. #include "test_qvm.hpp"
  9. #include "test_qvm_matrix.hpp"
  10. #include "gold.hpp"
  11. namespace
  12. {
  13. template <int Rows,int Cols,int Row>
  14. void
  15. test()
  16. {
  17. using namespace boost::qvm;
  18. test_qvm::matrix<M1,Rows,Cols> x(42,1);
  19. float r1[Rows-1][Cols];
  20. for( int i=0; i!=Rows-1; ++i )
  21. for( int j=0; j!=Cols; ++j )
  22. r1[i][j]=x.a[i+(i>=Row)][j];
  23. float r2[Rows-1][Cols];
  24. assign(r2,del_row<Row>(x));
  25. BOOST_QVM_TEST_EQ(r1,r2);
  26. del_row<Row>(x) *= 2;
  27. for( int i=0; i!=Rows-1; ++i )
  28. for( int j=0; j!=Cols; ++j )
  29. r1[i][j]=x.a[i+(i>=Row)][j];
  30. assign(r2,del_row<Row>(x));
  31. BOOST_QVM_TEST_EQ(r1,r2);
  32. del_row<Row>(x)+del_row<Row>(x);
  33. -del_row<Row>(x);
  34. }
  35. }
  36. int
  37. main()
  38. {
  39. test<2,2,0>();
  40. test<2,2,1>();
  41. test<3,3,0>();
  42. test<3,3,1>();
  43. test<3,3,2>();
  44. test<4,4,0>();
  45. test<4,4,1>();
  46. test<4,4,2>();
  47. test<4,4,3>();
  48. test<5,5,0>();
  49. test<5,5,1>();
  50. test<5,5,2>();
  51. test<5,5,3>();
  52. test<5,5,4>();
  53. return boost::report_errors();
  54. }