minus_q_test.cpp 1.1 KB

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/quat_operations.hpp>
  5. #include <boost/qvm/quat.hpp>
  6. #include "test_qvm_quaternion.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. void
  14. test()
  15. {
  16. using namespace boost::qvm::sfinae;
  17. test_qvm::quaternion<Q1> const x(42,1);
  18. test_qvm::scalar_multiply_v(x.b,x.a,-1.0f);
  19. test_same_type(x,-x);
  20. {
  21. test_qvm::quaternion<Q1> y=-x;
  22. BOOST_QVM_TEST_EQ(x.b,y.a);
  23. }
  24. {
  25. test_qvm::quaternion<Q1> y=-qref(x);
  26. BOOST_QVM_TEST_EQ(x.b,y.a);
  27. }
  28. }
  29. }
  30. int
  31. main()
  32. {
  33. test();
  34. return boost::report_errors();
  35. }