assign_test.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/quat_operations.hpp>
  5. #include <boost/qvm/vec_operations.hpp>
  6. #include <boost/qvm/mat_operations.hpp>
  7. #include "test_qvm_matrix.hpp"
  8. #include "test_qvm_quaternion.hpp"
  9. #include "test_qvm_vector.hpp"
  10. #include "gold.hpp"
  11. namespace
  12. {
  13. template <int Rows,int Cols>
  14. void
  15. test_matrix()
  16. {
  17. using namespace boost::qvm::sfinae;
  18. test_qvm::matrix<M1,Rows,Cols> const x(42,1);
  19. test_qvm::matrix<M2,Rows,Cols> y(43,1);
  20. assign(y,x);
  21. BOOST_QVM_TEST_EQ(x.a,y.a);
  22. }
  23. template <int Dim>
  24. void
  25. test_vector()
  26. {
  27. using namespace boost::qvm::sfinae;
  28. test_qvm::vector<V1,Dim> const x(42,1);
  29. test_qvm::vector<V2,Dim> y(43,1);
  30. assign(y,x);
  31. BOOST_QVM_TEST_EQ(x.a,y.a);
  32. }
  33. void
  34. test_quaternion()
  35. {
  36. using namespace boost::qvm::sfinae;
  37. test_qvm::quaternion<Q1> const x(42,1);
  38. test_qvm::quaternion<Q2> y(43,1);
  39. assign(y,x);
  40. BOOST_QVM_TEST_EQ(x.a,y.a);
  41. }
  42. }
  43. int
  44. main()
  45. {
  46. test_matrix<1,2>();
  47. test_matrix<2,1>();
  48. test_matrix<2,2>();
  49. test_matrix<1,3>();
  50. test_matrix<3,1>();
  51. test_matrix<3,3>();
  52. test_matrix<1,4>();
  53. test_matrix<4,1>();
  54. test_matrix<4,4>();
  55. test_matrix<1,5>();
  56. test_matrix<5,1>();
  57. test_matrix<5,5>();
  58. test_vector<2>();
  59. test_vector<3>();
  60. test_vector<4>();
  61. test_vector<5>();
  62. test_quaternion();
  63. return boost::report_errors();
  64. }