1// Copyright 2008-2022 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#ifdef BOOST_QVM_TEST_SINGLE_HEADER
7# include BOOST_QVM_TEST_SINGLE_HEADER
8#else
9# include <boost/qvm/vec_operations.hpp>
10#endif
11
12#include "test_qvm_vector.hpp"
13#include "gold.hpp"
14
15namespace
16 {
17 template <int Dim>
18 void
19 test()
20 {
21 using namespace boost::qvm::sfinae;
22
23 test_qvm::vector<V1,Dim> const x(42,1);
24 float m1=mag_sqr(x);
25 float m2=mag_sqr(vref(x));
26 float m3=test_qvm::dot<float>(x.a,x.a);
27 BOOST_QVM_TEST_CLOSE(m1,m3,0.000001f);
28 BOOST_QVM_TEST_CLOSE(m2,m3,0.000001f);
29 }
30 }
31
32int
33main()
34 {
35 test<2>();
36 test<3>();
37 test<4>();
38 test<5>();
39 return boost::report_errors();
40 }
41

source code of boost/libs/qvm/test/mag_sqr_v_test.cpp