cmp_mm_test.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/mat_operations.hpp>
  5. #include <boost/qvm/mat_traits_array.hpp>
  6. #include "test_qvm_matrix.hpp"
  7. #include "gold.hpp"
  8. namespace
  9. {
  10. template <int Rows,int Cols>
  11. void
  12. test()
  13. {
  14. using namespace boost::qvm::sfinae;
  15. test_qvm::matrix<M1,Rows,Cols> const x(42,1);
  16. for( int i=0; i!=Rows; ++i )
  17. for( int j=0; j!=Cols; ++j )
  18. {
  19. {
  20. test_qvm::matrix<M1,Rows,Cols> y(x);
  21. BOOST_QVM_TEST_EQ(x,y);
  22. y.a[i][j]=0;
  23. BOOST_QVM_TEST_NEQ(x,y);
  24. }
  25. {
  26. test_qvm::matrix<M2,Rows,Cols> y; assign(y,x);
  27. BOOST_QVM_TEST_EQ(x,y);
  28. y.a[i][j]=0;
  29. BOOST_QVM_TEST_NEQ(x,y);
  30. }
  31. }
  32. }
  33. }
  34. int
  35. main()
  36. {
  37. test<1,2>();
  38. test<2,1>();
  39. test<2,2>();
  40. test<1,3>();
  41. test<3,1>();
  42. test<3,3>();
  43. test<1,4>();
  44. test<4,1>();
  45. test<4,4>();
  46. test<1,5>();
  47. test<5,1>();
  48. test<5,5>();
  49. return boost::report_errors();
  50. }