35 double data[] = {1., 2., 3.};
41 logger.assert_always(x0.
size() == 0,
"Constructor creates a vector of the wrong size");
42 logger.assert_always(x1.
size() == 1,
"Constructor creates a vector of the wrong size");
43 logger.assert_always(y1.size() == 1,
"Constructor creates a vector of the wrong size");
44 logger.assert_always(y1 == x1,
"Copied array does not pass equality test");
45 logger.assert_always(std::abs(y1[0] - x1[0]) < 1e-12,
"Copy constructor does not copy values");
46 logger.assert_always(destroy.
size() == 4,
"Constructor creates a vector of the wrong size");
47 logger.assert_always(convenient.size() == 4,
"Constructor creates a vector of the wrong size");
48 logger.assert_always(fromArray.size() == 3,
"Constructor creates a vector of the wrong size");
51 logger.assert_always(moved.size() == 4,
"Constructor creates a vector of the wrong size");
52 logger.assert_always(std::abs(moved[2] - 4.) < 1e-12,
"Constructor from array does not copy!");
53 logger.assert_always(std::abs(fromArray(0) - 1.) < 1e-12,
"Constructor from array does not copy!");
54 logger.assert_always(std::abs(fromArray(1) - 2.) < 1e-12,
"Constructor from array does not copy!");
55 logger.assert_always(std::abs(fromArray[2] - 3.) < 1e-12,
"Constructor from array does not copy!");
56 logger.assert_always(std::abs(convenient[0] - 5.) < 1e-12,
"Initializer list constructor does not copy!");
57 logger.assert_always(std::abs(convenient[1] - 6.) < 1e-12,
"Initializer list constructor does not copy!");
58 logger.assert_always(std::abs(convenient[2] - 8.) < 1e-12,
"Initializer list constructor does not copy!");
59 logger.assert_always(std::abs(convenient[3] - 9.) < 1e-12,
"Initializer list constructor does not copy!");
61 logger.assert_always(assigned.
size() == 4,
"Constructor creates a vector of the wrong size");
62 logger.assert_always(std::abs(assigned[2] - 4.) < 1e-12,
"Constructor from array does not copy!");
64 logger.assert_always(destroy.
size() == 4,
"Assignment operator creates a vector of the wrong size");
65 logger.assert_always(std::abs(convenient(0) - 5.) < 1e-12,
"Assignment operator from array does not copy!");
66 logger.assert_always(std::abs(convenient[1] - 6.) < 1e-12,
"Assignment operator from array does not copy!");
67 logger.assert_always(std::abs(convenient(2) - 8.) < 1e-12,
"Assignment operator from array does not copy!");
68 logger.assert_always(std::abs(convenient(3) - 9.) < 1e-12,
"Assignment operator from array does not copy!");
77 logger.assert_always(pr2.
size() == 2,
"Constructor creates a vector of the wrong size");
78 logger.assert_always(pc2.
size() == 2,
"Constructor creates a vector of the wrong size");
79 for (std::size_t
i = 0;
i < 2; ++
i)
81 logger.assert_always((std::abs(pc2[
i] - 0.8 -
i) < 1e-12),
"assignment operator");
82 logger.assert_always((std::abs(pr2[
i] - 0.8 -
i) < 1e-12),
"assignment operator");
84 logger.assert_always((pr2 == pc2 && pc2 == pr2 && pc2 == p2 && !(pr2 == pv2 || pv2 == pr2 || p2 == pv2)),
"equality operator");
85 logger.assert_always(!(pr2 == pw2 || pw2 == pr2 || p2 == pw2 || pr2 == px2 || px2 == pr2 || p2 == px2 || pr2 == py2 || py2 == pr2 || p2 == py2),
"equality operator");
87 for (std::size_t
i = 0;
i < 2; ++
i)
89 logger.assert_always((std::abs(pc2[
i] - 1.6 - 2 *
i) < 1e-12),
"increment operator");
92 for (std::size_t
i = 0;
i < 2; ++
i)
94 logger.assert_always((std::abs(pc2[
i] - 0.8 - 2 *
i) < 1e-12),
"decrement operator");
97 for (std::size_t
i = 0;
i < 2; ++
i)
99 logger.assert_always((std::abs(pc2[
i] - 3.2 - 8 *
i) < 1e-12),
"multiply operator");
101 for (std::size_t
i = 0;
i < 2; ++
i)
103 logger.assert_always((std::abs((pc2 * -0.25)[
i] + 0.8 + 2 *
i) < 1e-12),
"multiplication");
105 for (std::size_t
i = 0;
i < 2; ++
i)
107 logger.assert_always((std::abs((pc2 + pv2)[
i] - 4. - 8 *
i) < 1e-12),
"addition");
109 for (std::size_t
i = 0;
i < 2; ++
i)
111 logger.assert_always((std::abs((pv2 - pc2)[
i] + 2.4 + 8 *
i) < 1e-12),
"subtraction");
113 for (std::size_t
i = 0;
i < 2; ++
i)
115 logger.assert_always((std::abs((-pc2)[
i] + 3.2 + 8 *
i) < 1e-12),
"unary -");
117 for (std::size_t
i = 0;
i < 2; ++
i)
119 logger.assert_always((std::abs((0.25 * pc2)[
i] - 0.8 - 2 *
i) < 1e-12),
"left multiplication");
121 logger.assert_always((std::abs((pv2 * pc2) - 1.44 * 8) < 1e-12),
"in-product");
123 for (std::size_t
i = 0;
i < 2; ++
i)
125 logger.assert_always((std::abs(pc2[
i] - 0.8 - 2 *
i) < 1e-12),
"divide operator");
127 for (std::size_t
i = 0;
i < 2; ++
i)
129 logger.assert_always((std::abs((pc2 / -0.25)[
i] + 3.2 + 8 *
i) < 1e-12),
"division");
132 for (std::size_t
i = 0;
i < 2; ++
i)
134 logger.assert_always((std::abs(pc2[
i] + 1.6 +
i) < 1e-12),
"combined multiply and addition (y = ax + y)");
140 logger.assert_always(std::abs(magicCopy(0) - 5.) < 1e-12,
"Assignment operator from array does not copy!");
141 logger.assert_always(std::abs(magicCopy(1) - 6.) < 1e-12,
"Assignment operator from array does not copy!");
142 logger.assert_always(std::abs(magicCopy(2) - 8.) < 1e-12,
"Assignment operator from array does not copy!");
143 logger.assert_always(std::abs(magicCopy(3) - 9.) < 1e-12,
"Assignment operator from array does not copy!");
144 convenient.data()[3] = 2.;
145 logger.assert_always(std::abs(magicCopy(3) - 9.) < 1e-12,
"Assignment operator from array does not copy!");
146 logger.assert_always(std::abs(convenient(3) - 2.) < 1e-12,
"Assignment operator from array does not copy!");
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Definition: SmallVector.h:62
unsigned int size() const
Definition: SmallVector.h:233
const Mdouble * data() const
Definition: SmallVector.h:238
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51