col_mat_test.cpp 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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.hpp>
  5. #include <boost/qvm/mat_traits_array.hpp>
  6. #include <boost/qvm/vec_operations.hpp>
  7. #include <boost/qvm/mat_operations.hpp>
  8. #include <boost/qvm/mat.hpp>
  9. #include "test_qvm_vector.hpp"
  10. #include "gold.hpp"
  11. namespace
  12. {
  13. template <int Dim>
  14. void
  15. test()
  16. {
  17. using namespace boost::qvm;
  18. test_qvm::vector<V1,Dim> x(42,1);
  19. float y[1][Dim]; assign(y,transposed(col_mat(x)));
  20. BOOST_QVM_TEST_EQ(x.a,y[0]);
  21. test_qvm::scalar_multiply_v(x.b,x.a,2.0f);
  22. col<0>(col_mat(x)) *= 2;
  23. BOOST_QVM_TEST_EQ(x.a,x.b);
  24. col_mat(x)+col_mat(x);
  25. -col_mat(x);
  26. }
  27. }
  28. int
  29. main()
  30. {
  31. test<2>();
  32. test<3>();
  33. test<4>();
  34. test<5>();
  35. return boost::report_errors();
  36. }