• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
2 
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/qvm/quat_operations.hpp>
7 #include "test_qvm_quaternion.hpp"
8 #include "gold.hpp"
9 
10 namespace
11     {
12     template <class T,class U> struct same_type_tester;
13     template <class T> struct same_type_tester<T,T> { };
test_same_type(T,U)14     template <class T,class U> void test_same_type( T, U ) { same_type_tester<T,U>(); }
15 
16     void
test()17     test()
18         {
19         using namespace boost::qvm::sfinae;
20 
21         test_qvm::quaternion<Q1> const x(42,1);
22             {
23             test_qvm::quaternion<Q1> const y(43,1);
24             test_same_type(float(),dot(x,y));
25             float d1=dot(x,y);
26             float d2=test_qvm::dot<float>(x.a,y.a);
27             BOOST_QVM_TEST_CLOSE(d1,d2,0.000001f);
28             }
29             {
30             test_qvm::quaternion<Q1,double> const y(43,1);
31             test_same_type(double(),dot(x,y));
32             double d1=dot(x,y);
33             double d2=test_qvm::dot<double>(x.a,y.a);
34             BOOST_QVM_TEST_CLOSE(d1,d2,0.000001);
35             }
36         }
37     }
38 
39 int
main()40 main()
41     {
42     test();
43     return boost::report_errors();
44     }
45