]>
Commit | Line | Data |
---|---|---|
1e59de90 | 1 | // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. |
92f5a8d4 | 2 | |
1e59de90 TL |
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 | #ifdef BOOST_QVM_TEST_SINGLE_HEADER | |
7 | # include BOOST_QVM_TEST_SINGLE_HEADER | |
8 | #else | |
9 | # include <boost/qvm/quat_operations.hpp> | |
10 | #endif | |
92f5a8d4 | 11 | |
92f5a8d4 TL |
12 | #include "test_qvm_quaternion.hpp" |
13 | #include "gold.hpp" | |
14 | ||
15 | namespace | |
16 | { | |
17 | template <class T,class U> struct same_type_tester; | |
18 | template <class T> struct same_type_tester<T,T> { }; | |
19 | template <class T,class U> void test_same_type( T, U ) { same_type_tester<T,U>(); } | |
20 | ||
21 | void | |
22 | test() | |
23 | { | |
24 | using namespace boost::qvm::sfinae; | |
25 | ||
26 | test_qvm::quaternion<Q1> const x(42,1); | |
27 | { | |
28 | test_qvm::quaternion<Q1> const y(43,1); | |
29 | test_same_type(float(),dot(x,y)); | |
30 | float d1=dot(x,y); | |
31 | float d2=test_qvm::dot<float>(x.a,y.a); | |
32 | BOOST_QVM_TEST_CLOSE(d1,d2,0.000001f); | |
33 | } | |
34 | { | |
35 | test_qvm::quaternion<Q1,double> const y(43,1); | |
36 | test_same_type(double(),dot(x,y)); | |
37 | double d1=dot(x,y); | |
38 | double d2=test_qvm::dot<double>(x.a,y.a); | |
39 | BOOST_QVM_TEST_CLOSE(d1,d2,0.000001); | |
40 | } | |
41 | } | |
42 | } | |
43 | ||
44 | int | |
45 | main() | |
46 | { | |
47 | test(); | |
48 | return boost::report_errors(); | |
49 | } |