ALL
0.9.3
A Loadbalacing Library
Loading...
Searching...
No Matches
all_class_creation.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,
12
this 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
16
may 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
22
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
#define BOOST_TEST_MAIN
32
33
#define BOOST_TEST_MODULE all_class_creation
34
#include "
ALL.hpp
"
35
#include "
ALL_Point.hpp
"
36
#include "
ALL_CustomExceptions.hpp
"
37
#include <boost/test/unit_test.hpp>
38
#include <list>
39
#include <mpi.h>
40
#include <vector>
41
42
BOOST_AUTO_TEST_SUITE(all_class_creation)
43
44
BOOST_AUTO_TEST_CASE
(empty) {
45
int
already_init;
46
MPI_Initialized(&already_init);
47
if
(!already_init)
48
MPI_Init(NULL, NULL);
49
50
ALL::ALL<double, double>
test();
51
52
int
already_final;
53
MPI_Finalized(&already_final);
54
if
(!already_final)
55
MPI_Finalize();
56
}
57
58
BOOST_AUTO_TEST_CASE
(simple) {
59
int
already_init;
60
MPI_Initialized(&already_init);
61
if
(!already_init)
62
MPI_Init(NULL, NULL);
63
64
ALL::LB_t
method =
ALL::TENSOR
;
65
int
dimension = 3;
66
double
gamma = 4.0;
67
68
ALL::ALL<double, double>
test(method, dimension, gamma);
69
70
// comment(s.schulz): What is supposed to be checked here?
71
// Just the calling? Then we should make sure to also access the result
72
double
check_dim = test.
getDimension
();
73
double
check_gamma = test.
getGamma
();
74
75
// comment(s.schulz): Not sure if there is a better way than assert in the boost framework
76
assert(check_dim == dimension);
77
assert(check_gamma == gamma);
78
79
int
already_final;
80
MPI_Finalized(&already_final);
81
if
(!already_final)
82
MPI_Finalize();
83
}
84
85
// comment (r.halver): check if the constructor fails when using a dimension not equal to 3
86
// !to be changed, when the library can deal with dimensions not equal to 3!
87
BOOST_AUTO_TEST_CASE
(dimension_2)
88
{
89
int
already_init;
90
MPI_Initialized(&already_init);
91
if
(!already_init)
92
MPI_Init(NULL,NULL);
93
94
ALL::LB_t
method =
ALL::TENSOR
;
95
int
dimension = 2;
96
double
gamma = 4.0;
97
98
bool
success =
false
;
99
try
100
{
101
ALL::ALL<double, double>
test(method, dimension, gamma);
102
}
103
catch
(
ALL::InvalidArgumentException
)
104
{
105
success =
true
;
106
}
107
BOOST_TEST(success);
108
}
109
110
BOOST_AUTO_TEST_SUITE_END()
ALL.hpp
ALL_CustomExceptions.hpp
ALL_Point.hpp
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(empty)
Definition
all_class_creation.cpp:44
ALL::ALL
Definition
ALL.hpp:102
ALL::ALL::getGamma
T getGamma()
Definition
ALL.hpp:273
ALL::ALL::getDimension
int getDimension()
Definition
ALL.hpp:428
ALL::LB_t
LB_t
enum type to describe the different balancing methods
Definition
ALL.hpp:80
ALL::TENSOR
@ TENSOR
tensor based load balancing
Definition
ALL.hpp:84
ALL::InvalidArgumentException
Definition
ALL_CustomExceptions.hpp:145
tests
unit
all_class_creation.cpp
Generated by
1.13.2