mag_q_test.cpp 749 B

12345678910111213141516171819202122232425262728293031
  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 "test_qvm_quaternion.hpp"
  6. #include "gold.hpp"
  7. namespace
  8. {
  9. void
  10. test()
  11. {
  12. using namespace boost::qvm::sfinae;
  13. test_qvm::quaternion<Q1> const x(42,1);
  14. float m1=mag(x);
  15. float m2=mag(qref(x));
  16. float m3=sqrtf(test_qvm::dot<float>(x.a,x.a));
  17. BOOST_QVM_TEST_CLOSE(m1,m3,0.000001f);
  18. BOOST_QVM_TEST_CLOSE(m2,m3,0.000001f);
  19. }
  20. }
  21. int
  22. main()
  23. {
  24. test();
  25. return boost::report_errors();
  26. }