summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/qvm/test/access_q_test.cpp
blob: 063c2e50d5b6e4e168083c22978d05b2d4a9a46e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.

//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <boost/qvm/quat_access.hpp>
#include <boost/qvm/vec_access.hpp>
#include "test_qvm_quaternion.hpp"

int
main()
    {       
    using namespace boost::qvm;

    test_qvm::quaternion<Q1> q;
    q.a[0]=42.0f;
    q.a[1]=43.0f;
    q.a[2]=44.0f;
    q.a[3]=45.0f;
    test_qvm::quaternion<Q1> const & qq=q;

    BOOST_TEST_EQ(X(V(qq)),q.a[1]);
    BOOST_TEST_EQ(Y(V(qq)),q.a[2]);
    BOOST_TEST_EQ(Z(V(qq)),q.a[3]);
    BOOST_TEST(&X(V(q))==&q.a[1]);
    BOOST_TEST(&Y(V(q))==&q.a[2]);
    BOOST_TEST(&Z(V(q))==&q.a[3]);

    BOOST_TEST_EQ(S(qq),q.a[0]);
    BOOST_TEST_EQ(X(qq),q.a[1]);
    BOOST_TEST_EQ(Y(qq),q.a[2]);
    BOOST_TEST_EQ(Z(qq),q.a[3]);
    BOOST_TEST(&S(q)==&q.a[0]);
    BOOST_TEST(&X(q)==&q.a[1]);
    BOOST_TEST(&Y(q)==&q.a[2]);
    BOOST_TEST(&Z(q)==&q.a[3]);

    return boost::report_errors();
    }