mul_ms_test.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.hpp>
  6. #include "test_qvm_matrix.hpp"
  7. #include "gold.hpp"
  8. namespace
  9. {
  10. template <class T,class U> struct same_type_tester;
  11. template <class T> struct same_type_tester<T,T> { };
  12. template <class T,class U> void test_same_type( T, U ) { same_type_tester<T,U>(); }
  13. template <int Rows,int Cols>
  14. void
  15. test()
  16. {
  17. using namespace boost::qvm::sfinae;
  18. test_qvm::matrix<M1,Rows,Cols> const x(42,1);
  19. test_qvm::scalar_multiply_m(x.b,x.a,2.0f);
  20. test_same_type(x,x*2);
  21. {
  22. test_qvm::matrix<M1,Rows,Cols> y=x*2;
  23. BOOST_QVM_TEST_EQ(x.b,y.a);
  24. }
  25. {
  26. test_qvm::matrix<M1,Rows,Cols> y=mref(x)*2;
  27. BOOST_QVM_TEST_EQ(x.b,y.a);
  28. }
  29. }
  30. }
  31. int
  32. main()
  33. {
  34. test<1,2>();
  35. test<2,1>();
  36. test<2,2>();
  37. test<1,3>();
  38. test<3,1>();
  39. test<3,3>();
  40. test<1,4>();
  41. test<4,1>();
  42. test<4,4>();
  43. test<1,5>();
  44. test<5,1>();
  45. test<5,5>();
  46. return boost::report_errors();
  47. }