]>
Commit | Line | Data |
---|---|---|
3a9019d9 FG |
1 | //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.\r |
2 | \r | |
3 | //Distributed under the Boost Software License, Version 1.0. (See accompanying\r | |
4 | //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r | |
5 | \r | |
6 | #include <boost/qvm/quat_operations.hpp>\r | |
7 | #include <boost/qvm/quat.hpp>\r | |
8 | #include "test_qvm_quaternion.hpp"\r | |
9 | #include "gold.hpp"\r | |
10 | \r | |
11 | namespace\r | |
12 | {\r | |
13 | template <class T,class U> struct same_type_tester;\r | |
14 | template <class T> struct same_type_tester<T,T> { };\r | |
15 | template <class T,class U> void test_same_type( T, U ) { same_type_tester<T,U>(); }\r | |
16 | \r | |
17 | void\r | |
18 | test()\r | |
19 | {\r | |
20 | using namespace boost::qvm::sfinae;\r | |
21 | test_qvm::quaternion<Q1> const x(42,2);\r | |
22 | {\r | |
23 | test_qvm::quaternion<Q1> const y(42,1);\r | |
24 | test_same_type(x,x-y);\r | |
25 | test_qvm::quaternion<Q1> r=x-y;\r | |
26 | test_qvm::subtract_v(r.b,x.b,y.b);\r | |
27 | BOOST_QVM_TEST_EQ(r.a,r.b);\r | |
28 | }\r | |
29 | {\r | |
30 | test_qvm::quaternion<Q1> const y(42,1);\r | |
31 | test_qvm::quaternion<Q2> r=qref(x)-y;\r | |
32 | test_qvm::subtract_v(r.b,x.b,y.b);\r | |
33 | BOOST_QVM_TEST_EQ(r.a,r.b);\r | |
34 | }\r | |
35 | {\r | |
36 | test_qvm::quaternion<Q1> const y(42,1);\r | |
37 | test_qvm::quaternion<Q2> r=x-qref(y);\r | |
38 | test_qvm::subtract_v(r.b,x.b,y.b);\r | |
39 | BOOST_QVM_TEST_EQ(r.a,r.b);\r | |
40 | }\r | |
41 | }\r | |
42 | }\r | |
43 | \r | |
44 | int\r | |
45 | main()\r | |
46 | {\r | |
47 | test();\r | |
48 | return boost::report_errors();\r | |
49 | }\r |