ALL
0.9.3
A Loadbalacing Library
Loading...
Searching...
No Matches
point_dot.cpp
Go to the documentation of this file.
1
/*
2
Copyright 2018-2020 Rene Halver, Forschungszentrum Juelich GmbH, Germany
3
Copyright 2018-2020 Godehard Sutmann, Forschungszentrum Juelich GmbH, Germany
4
5
Redistribution and use in source and binary forms, with or without modification,
6
are permitted provided that the following conditions are met:
7
8
1. Redistributions of source code must retain the above copyright notice, this
9
list of conditions and the following disclaimer.
10
11
2. Redistributions in binary form must reproduce the above copyright notice, this
12
list of conditions and the following disclaimer in the documentation and/or
13
other materials provided with the distribution.
14
15
3. Neither the name of the copyright holder nor the names of its contributors may
16
be used to endorse or promote products derived from this software without
17
specific prior written permission.
18
19
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
#define BOOST_TEST_MAIN
32
33
#define BOOST_TEST_MODULE point_dot
34
#include "
ALL_Point.hpp
"
35
#include <vector>
36
#include <boost/test/unit_test.hpp>
37
38
BOOST_AUTO_TEST_SUITE(point_dot)
39
40
BOOST_AUTO_TEST_CASE
(point_dot_double) {
41
std::vector<double> A_data = {2.8, -5.3, 8.8};
42
std::vector<double> B_data = {-5.2, 1.1, 0.4};
43
44
ALL::Point<double>
A(A_data);
45
ALL::Point<double>
B(B_data);
46
47
double
C = A*B;
48
49
BOOST_CHECK_CLOSE(C,-16.87,1e-9);
50
}
51
52
BOOST_AUTO_TEST_CASE
(point_dot_float) {
53
std::vector<float> A_data = {2.8f, -5.3f, 8.8f};
54
std::vector<float> B_data = {-5.2f, 1.1f, 0.4f};
55
56
ALL::Point<float>
A(A_data);
57
ALL::Point<float>
B(B_data);
58
59
float
C = A*B;
60
61
BOOST_CHECK_CLOSE(C,-16.87,1e-4);
62
}
63
64
BOOST_AUTO_TEST_CASE
(point_dot_long_double) {
65
std::vector<long double> A_data = {2.8l, -5.3l, 8.8l};
66
std::vector<long double> B_data = {-5.2l, 1.1l, 0.4l};
67
68
ALL::Point<long double>
A(A_data);
69
ALL::Point<long double>
B(B_data);
70
71
long
double
C = A*B;
72
73
BOOST_CHECK_CLOSE(C,-16.87l,1e-14);
74
}
75
76
BOOST_AUTO_TEST_SUITE_END()
77
ALL_Point.hpp
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(empty)
Definition
all_class_creation.cpp:44
ALL::Point
Definition
ALL_Point.hpp:49
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(point_dot_double)
Definition
point_dot.cpp:40
tests
unit
point_dot.cpp
Generated by
1.13.2